AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Creature Class Reference

#include "Creature.h"

Inheritance diagram for Creature:
Unit GridObject< Creature > MovableMapObject WorldObject Object WorldLocation Position TempSummon Minion Guardian Puppet Totem Pet

Public Member Functions

 Creature (bool isWorldObject=false)
 
 ~Creature () override
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
float GetNativeObjectScale () const override
 
void SetObjectScale (float scale) override
 
void SetDisplayId (uint32 modelId) override
 
void DisappearAndDie ()
 
bool isVendorWithIconSpeak () const
 
bool Create (ObjectGuid::LowType guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 vehId, float x, float y, float z, float ang, const CreatureData *data=nullptr)
 
bool LoadCreaturesAddon (bool reload=false)
 
void SelectLevel (bool changelevel=true)
 
void LoadEquipment (int8 id=1, bool force=false)
 
ObjectGuid::LowType GetSpawnId () const
 
void Update (uint32 time) override
 
void GetRespawnPosition (float &x, float &y, float &z, float *ori=nullptr, float *dist=nullptr) const
 
void SetCorpseDelay (uint32 delay)
 
void SetCorpseRemoveTime (uint32 delay)
 
uint32 GetCorpseDelay () const
 
bool IsRacialLeader () const
 
bool IsCivilian () const
 
bool IsTrigger () const
 
bool IsGuard () const
 
CreatureMovementData const & GetMovementTemplate () const
 
bool CanWalk () const
 
bool CanSwim () const override
 This method check the current flag/status of a creature and its inhabit type.
 
bool CanEnterWater () const override
 
bool CanFly () const override
 
bool CanHover () const
 
MovementGeneratorType GetDefaultMovementType () const override
 -------—End of Pet responses methods-------—
 
void SetDefaultMovementType (MovementGeneratorType mgt)
 
void SetReactState (ReactStates st)
 
ReactStates GetReactState () const
 
bool HasReactState (ReactStates state) const
 
void InitializeReactState ()
 
bool isCanInteractWithBattleMaster (Player *player, bool msg) const
 
bool isCanTrainingAndResetTalentsOf (Player *player) const
 
bool IsValidTrainerForPlayer (Player *player, uint32 *npcFlags=nullptr) const
 
bool CanCreatureAttack (Unit const *victim, bool skipDistCheck=false) const
 
void LoadSpellTemplateImmunity ()
 
bool IsImmunedToSpell (SpellInfo const *spellInfo, Spell const *spell=nullptr) override
 
bool HasMechanicTemplateImmunity (uint32 mask) const
 
bool IsImmunedToSpellEffect (SpellInfo const *spellInfo, uint32 index) const override
 
bool isElite () const
 
bool isWorldBoss () const
 
bool IsDungeonBoss () const
 
bool IsImmuneToKnockback () const
 
bool IsAvoidingAOE () const
 
uint8 getLevelForTarget (WorldObject const *target) const override
 
bool IsInEvadeMode () const
 
bool IsEvadingAttacks () const
 
bool AIM_Initialize (CreatureAI *ai=nullptr)
 
void Motion_Initialize ()
 
CreatureAIAI () const
 
bool SetWalk (bool enable) override
 
bool SetDisableGravity (bool disable, bool packetOnly=false, bool updateAnimationTier=true) override
 
bool SetSwim (bool enable) override
 
bool SetCanFly (bool enable, bool packetOnly=false) override
 
bool SetWaterWalking (bool enable, bool packetOnly=false) override
 
bool SetFeatherFall (bool enable, bool packetOnly=false) override
 
bool SetHover (bool enable, bool packetOnly=false, bool updateAnimationTier=true) override
 
bool HasSpellFocus (Spell const *focusSpell=nullptr) const
 
uint32 GetShieldBlockValue () const override
 
SpellSchoolMask GetMeleeDamageSchoolMask (WeaponAttackType=BASE_ATTACK, uint8=0) const override
 
void SetMeleeDamageSchool (SpellSchools school)
 
void _AddCreatureSpellCooldown (uint32 spell_id, uint16 categoryId, uint32 end_time)
 
void AddSpellCooldown (uint32 spell_id, uint32, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
 
bool HasSpellCooldown (uint32 spell_id) const override
 
uint32 GetSpellCooldown (uint32 spell_id) const
 
void ProhibitSpellSchool (SpellSchoolMask idSchoolMask, uint32 unTimeMs) override
 
bool IsSpellProhibited (SpellSchoolMask idSchoolMask) const
 
bool HasSpell (uint32 spellID) const override
 
void UpdateMovementFlags ()
 
uint32 GetRandomId (uint32 id1, uint32 id2, uint32 id3)
 
bool UpdateEntry (uint32 entry, const CreatureData *data=nullptr, bool changelevel=true, bool updateAI=false)
 
bool UpdateEntry (uint32 entry, bool updateAI)
 
bool UpdateStats (Stats stat) override
 
bool UpdateAllStats () override
 
void UpdateResistances (uint32 school) override
 
void UpdateArmor () override
 
void UpdateMaxHealth () override
 
void UpdateMaxPower (Powers power) override
 
void UpdateAttackPowerAndDamage (bool ranged=false) override
 
void CalculateMinMaxDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage, uint8 damageIndex) override
 
void SetCanDualWield (bool value) override
 
int8 GetOriginalEquipmentId () const
 
uint8 GetCurrentEquipmentId ()
 
void SetCurrentEquipmentId (uint8 id)
 
float GetSpellDamageMod (int32 Rank)
 
VendorItemData const * GetVendorItems () const
 
uint32 GetVendorItemCurrentCount (VendorItem const *vItem)
 
uint32 UpdateVendorItemCurrentCount (VendorItem const *vItem, uint32 used_count)
 
TrainerSpellData const * GetTrainerSpells () const
 
CreatureTemplate const * GetCreatureTemplate () const
 
CreatureData const * GetCreatureData () const
 
void SetDetectionDistance (float dist)
 
CreatureAddon const * GetCreatureAddon () const
 
std::string const & GetAIName () const
 
std::string GetScriptName () const
 
uint32 GetScriptId () const
 
std::string const & GetNameForLocaleIdx (LocaleConstant locale_idx) const override
 
void setDeathState (DeathState s, bool despawn=false) override
 
bool LoadFromDB (ObjectGuid::LowType guid, Map *map, bool allowDuplicate=false)
 
bool LoadCreatureFromDB (ObjectGuid::LowType guid, Map *map, bool addToMap=true, bool gridLoad=false, bool allowDuplicate=false)
 
void SaveToDB ()
 
virtual void SaveToDB (uint32 mapid, uint8 spawnMask, uint32 phaseMask)
 
virtual void DeleteFromDB ()
 
ObjectGuid GetLootRecipientGUID () const
 
PlayerGetLootRecipient () const
 
ObjectGuid::LowType GetLootRecipientGroupGUID () const
 
GroupGetLootRecipientGroup () const
 
bool hasLootRecipient () const
 
bool isTappedBy (Player const *player) const
 
bool CanGeneratePickPocketLoot () const
 
void SetPickPocketLootTime ()
 
void ResetPickPocketLootTime ()
 
void SetLootRecipient (Unit *unit, bool withGroup=true)
 
void AllLootRemovedFromCorpse ()
 
uint16 GetLootMode () const
 
bool HasLootMode (uint16 lootMode) const
 
void SetLootMode (uint16 lootMode)
 
void AddLootMode (uint16 lootMode)
 
void RemoveLootMode (uint16 lootMode)
 
void ResetLootMode ()
 
SpellInfo const * reachWithSpellAttack (Unit *victim)
 
SpellInfo const * reachWithSpellCure (Unit *victim)
 
bool CanStartAttack (Unit const *u) const
 
float GetAggroRange (Unit const *target) const
 
float GetAttackDistance (Unit const *player) const
 
float GetDetectionRange () const
 
void SendAIReaction (AiReaction reactionType)
 
UnitSelectNearestTarget (float dist=0, bool playerOnly=false) const
 
UnitSelectNearestTargetInAttackDistance (float dist) const
 
void DoFleeToGetAssistance ()
 
void CallForHelp (float fRadius, Unit *target=nullptr)
 
void CallAssistance (Unit *target=nullptr)
 
void SetNoCallAssistance (bool val)
 
void SetNoSearchAssistance (bool val)
 
bool HasSearchedAssistance ()
 
bool CanAssistTo (Unit const *u, Unit const *enemy, bool checkfaction=true) const
 
bool _IsTargetAcceptable (Unit const *target) const
 
bool CanIgnoreFeignDeath () const
 
void UpdateMoveInLineOfSightState ()
 
bool IsMoveInLineOfSightDisabled ()
 
bool IsMoveInLineOfSightStrictlyDisabled ()
 
void RemoveCorpse (bool setSpawnTime=true, bool skipVisibility=false)
 
void DespawnOrUnsummon (Milliseconds msTimeToDespawn, Seconds forcedRespawnTimer)
 
void DespawnOrUnsummon (uint32 msTimeToDespawn=0)
 
void DespawnOnEvade (Seconds respawnDelay=20s)
 
time_t const & GetRespawnTime () const
 
time_t GetRespawnTimeEx () const
 
void SetRespawnTime (uint32 respawn)
 
void Respawn (bool force=false)
 
void SaveRespawnTime () override
 
uint32 GetRespawnDelay () const
 
void SetRespawnDelay (uint32 delay)
 
uint32 GetCombatPulseDelay () const
 
void SetCombatPulseDelay (uint32 delay)
 
float GetWanderDistance () const
 
void SetWanderDistance (float dist)
 
void DoImmediateBoundaryCheck ()
 
void SendZoneUnderAttackMessage (Player *attacker)
 Send a message to LocalDefense channel for players opposition team in the zone.
 
void SetInCombatWithZone ()
 
bool hasQuest (uint32 quest_id) const override
 
bool hasInvolvedQuest (uint32 quest_id) const override
 
bool isRegeneratingHealth ()
 
void SetRegeneratingHealth (bool c)
 
void SetRegeneratingPower (bool c)
 
virtual uint8 GetPetAutoSpellSize () const
 
virtual uint32 GetPetAutoSpellOnPos (uint8 pos) const
 
void SetCannotReachTarget (ObjectGuid const &target=ObjectGuid::Empty)
 
bool CanNotReachTarget () const
 
bool IsNotReachableAndNeedRegen () const
 
void SetPosition (float x, float y, float z, float o)
 
void SetPosition (const Position &pos)
 
void SetHomePosition (float x, float y, float z, float o)
 
void SetHomePosition (const Position &pos)
 
void GetHomePosition (float &x, float &y, float &z, float &ori) const
 
Position const & GetHomePosition () const
 
void SetTransportHomePosition (float x, float y, float z, float o)
 
void SetTransportHomePosition (const Position &pos)
 
void GetTransportHomePosition (float &x, float &y, float &z, float &ori) const
 
Position const & GetTransportHomePosition () const
 
uint32 GetWaypointPath () const
 
void LoadPath (uint32 pathid)
 
uint32 GetCurrentWaypointID () const
 
void UpdateWaypointID (uint32 wpID)
 
void SearchFormation ()
 
CreatureGroup const * GetFormation () const
 
CreatureGroupGetFormation ()
 
void SetFormation (CreatureGroup *formation)
 
UnitSelectVictim ()
 
void SetDisableReputationGain (bool disable)
 
bool IsReputationGainDisabled () const
 
bool IsDamageEnoughForLootingAndReward () const
 
void LowerPlayerDamageReq (uint32 unDamage, bool damagedByPlayer=true)
 
void ResetPlayerDamageReq ()
 
uint32 GetPlayerDamageReq () const
 
uint32 GetOriginalEntry () const
 
void SetOriginalEntry (uint32 entry)
 
void SetTarget (ObjectGuid guid=ObjectGuid::Empty) override
 
void FocusTarget (Spell const *focusSpell, WorldObject const *target)
 
void ReleaseFocus (Spell const *focusSpell)
 
bool IsMovementPreventedByCasting () const override
 
time_t GetLastDamagedTime () const
 
std::shared_ptr< time_t > const & GetLastDamagedTimePtr () const
 
void SetLastDamagedTime (time_t val)
 
void SetLastDamagedTimePtr (std::shared_ptr< time_t > const &val)
 
bool IsFreeToMove ()
 
bool HasSwimmingFlagOutOfCombat () const
 
void RefreshSwimmingFlag (bool recheck=false)
 
void SetAssistanceTimer (uint32 value)
 
void ModifyThreatPercentTemp (Unit *victim, int32 percent, Milliseconds duration)
 
void ResumeChasingVictim ()
 Helper to resume chasing current victim.
 
std::string GetDebugInfo () const override
 
- Public Member Functions inherited from Unit
 ~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
 
- Public Member Functions inherited from GridObject< Creature >
bool IsInGrid () const
 
void AddToGrid (GridRefMgr< Creature > &m)
 
void RemoveFromGrid ()
 

Static Public Member Functions

static float _GetDamageMod (int32 Rank)
 
- Static Public Member Functions inherited from Unit
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

struct {
   ::Spell const *   Spell = nullptr
 
   uint32   Delay = 0
 
   ObjectGuid   Target
 
   float   Orientation = 0.0f
 
_spellFocusInfo
 
Loot loot
 
uint32 m_spells [MAX_CREATURE_SPELLS]
 
CreatureSpellCooldowns m_CreatureSpellCooldowns
 
uint32 m_ProhibitSchoolTime [7]
 
uint32 m_groupLootTimer
 
uint32 lootingGroupLowGUID
 
float m_SightDistance
 
float m_CombatDistance
 
bool m_isTempWorldObject
 
uint32 m_moveCircleMovementTime = MOVE_CIRCLE_CHECK_INTERVAL
 
uint32 m_moveBackwardsMovementTime = MOVE_BACKWARDS_CHECK_INTERVAL
 
- Public Attributes inherited from Unit
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
 

Static Public Attributes

static constexpr uint32 MOVE_CIRCLE_CHECK_INTERVAL = 3000
 
static constexpr uint32 MOVE_BACKWARDS_CHECK_INTERVAL = 2000
 

Protected Member Functions

bool CreateFromProto (ObjectGuid::LowType guidlow, uint32 Entry, uint32 vehId, const CreatureData *data=nullptr)
 
bool InitEntry (uint32 entry, const CreatureData *data=nullptr)
 
void RegenerateHealth ()
 
void Regenerate (Powers power)
 
bool IsInvisibleDueToDespawn () const override
 
bool CanAlwaysSee (WorldObject const *obj) const override
 
bool IsAlwaysDetectableFor (WorldObject const *seer) const override
 
- Protected Member Functions inherited from Unit
 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 Member Functions inherited from MovableMapObject
 MovableMapObject ()=default
 

Static Protected Member Functions

static float _GetHealthMod (int32 Rank)
 

Protected Attributes

VendorItemCounts m_vendorItemCounts
 
ObjectGuid m_lootRecipient
 
ObjectGuid::LowType m_lootRecipientGroup
 
time_t m_corpseRemoveTime
 Timers.
 
time_t m_respawnTime
 
time_t m_respawnedTime
 
uint32 m_respawnDelay
 
uint32 m_corpseDelay
 
float m_wanderDistance
 
uint32 m_boundaryCheckTime
 
uint16 m_transportCheckTimer
 
uint32 lootPickPocketRestoreTime
 
uint32 m_combatPulseTime
 
uint32 m_combatPulseDelay
 
ReactStates m_reactState
 
MovementGeneratorType m_defaultMovementType
 
ObjectGuid::LowType m_spawnId
 For new or temporary creatures is 0 for saved it is lowguid.
 
uint8 m_equipmentId
 
int8 m_originalEquipmentId
 
bool m_AlreadyCallAssistance
 
bool m_AlreadySearchedAssistance
 
bool m_regenHealth
 
bool m_regenPower
 
bool m_AI_locked
 
SpellSchoolMask m_meleeDamageSchoolMask
 
uint32 m_originalEntry
 
bool m_moveInLineOfSightDisabled
 
bool m_moveInLineOfSightStrictlyDisabled
 
Position m_homePosition
 
Position m_transportHomePosition
 
bool DisableReputationGain
 
CreatureTemplate const * m_creatureInfo
 
CreatureData const * m_creatureData
 
float m_detectionDistance
 
uint16 m_LootMode
 
- Protected Attributes inherited from Unit
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

void ForcedDespawn (uint32 timeMSToDespawn=0, Seconds forcedRespawnTimer=0s)
 
bool CanPeriodicallyCallForAssistance () const
 

Private Attributes

uint32 m_waypointID
 
uint32 m_path_id
 
CreatureGroupm_formation
 
bool TriggerJustRespawned
 
std::shared_ptr< time_t > _lastDamagedTime
 
ObjectGuid m_cannotReachTarget
 
uint32 m_cannotReachTimer
 
Spell const * _focusSpell
 
bool _isMissingSwimmingFlagOutOfCombat
 

‍Locks the target during spell cast for proper facing


 
uint32 m_assistanceTimer
 
uint32 _playerDamageReq
 
bool _damagedByPlayer
 

Additional Inherited Members

- Public Types inherited from Unit
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
 
- Protected Types inherited from Unit
typedef std::list< DynamicObject * > DynObjectList
 
typedef GuidList GameObjectList
 
typedef std::map< ObjectGuid, float > CharmThreatMap
 

Detailed Description

Constructor & Destructor Documentation

◆ Creature()

Creature::Creature ( bool  isWorldObject = false)
explicit
225{
228
229 for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
230 m_spells[i] = 0;
231
232 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
234
236 DisableReputationGain = false;
237
239 m_CombatDistance = 0.0f;
240
241 ResetLootMode(); // restore default loot mode
242 TriggerJustRespawned = false;
243 m_isTempWorldObject = false;
244 _focusSpell = nullptr;
245
246 m_respawnedTime = time_t(0);
247}
std::uint8_t uint8
Definition: Define.h:110
#define CREATURE_REGEN_INTERVAL
Definition: CreatureData.h:35
@ UNIT_END
Definition: UpdateFields.h:175
@ REACT_AGGRESSIVE
Definition: Unit.h:1025
static constexpr uint32 MAX_CREATURE_SPELLS
Definition: Unit.h:153
@ IDLE_MOTION_TYPE
Definition: MotionMaster.h:37
@ CONFIG_SIGHT_MONSTER
Definition: IWorld.h:192
@ SPELL_SCHOOL_NORMAL
Definition: SharedDefines.h:255
constexpr auto MAX_SPELL_SCHOOL
Definition: SharedDefines.h:264
@ SPELL_SCHOOL_MASK_NORMAL
Definition: SharedDefines.h:269
#define sWorld
Definition: World.h:451
bool m_regenPower
Definition: Creature.h:439
float m_wanderDistance
Definition: Creature.h:421
void ResetLootMode()
Definition: Creature.h:237
SpellSchoolMask m_meleeDamageSchoolMask
Definition: Creature.h:442
uint16 m_transportCheckTimer
Definition: Creature.h:423
bool m_AI_locked
Definition: Creature.h:440
uint32 m_assistanceTimer
Definition: Creature.h:485
int8 m_originalEquipmentId
Definition: Creature.h:434
ObjectGuid::LowType m_spawnId
For new or temporary creatures is 0 for saved it is lowguid.
Definition: Creature.h:432
Position m_transportHomePosition
Definition: Creature.h:449
ObjectGuid::LowType m_lootRecipientGroup
Definition: Creature.h:413
uint32 m_spells[MAX_CREATURE_SPELLS]
Definition: Creature.h:242
CreatureTemplate const * m_creatureInfo
Definition: Creature.h:453
bool _isMissingSwimmingFlagOutOfCombat
‍Locks the target during spell cast for proper facing
Definition: Creature.h:483
uint32 m_waypointID
Definition: Creature.h:469
MovementGeneratorType m_defaultMovementType
Definition: Creature.h:431
float m_detectionDistance
Definition: Creature.h:456
CreatureSpellCooldowns m_CreatureSpellCooldowns
Definition: Creature.h:243
float m_SightDistance
Definition: Creature.h:363
uint32 m_cannotReachTimer
Definition: Creature.h:479
uint32 m_respawnDelay
Definition: Creature.h:419
time_t m_corpseRemoveTime
Timers.
Definition: Creature.h:416
uint32 m_combatPulseDelay
Definition: Creature.h:426
time_t m_respawnTime
Definition: Creature.h:417
CreatureData const * m_creatureData
Definition: Creature.h:454
float m_CombatDistance
Definition: Creature.h:363
time_t m_respawnedTime
Definition: Creature.h:418
uint32 m_boundaryCheckTime
Definition: Creature.h:422
Position m_homePosition
Definition: Creature.h:448
bool TriggerJustRespawned
Definition: Creature.h:474
bool m_AlreadyCallAssistance
Definition: Creature.h:436
bool DisableReputationGain
Definition: Creature.h:451
CreatureGroup * m_formation
Definition: Creature.h:473
uint32 m_corpseDelay
Definition: Creature.h:420
uint8 m_equipmentId
Definition: Creature.h:433
bool m_AlreadySearchedAssistance
Definition: Creature.h:437
uint32 m_originalEntry
Definition: Creature.h:443
bool m_isTempWorldObject
Definition: Creature.h:365
ReactStates m_reactState
Definition: Creature.h:428
Spell const * _focusSpell
Definition: Creature.h:481
uint32 lootPickPocketRestoreTime
Definition: Creature.h:424
bool m_moveInLineOfSightStrictlyDisabled
Definition: Creature.h:446
uint32 lootingGroupLowGUID
Definition: Creature.h:300
bool m_regenHealth
Definition: Creature.h:438
uint32 _playerDamageReq
Definition: Creature.h:487
std::shared_ptr< time_t > _lastDamagedTime
Definition: Creature.h:476
bool _damagedByPlayer
Definition: Creature.h:488
uint32 m_path_id
Definition: Creature.h:470
bool m_moveInLineOfSightDisabled
Definition: Creature.h:445
uint32 m_groupLootTimer
Definition: Creature.h:299
uint32 m_combatPulseTime
Definition: Creature.h:425
uint32 m_ProhibitSchoolTime[7]
Definition: Creature.h:244
uint16 m_valuesCount
Definition: Object.h:242
MovableMapObject()=default
Definition: Unit.h:1290
int32 m_regenTimer
Definition: Unit.h:2528

References _focusSpell, CONFIG_SIGHT_MONSTER, CREATURE_REGEN_INTERVAL, DisableReputationGain, m_CombatDistance, m_CreatureSpellCooldowns, m_isTempWorldObject, m_ProhibitSchoolTime, Unit::m_regenTimer, m_respawnedTime, m_SightDistance, m_spells, Object::m_valuesCount, MAX_CREATURE_SPELLS, MAX_SPELL_SCHOOL, ResetLootMode(), SPELL_SCHOOL_NORMAL, sWorld, TriggerJustRespawned, and UNIT_END.

◆ ~Creature()

Creature::~Creature ( )
override
250{
251 m_vendorItemCounts.clear();
252
253 delete i_AI;
254 i_AI = nullptr;
255}
VendorItemCounts m_vendorItemCounts
Definition: Creature.h:408
UnitAI * i_AI
Definition: Unit.h:2471

References Unit::i_AI, and m_vendorItemCounts.

Member Function Documentation

◆ _AddCreatureSpellCooldown()

void Creature::_AddCreatureSpellCooldown ( uint32  spell_id,
uint16  categoryId,
uint32  end_time 
)
2757{
2758 CreatureSpellCooldown spellCooldown;
2759 spellCooldown.category = categoryId;
2760 spellCooldown.end = GameTime::GetGameTimeMS().count() + end_time;
2761 m_CreatureSpellCooldowns[spell_id] = std::move(spellCooldown);
2762}
Milliseconds GetGameTimeMS()
Definition: GameTime.cpp:43
Definition: CreatureData.h:529
uint16 category
Definition: CreatureData.h:533
uint32 end
Definition: CreatureData.h:534

References CreatureSpellCooldown::category, CreatureSpellCooldown::end, GameTime::GetGameTimeMS(), and m_CreatureSpellCooldowns.

Referenced by Pet::_LoadSpellCooldowns(), AddSpellCooldown(), TriggerBurningPitch(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), and npc_gunship_rocketeer::npc_gunship_rocketeerAI::UpdateAI().

◆ _GetDamageMod()

float Creature::_GetDamageMod ( int32  Rank)
static
1562{
1563 switch (Rank) // define rates for each elite rank
1564 {
1566 return sWorld->getRate(RATE_CREATURE_NORMAL_DAMAGE);
1574 return sWorld->getRate(RATE_CREATURE_ELITE_RARE_DAMAGE);
1575 default:
1577 }
1578}
@ RATE_CREATURE_NORMAL_DAMAGE
Definition: IWorld.h:480
@ RATE_CREATURE_ELITE_RARE_DAMAGE
Definition: IWorld.h:484
@ RATE_CREATURE_ELITE_WORLDBOSS_DAMAGE
Definition: IWorld.h:483
@ RATE_CREATURE_ELITE_RAREELITE_DAMAGE
Definition: IWorld.h:482
@ RATE_CREATURE_ELITE_ELITE_DAMAGE
Definition: IWorld.h:481
@ CREATURE_ELITE_NORMAL
Definition: SharedDefines.h:2703
@ CREATURE_ELITE_WORLDBOSS
Definition: SharedDefines.h:2706
@ CREATURE_ELITE_RARE
Definition: SharedDefines.h:2707
@ CREATURE_ELITE_RAREELITE
Definition: SharedDefines.h:2705
@ CREATURE_ELITE_ELITE
Definition: SharedDefines.h:2704

References CREATURE_ELITE_ELITE, CREATURE_ELITE_NORMAL, CREATURE_ELITE_RARE, CREATURE_ELITE_RAREELITE, CREATURE_ELITE_WORLDBOSS, RATE_CREATURE_ELITE_ELITE_DAMAGE, RATE_CREATURE_ELITE_RARE_DAMAGE, RATE_CREATURE_ELITE_RAREELITE_DAMAGE, RATE_CREATURE_ELITE_WORLDBOSS_DAMAGE, RATE_CREATURE_NORMAL_DAMAGE, and sWorld.

Referenced by ObjectMgr::CheckCreatureTemplate().

◆ _GetHealthMod()

float Creature::_GetHealthMod ( int32  Rank)
staticprotected
1543{
1544 switch (Rank) // define rates for each elite rank
1545 {
1547 return sWorld->getRate(RATE_CREATURE_NORMAL_HP);
1549 return sWorld->getRate(RATE_CREATURE_ELITE_ELITE_HP);
1555 return sWorld->getRate(RATE_CREATURE_ELITE_RARE_HP);
1556 default:
1557 return sWorld->getRate(RATE_CREATURE_ELITE_ELITE_HP);
1558 }
1559}
@ RATE_CREATURE_NORMAL_HP
Definition: IWorld.h:475
@ RATE_CREATURE_ELITE_WORLDBOSS_HP
Definition: IWorld.h:478
@ RATE_CREATURE_ELITE_ELITE_HP
Definition: IWorld.h:476
@ RATE_CREATURE_ELITE_RARE_HP
Definition: IWorld.h:479
@ RATE_CREATURE_ELITE_RAREELITE_HP
Definition: IWorld.h:477

References CREATURE_ELITE_ELITE, CREATURE_ELITE_NORMAL, CREATURE_ELITE_RARE, CREATURE_ELITE_RAREELITE, CREATURE_ELITE_WORLDBOSS, RATE_CREATURE_ELITE_ELITE_HP, RATE_CREATURE_ELITE_RARE_HP, RATE_CREATURE_ELITE_RAREELITE_HP, RATE_CREATURE_ELITE_WORLDBOSS_HP, RATE_CREATURE_NORMAL_HP, and sWorld.

Referenced by Guardian::InitStatsForLevel(), LoadCreatureFromDB(), and SelectLevel().

◆ _IsTargetAcceptable()

bool Creature::_IsTargetAcceptable ( Unit const *  target) const
2482{
2483 ASSERT(target);
2484
2485 // if the target cannot be attacked, the target is not acceptable
2486 if (IsFriendlyTo(target) || !target->isTargetableForAttack(false, this) || (m_vehicle && (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target))))
2487 return false;
2488
2489 if (target->HasUnitState(UNIT_STATE_DIED))
2490 {
2491 // some creatures can detect fake death
2492 if (CanIgnoreFeignDeath() && target->HasUnitFlag2(UNIT_FLAG2_FEIGN_DEATH))
2493 return true;
2494 else
2495 return false;
2496 }
2497
2498 Unit const* targetVictim = target->getAttackerForHelper();
2499
2500 // if I'm already fighting target, or I'm hostile towards the target, the target is acceptable
2501 if (IsEngagedBy(target) || IsHostileTo(target))
2502 return true;
2503
2504 // if the target's victim is friendly, and the target is neutral, the target is acceptable
2505 if (targetVictim && !IsNeutralToAll() && IsFriendlyTo(targetVictim))
2506 return true;
2507
2508 // if the target's victim is not friendly, or the target is friendly, the target is not acceptable
2509 return false;
2510}
#define ASSERT
Definition: Errors.h:68
@ UNIT_FLAG2_FEIGN_DEATH
Definition: Unit.h:488
@ UNIT_STATE_DIED
Definition: Unit.h:325
bool CanIgnoreFeignDeath() const
Definition: Creature.h:264
Vehicle * m_vehicle
Definition: Unit.h:2534
Unit * getAttackerForHelper() const
Definition: Unit.h:1366
bool IsNeutralToAll() const
Definition: Unit.cpp:10232
bool IsOnVehicle(Unit const *vehicle) const
Definition: Unit.h:2355
bool IsEngagedBy(Unit const *who) const
Definition: Unit.h:1686
bool IsFriendlyTo(Unit const *unit) const
Definition: Unit.cpp:10214
bool IsHostileTo(Unit const *unit) const
Definition: Unit.cpp:10209
Unit * GetBase() const
May be called from scripts.
Definition: Vehicle.h:39

References ASSERT, CanIgnoreFeignDeath(), Unit::getAttackerForHelper(), Vehicle::GetBase(), Unit::HasUnitFlag2(), Unit::HasUnitState(), Unit::IsEngagedBy(), Unit::IsFriendlyTo(), Unit::IsHostileTo(), Unit::IsNeutralToAll(), Unit::IsOnVehicle(), Unit::isTargetableForAttack(), Unit::m_vehicle, UNIT_FLAG2_FEIGN_DEATH, and UNIT_STATE_DIED.

Referenced by CanStartAttack(), and CreatureAI::TriggerAlert().

◆ AddLootMode()

◆ AddSpellCooldown()

void Creature::AddSpellCooldown ( uint32  spell_id,
uint32  ,
uint32  end_time,
bool  needSendToClient = false,
bool  forceSendToSpectator = false 
)
overridevirtual

Reimplemented from Unit.

2765{
2766 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id);
2767 if (!spellInfo)
2768 return;
2769
2770 // used in proc system, otherwise normal creature cooldown
2771 if (end_time)
2772 {
2773 _AddCreatureSpellCooldown(spellInfo->Id, 0, end_time);
2774 return;
2775 }
2776
2777 uint32 spellcooldown = spellInfo->RecoveryTime;
2778 uint32 categoryId = spellInfo->GetCategory();
2779 uint32 categorycooldown = categoryId ? spellInfo->CategoryRecoveryTime : 0;
2780 if (Player* modOwner = GetSpellModOwner())
2781 {
2782 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, spellcooldown);
2783 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, categorycooldown);
2784 }
2785
2786 SpellCategoryStore::const_iterator i_scstore = sSpellsByCategoryStore.find(categoryId);
2787 if (categorycooldown && i_scstore != sSpellsByCategoryStore.end())
2788 {
2789 for (SpellCategorySet::const_iterator i_scset = i_scstore->second.begin(); i_scset != i_scstore->second.end(); ++i_scset)
2790 {
2791 _AddCreatureSpellCooldown(i_scset->second, categoryId, categorycooldown);
2792 }
2793 }
2794 else if (spellcooldown)
2795 {
2796 _AddCreatureSpellCooldown(spellInfo->Id, 0, spellcooldown);
2797 }
2798
2799 if (sSpellMgr->HasSpellCooldownOverride(spellInfo->Id))
2800 {
2801 if (IsCharmed() && GetCharmer()->IsPlayer())
2802 {
2803 WorldPacket data;
2804 BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spellInfo->Id, spellcooldown);
2806 }
2807 }
2808}
std::uint32_t uint32
Definition: Define.h:108
SpellCategoryStore sSpellsByCategoryStore
Definition: DBCStores.cpp:150
@ SPELL_COOLDOWN_FLAG_NONE
Definition: Unit.h:1230
@ SPELLMOD_COOLDOWN
Definition: SpellDefines.h:88
#define sSpellMgr
Definition: SpellMgr.h:818
void _AddCreatureSpellCooldown(uint32 spell_id, uint16 categoryId, uint32 end_time)
Definition: Creature.cpp:2756
bool IsPlayer() const
Definition: Object.h:194
Player * ToPlayer()
Definition: Object.h:195
Definition: Player.h:1046
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:5594
bool IsCharmed() const
Definition: Unit.h:1871
Player * GetSpellModOwner() const
Definition: Unit.cpp:16751
Unit * GetCharmer() const
Definition: Unit.cpp:10568
void BuildCooldownPacket(WorldPacket &data, uint8 flags, uint32 spellId, uint32 cooldown)
Definition: Unit.cpp:21164
Definition: WorldPacket.h:27
Definition: SpellInfo.h:314
uint32 GetCategory() const
Definition: SpellInfo.cpp:864
uint32 RecoveryTime
Definition: SpellInfo.h:346
uint32 Id
Definition: SpellInfo.h:318
uint32 CategoryRecoveryTime
Definition: SpellInfo.h:347

References _AddCreatureSpellCooldown(), Unit::BuildCooldownPacket(), SpellInfo::CategoryRecoveryTime, SpellInfo::GetCategory(), Unit::GetCharmer(), Unit::GetSpellModOwner(), SpellInfo::Id, Unit::IsCharmed(), Object::IsPlayer(), SpellInfo::RecoveryTime, Player::SendDirectMessage(), SPELL_COOLDOWN_FLAG_NONE, SPELLMOD_COOLDOWN, sSpellMgr, sSpellsByCategoryStore, and Object::ToPlayer().

Referenced by Aura::_ApplyForTarget(), Aura::_UnapplyForTarget(), WorldSession::HandlePetActionHelper(), boss_faction_championsAI::IsCCed(), Pet::Update(), and PetAI::UpdateAI().

◆ AddToWorld()

void Creature::AddToWorld ( )
overridevirtual
  • Register the creature for guid lookup

Reimplemented from Object.

Reimplemented in Pet.

258{
260 if (!IsInWorld())
261 {
262 // pussywizard: motion master needs to be initialized before OnCreatureCreate, which may set death state to JUST_DIED, to prevent crash
263 // it's also initialized in AIM_Initialize(), few lines below, but it's not a problem
265
267 if (m_spawnId)
268 {
269 GetMap()->GetCreatureBySpawnIdStore().insert(std::make_pair(m_spawnId, this));
270 }
272
274
276
277 if (IsVehicle())
278 {
280 }
281
282 if (GetZoneScript())
283 {
285 }
286
288
289 sScriptMgr->OnCreatureAddWorld(this);
290 }
291}
#define sScriptMgr
Definition: ScriptMgr.h:2702
bool Insert(KEY_TYPE const &handle, SPECIFIC_TYPE *obj)
Definition: TypeContainer.h:135
Definition: Creature.h:46
Loot loot
Definition: Creature.h:218
bool AIM_Initialize(CreatureAI *ai=nullptr)
Definition: Creature.cpp:1061
void Motion_Initialize()
Definition: Creature.cpp:1086
void SearchFormation()
Definition: Creature.cpp:327
bool IsInWorld() const
Definition: Object.h:101
ObjectGuid GetGUID() const
Definition: Object.h:107
Map * GetMap() const
Definition: Object.h:517
ZoneScript * GetZoneScript() const
Definition: Object.h:523
bool IsVehicle() const
Definition: Unit.h:1416
void AddToWorld() override
Definition: Unit.cpp:15580
Vehicle * GetVehicleKit() const
Definition: Unit.h:2353
void Install()
Definition: Vehicle.cpp:70
ObjectGuid sourceWorldObjectGUID
Definition: LootMgr.h:330
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:515
CreatureBySpawnIdContainer & GetCreatureBySpawnIdStore()
Definition: Map.h:518
virtual void OnCreatureCreate(Creature *)
Definition: ZoneScript.h:35

References Unit::AddToWorld(), AIM_Initialize(), Map::GetCreatureBySpawnIdStore(), Object::GetGUID(), WorldObject::GetMap(), Map::GetObjectsStore(), Unit::GetVehicleKit(), WorldObject::GetZoneScript(), TypeUnorderedMapContainer< OBJECT_TYPES, KEY_TYPE >::Insert(), Vehicle::Install(), Object::IsInWorld(), Unit::IsVehicle(), loot, m_spawnId, Motion_Initialize(), ZoneScript::OnCreatureCreate(), SearchFormation(), Loot::sourceWorldObjectGUID, and sScriptMgr.

Referenced by AddObjectHelper().

◆ AI()

CreatureAI * Creature::AI ( ) const
inline
135{ return (CreatureAI*)i_AI; }
Definition: CreatureAI.h:70

References Unit::i_AI.

Referenced by Vehicle::AddPassenger(), Player::AddQuestAndCheckCompletion(), npc_mograine::npc_mograineAI::AshbringerEvent(), npc_anubisath_sentinel::aqsentinelAI::CallBuddiesToAttack(), boss_algalon_the_observer::boss_algalon_the_observerAI::CallConstellations(), instance_ruins_of_ahnqiraj::instance_ruins_of_ahnqiraj_InstanceMapScript::CallNextRajaxxLeader(), CanAlwaysSee(), CanCreatureAttack(), instance_obsidian_sanctum::instance_obsidian_sanctum_InstanceMapScript::CheckAchievementCriteriaMeet(), npc_still_at_it_trigger::npc_still_at_it_triggerAI::CheckAction(), spell_putricide_mutation_init::spell_putricide_mutation_init_SpellScript::CheckRequirementInternal(), spell_the_lich_king_ice_burst_target_search::spell_the_lich_king_ice_burst_target_search_SpellScript::CheckTargetCount(), npc_riggle_bassbait::npc_riggle_bassbaitAI::CheckTournamentState(), Unit::CombatStart(), CreatureUnitRelocationWorker(), Unit::DealDamage(), DespawnOnEvade(), hyjalAI::DeSpawnVeins(), SummonList::DoAction(), boss_illidari_council::boss_illidari_councilAI::DoAction(), Spell::DoAllEffectOnTarget(), HomeMovementGenerator< Creature >::DoFinalize(), hyjalAI::DoOverrun(), instance_stratholme::instance_stratholme_InstanceMapScript::DoSpawnPlaguedCritters(), SummonList::DoZoneInCombat(), Spell::EffectTaunt(), boss_zuljin::boss_zuljinAI::EnterPhase(), AssistDelayEvent::Execute(), RestoreAttack::Execute(), DelayedTalk::Execute(), UtherBatteredHiltEvent::Execute(), StartMovementEvent::Execute(), ValithriaDespawner::Execute(), CaptainSurviveTalk::Execute(), ChargeRifts::Execute(), spell_kiljaeden_sinister_reflection_clone::spell_kiljaeden_sinister_reflection_clone_SpellScript::FilterTargets(), spell_sapphiron_frost_explosion::spell_sapphiron_frost_explosion_SpellScript::FilterTargets(), RotateMovementGenerator::Finalize(), EffectMovementGenerator::Finalize(), npc_anubisath_sentinel::aqsentinelAI::GetOtherSentinels(), SmartScript::GetTargets(), go_ossirian_crystal::go_ossirian_crystalAI::GossipHello(), spell_herald_volzaj_insanity::HandleAfterCast(), spell_illidari_council_empyreal_balance::spell_illidari_council_empyreal_balance_SpellScript::HandleAfterCast(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), spell_item_lil_xt::HandleDummy(), spell_shadowblink::HandleDummy(), spell_halion_twilight_division::spell_halion_twilight_division_SpellScript::HandleDummy(), spell_q12096_q12092_dummy::spell_q12096_q12092_dummy_SpellScript::HandleDummy(), spell_q12096_q12092_bark::spell_q12096_q12092_bark_SpellScript::HandleDummy(), spell_q12589_shoot_rjr::spell_q12589_shoot_rjr_SpellScript::HandleDummy(), spell_algalon_trigger_3_adds::spell_algalon_trigger_3_adds_SpellScript::HandleDummyEffect(), spell_herald_volzaj_insanity::HandleDummyEffect(), spell_mc_play_dead::spell_mc_play_dead_AuraScript::HandleEffectRemove(), WorldSession::HandleGossipHelloOpcode(), WorldSession::HandleGossipSelectOptionOpcode(), npc_commandscript::HandleNpcSetDataCommand(), WorldSession::HandlePetActionHelper(), WorldSession::HandleQuestgiverChooseRewardOpcode(), WorldSession::HandleQuestgiverHelloOpcode(), spell_jedoga_sacrafice_beam::HandleRemoval(), spell_kiljaeden_darkness::spell_kiljaeden_darkness_AuraScript::HandleRemove(), spell_taldaram_summon_flame_ball::spell_taldaram_summon_flame_ball_SpellScript::HandleScript(), spell_putricide_unstable_experiment::spell_putricide_unstable_experiment_SpellScript::HandleScript(), spell_the_lich_king_vile_spirit_move_target_search::spell_the_lich_king_vile_spirit_move_target_search_SpellScript::HandleScript(), spell_ayamiss_swarmer_swarm::HandleScript(), spell_festergut_pungent_blight::spell_festergut_pungent_blight_SpellScript::HandleScript(), spell_rotface_large_ooze_combine::spell_rotface_large_ooze_combine_SpellScript::HandleScript(), spell_rotface_large_ooze_buff_combine::spell_rotface_large_ooze_buff_combine_SpellScript::HandleScript(), spell_q13011_bear_flank_master::HandleScript(), spell_volazj_whisper::HandleScriptEffect(), Unit::HandleSpellClick(), spell_putricide_mutated_transformation::spell_putricide_mutated_transformation_SpellScript::HandleSummon(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::InformCloud(), TempSummon::InitSummon(), IsAlwaysDetectableFor(), npc_tito::npc_titoAI::JustDied(), boss_warbringer_omrogg::boss_warbringer_omroggAI::JustDied(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::JustEngagedWith(), npc_toc_warlock::npc_toc_warlockAI::JustSummoned(), npc_toc_hunter::npc_toc_hunterAI::JustSummoned(), npc_toc_boomkin::npc_toc_boomkinAI::JustSummoned(), boss_anubrekhan::boss_anubrekhanAI::JustSummoned(), boss_maexxna::boss_maexxnaAI::JustSummoned(), npc_frosthound::npc_frosthoundAI::JustSummoned(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), npc_daphne_stilwell::npc_daphne_stilwellAI::JustSummoned(), npc_battle_at_valhalas::npc_battle_at_valhalasAI::JustSummoned(), boss_urom::boss_uromAI::JustSummoned(), npc_hor_lich_king::npc_hor_lich_kingAI::JustSummoned(), WorldBossAI::JustSummoned(), npc_grimstone::npc_grimstoneAI::JustSummoned(), boss_gyth::boss_gythAI::JustSummoned(), boss_rend_blackhand::boss_rend_blackhandAI::JustSummoned(), boss_curator::boss_curatorAI::JustSummoned(), boss_attumen::boss_attumenAI::JustSummoned(), boss_midnight::boss_midnightAI::JustSummoned(), boss_sacrolash::boss_sacrolashAI::JustSummoned(), npc_demonic_vapor_trail::npc_demonic_vapor_trailAI::JustSummoned(), boss_muru::boss_muruAI::JustSummoned(), boss_halazzi::boss_halazziAI::JustSummoned(), boss_onyxia::JustSummoned(), boss_taldaram::JustSummoned(), boss_black_knight::boss_black_knightAI::JustSummoned(), boss_devourer_of_souls::boss_devourer_of_soulsAI::JustSummoned(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustSummoned(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustSummoned(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::JustSummoned(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustSummoned(), npc_precious_icc::npc_precious_iccAI::JustSummoned(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::JustSummoned(), npc_gluttonous_abomination::npc_gluttonous_abominationAI::JustSummoned(), boss_gluth::boss_gluthAI::JustSummoned(), boss_volkhan::boss_volkhanAI::JustSummoned(), boss_nexusprince_shaffar::boss_nexusprince_shaffarAI::JustSummoned(), boss_grandmaster_vorpil::boss_grandmaster_vorpilAI::JustSummoned(), npc_akama_illidan::npc_akama_illidanAI::JustSummoned(), npc_creature_generator_akama::npc_creature_generator_akamaAI::JustSummoned(), boss_the_black_stalker::JustSummoned(), boss_warchief_kargath_bladefist::boss_warchief_kargath_bladefistAI::JustSummoned(), boss_nethermancer_sepethrea::boss_nethermancer_sepethreaAI::JustSummoned(), emerald_dragonAI::JustSummoned(), npc_nelson::npc_nelsonAI::JustSummoned(), boss_balinda::boss_balindaAI::JustSummoned(), boss_nightbane::boss_nightbaneAI::JustSummoned(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::JustSummoned(), npc_professor_phizzlethorpe::npc_professor_phizzlethorpeAI::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::JustSummoned(), boss_archimonde::boss_archimondeAI::JustSummoned(), npc_muglash::npc_muglashAI::JustSummoned(), npc_kaya_flathoof::npc_kaya_flathoofAI::JustSummoned(), npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI::JustSummoned(), npc_ame::npc_ameAI::JustSummoned(), npc_emily::npc_emilyAI::JustSummoned(), npc_deaths_door_fell_cannon_target_bunny::npc_deaths_door_fell_cannon_target_bunnyAI::JustSummoned(), npc_wounded_blood_elf::npc_wounded_blood_elfAI::JustSummoned(), npc_maghar_captive::npc_maghar_captiveAI::JustSummoned(), npc_kurenai_captive::npc_kurenai_captiveAI::JustSummoned(), npc_bessy::npc_bessyAI::JustSummoned(), npc_buru_egg::JustSummoned(), Unit::Kill(), boss_warbringer_omrogg::boss_warbringer_omroggAI::KilledUnit(), CreatureGroup::MemberEngagingTarget(), CreatureGroup::MemberEvaded(), npc_brew_bubble::MoveInLineOfSight(), npc_dkc1_gothik::npc_dkc1_gothikAI::MoveInLineOfSight(), npc_love_in_air_supply_sentry::MoveInLineOfSight(), npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight(), WaypointMovementGenerator< Creature >::MovementInform(), npc_claw_tentacle::npc_claw_tentacle(), npc_eye_tentacle::npc_eye_tentacle(), npc_giant_claw_tentacle::npc_giant_claw_tentacle(), npc_giant_eye_tentacle::npc_giant_eye_tentacle(), spell_pilgrims_bounty_serve_generic::OnAuraRemove(), achievement_flu_shot_shortage::OnCheck(), achievement_smell_saronite::OnCheck(), achievement_shadowdodger::OnCheck(), achievement_cheese_the_freeze::OnCheck(), achievement_getting_cold_in_here::OnCheck(), achievement_i_could_say_that_this_cache_was_rare::OnCheck(), achievement_i_have_the_coolest_friends::OnCheck(), achievement_ignis_shattered::OnCheck(), achievement_mimiron_firefighter::OnCheck(), achievement_mimiron_set_up_us_the_bomb_11::OnCheck(), achievement_mimiron_set_up_us_the_bomb_12::OnCheck(), achievement_mimiron_set_up_us_the_bomb_13::OnCheck(), achievement_quick_shave::OnCheck(), instance_blackrock_spire::instance_blackrock_spireMapScript::OnCreatureCreate(), go_palehoof_sphere::OnGossipHello(), npc_pet_gen_argent_pony_bridle::OnGossipHello(), npc_barnes::OnGossipHello(), npc_death_knight_initiate::OnGossipHello(), npc_highlord_darion_mograine::OnGossipHello(), npc_jaina_proudmoore::OnGossipHello(), npc_thrall::OnGossipHello(), npc_tyrande_whisperwind::OnGossipHello(), npc_finklestein::OnGossipHello(), npc_captain_saeed::OnGossipHello(), npc_salsalabim::OnGossipHello(), npc_elder_clearwater::OnGossipHello(), npc_wormhole::OnGossipHello(), go_the_pearl_of_the_depths::OnGossipHello(), go_pressure_valve::OnGossipHello(), go_brazier::OnGossipHello(), go_finklestein_cauldron::OnGossipHello(), go_prince_taldaram_sphere::OnGossipHello(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), boss_doomrel::OnGossipSelect(), boss_majordomo::OnGossipSelect(), npc_barnes::OnGossipSelect(), npc_death_knight_initiate::OnGossipSelect(), npc_highlord_darion_mograine::OnGossipSelect(), npc_varian_wrynn::OnGossipSelect(), npc_thrall_bfu::OnGossipSelect(), npc_jaina_proudmoore::OnGossipSelect(), npc_thrall::OnGossipSelect(), npc_arthas::OnGossipSelect(), npc_high_overlord_saurfang_icc::OnGossipSelect(), npc_muradin_bronzebeard_icc::OnGossipSelect(), brann_bronzebeard::OnGossipSelect(), npc_ulduar_keeper::OnGossipSelect(), npc_shandy_dalaran::OnGossipSelect(), npc_vekjik::OnGossipSelect(), npc_adventurous_dwarf::OnGossipSelect(), npc_raliq_the_drunk::OnGossipSelect(), npc_floon::OnGossipSelect(), npcs_ashyen_and_keleth::OnGossipSelect(), npc_cooshcoosh::OnGossipSelect(), npc_fos_leader::OnGossipSelect(), npc_hor_leader::OnGossipSelect(), npc_ulduar_expedition_commander::OnGossipSelect(), npc_mcmanus::OnGossipSelect(), npc_finklestein::OnGossipSelect(), npc_captain_saeed::OnGossipSelect(), boss_azuregos::OnGossipSelect(), npc_thrall_old_hillsbrad::OnGossipSelect(), npc_hor_leader_second::OnGossipSelect(), npc_tirions_gambit_tirion::OnGossipSelect(), npc_artorius::OnGossipSelect(), npc_simone::OnGossipSelect(), npc_nelson::OnGossipSelect(), npc_franklin::OnGossipSelect(), go_amberpine_outhouse::OnGossipSelect(), instance_ulduar::instance_ulduar_InstanceMapScript::OnPlayerEnter(), npc_chicken_cluck::OnQuestAccept(), npc_kernobee::OnQuestAccept(), npc_koltira_deathweaver::OnQuestAccept(), pyrewood_ambush::OnQuestAccept(), npc_daphne_stilwell::OnQuestAccept(), npc_mikhail::OnQuestAccept(), npc_kerlonian::OnQuestAccept(), npc_prospector_remtravel::OnQuestAccept(), npc_tooga::OnQuestAccept(), npc_gilthares::OnQuestAccept(), npc_lakota_windsong::OnQuestAccept(), npc_paoka_swiftmountain::OnQuestAccept(), npc_ringo::OnQuestAccept(), npc_engineer_helice::OnQuestAccept(), npc_maghar_captive::OnQuestAccept(), npc_kurenai_captive::OnQuestAccept(), npc_maxx_a_million_escort::OnQuestAccept(), npc_eris_hevenfire::OnQuestAccept(), npc_deathstalker_erland::OnQuestAccept(), npc_bartleby::OnQuestAccept(), npc_calvin_montague::OnQuestAccept(), npc_cork_gizelton::OnQuestAccept(), npc_shenthul::OnQuestAccept(), npc_kaya_flathoof::OnQuestAccept(), npc_wizzlecrank_shredder::OnQuestAccept(), npc_ame::OnQuestAccept(), npc_ranshalla::OnQuestAccept(), npc_lurgglbr::OnQuestAccept(), npc_mootoo_the_younger::OnQuestAccept(), npc_bonker_togglevolt::OnQuestAccept(), npc_emily::OnQuestAccept(), npc_apothecary_hanes::OnQuestAccept(), npc_battle_at_valhalas::OnQuestAccept(), npc_finklestein::OnQuestAccept(), npc_bessy::OnQuestAccept(), npc_isla_starmane::OnQuestAccept(), npc_kayra_longmane::OnQuestAccept(), npc_doctor::OnQuestAccept(), go_crystal_prison::OnQuestAccept(), go_crystalline_tear::OnQuestAccept(), npc_chicken_cluck::OnQuestComplete(), boss_apothecary_hummel::OnQuestReward(), npc_rocknot::OnQuestReward(), npc_thrall_warchief::OnQuestReward(), npc_lady_sylvanas_windrunner::OnQuestReward(), npc_tharnarian::OnQuestReward(), npc_elder_clearwater::OnQuestReward(), npc_riggle_bassbait::OnQuestReward(), at_blackrock_stadium::OnTrigger(), at_commander_dawnforge::OnTrigger(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnUnitDeath(), OrderWhelpTargetSelector::operator()(), FrostwingGauntletRespawner::operator()(), ValithriaDespawner::operator()(), Acore::CallOfHelpCreatureInRangeDo::operator()(), SplineHandler::operator()(), Unit::PetSpellFail(), spell_hodir_flash_freeze::spell_hodir_flash_freeze_AuraScript::PrepareAuraScript(), npc_jungle_punch_target::npc_jungle_punch_targetAI::proceedCwEvent(), SmartScript::ProcessAction(), instance_stratholme::instance_stratholme_InstanceMapScript::ProcessSlaughterEvent(), RemoveCorpse(), Vehicle::RemovePassenger(), boss_illidari_council::boss_illidari_councilAI::Reset(), Respawn(), Resurrect(), hyjalAI::Retreat(), boss_yoggsaron_lich_king::boss_yoggsaron_lich_kingAI::Say(), boss_yoggsaron_llane::boss_yoggsaron_llaneAI::Say(), boss_yoggsaron_neltharion::boss_yoggsaron_neltharionAI::Say(), spell_the_lich_king_valkyr_target_search::spell_the_lich_king_valkyr_target_search_SpellScript::SelectTarget(), SelectVictim(), instance_naxxramas::instance_naxxramas_InstanceMapScript::SetBossState(), Unit::SetCharmedBy(), instance_ahnkahet::instance_ahnkahet_InstanceScript::SetData(), SetInCombatWithZone(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::SpawnAdds(), npc_pilgrims_bounty_chair::SpellHitTarget(), npc_still_at_it_trigger::npc_still_at_it_triggerAI::Start(), spell_putricide_ooze_channel::spell_putricide_ooze_channel_SpellScript::StartAttack(), WaypointMovementGenerator< Creature >::StartMove(), hyjalAI::SummonCreature(), brann_bronzebeard::brann_bronzebeardAI::SummonCreatures(), boss_zuramat::boss_zuramatAI::SummonedCreatureDespawn(), boss_sindragosa::boss_sindragosaAI::SummonedCreatureDespawn(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::SummonedCreatureDespawn(), boss_anubrekhan::boss_anubrekhanAI::SummonedCreatureDies(), npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::SummonNextWave(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), npc_love_in_air_snivel_real::Talk(), Unit::TauntApply(), Unit::TauntFadeOut(), spell_igb_check_for_players::spell_igb_check_for_players_SpellScript::TriggerWipe(), Pet::Update(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), instance_naxxramas::instance_naxxramas_InstanceMapScript::Update(), Update(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_julianne::boss_julianneAI::UpdateAI(), boss_romulo::boss_romuloAI::UpdateAI(), pyrewood_ambush::pyrewood_ambushAI::UpdateAI(), boss_akilzon::boss_akilzonAI::UpdateAI(), npc_winterfin_playmate::UpdateAI(), npc_snowfall_glade_playmate::UpdateAI(), npc_the_biggest_tree::UpdateAI(), npc_high_oracle_soo_roo::UpdateAI(), npc_elder_kekek::UpdateAI(), npc_the_etymidian::UpdateAI(), npc_alexstraza_the_lifebinder::UpdateAI(), npc_frost_wyrm::npc_frost_wyrmAI::UpdateAI(), npc_gargoyle::npc_gargoyleAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), npc_freya_ward::npc_freya_wardAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), npc_hourglass_of_eternity::npc_hourglass_of_eternityAI::UpdateAI(), npc_still_at_it_trigger::npc_still_at_it_triggerAI::UpdateAI(), npc_commander_dawnforge::npc_commander_dawnforgeAI::UpdateAI(), npc_tooga::npc_toogaAI::UpdateFollowerAI(), npc_ringo::npc_ringoAI::UpdateFollowerAI(), InstanceScript::UpdateMinionState(), npc_ranger_lilatha::WaypointReached(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), npc_cork_gizelton::npc_cork_gizeltonAI::WaypointReached(), npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached(), and npc_bessy::npc_bessyAI::WaypointReached().

◆ AIM_Initialize()

bool Creature::AIM_Initialize ( CreatureAI ai = nullptr)
1062{
1063 // make sure nothing can change the AI during AI update
1064 if (m_AI_locked)
1065 {
1066 LOG_DEBUG("scripts.ai", "AIM_Initialize: failed to init, locked.");
1067 return false;
1068 }
1069
1070 UnitAI* oldAI = i_AI;
1071
1072 // Xinef: called in add to world
1073 //Motion_Initialize();
1074
1075 i_AI = ai ? ai : FactorySelector::SelectAI(this);
1076 delete oldAI;
1077 IsAIEnabled = true;
1078 i_AI->InitializeAI();
1079
1080 // Xinef: Initialize vehicle if it is not summoned!
1081 if (GetVehicleKit() && m_spawnId)
1082 GetVehicleKit()->Reset();
1083 return true;
1084}
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:171
CreatureAI * SelectAI(Creature *creature)
Definition: CreatureAISelector.cpp:79
Definition: UnitAI.h:182
virtual void InitializeAI()
Definition: UnitAI.h:193
bool IsAIEnabled
Definition: Unit.h:2350
void Reset(bool evading=false)
Definition: Vehicle.cpp:118

References Unit::GetVehicleKit(), Unit::i_AI, UnitAI::InitializeAI(), Unit::IsAIEnabled, LOG_DEBUG, m_AI_locked, m_spawnId, Vehicle::Reset(), and FactorySelector::SelectAI().

Referenced by AddToWorld(), Pet::AddToWorld(), Respawn(), WorldObject::SummonTrigger(), and UpdateEntry().

◆ AllLootRemovedFromCorpse()

void Creature::AllLootRemovedFromCorpse ( )
2893{
2894 if (loot.loot_type != LOOT_SKINNING && !IsPet() && GetCreatureTemplate()->SkinLootId && hasLootRecipient())
2895 {
2897 {
2899 }
2900 }
2901
2902 time_t now = GameTime::GetGameTime().count();
2903 if (m_corpseRemoveTime <= now)
2904 {
2905 return;
2906 }
2907
2908 float decayRate = sWorld->getRate(RATE_CORPSE_DECAY_LOOTED);
2909 uint32 diff = uint32((m_corpseRemoveTime - now) * decayRate);
2910
2911 m_respawnTime -= diff;
2912
2913 // corpse skinnable, but without skinning flag, and then skinned, corpse will despawn next update
2915 {
2917 }
2918 else
2919 {
2920 m_corpseRemoveTime -= diff;
2921 }
2922}
@ UNIT_FLAG_SKINNABLE
Definition: Unit.h:474
LootStore LootTemplates_Skinning("skinning_loot_template", "creature skinning id", true)
@ LOOT_SKINNING
Definition: LootMgr.h:86
@ RATE_CORPSE_DECAY_LOOTED
Definition: IWorld.h:501
Seconds GetGameTime()
Definition: GameTime.cpp:38
bool hasLootRecipient() const
Definition: Creature.h:223
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:197
bool IsPet() const
Definition: Unit.h:1413
void SetUnitFlag(UnitFlags flags)
Definition: Unit.h:1481
bool HaveLootFor(uint32 loot_id) const
Definition: LootMgr.h:224
LootType loot_type
Definition: LootMgr.h:326

References GetCreatureTemplate(), GameTime::GetGameTime(), hasLootRecipient(), LootStore::HaveLootFor(), Unit::IsPet(), loot, LOOT_SKINNING, Loot::loot_type, LootTemplates_Skinning, m_corpseRemoveTime, m_respawnTime, RATE_CORPSE_DECAY_LOOTED, Unit::SetUnitFlag(), sWorld, and UNIT_FLAG_SKINNABLE.

Referenced by WorldSession::DoLootRelease(), and Unit::Kill().

◆ CalculateMinMaxDamage()

void Creature::CalculateMinMaxDamage ( WeaponAttackType  attType,
bool  normalized,
bool  addTotalPct,
float &  minDamage,
float &  maxDamage,
uint8  damageIndex 
)
overridevirtual

Implements Unit.

1100{
1101 // creatures only have one damage
1102 if (damageIndex != 0)
1103 {
1104 minDamage = 0.f;
1105 maxDamage = 0.f;
1106 return;
1107 }
1108
1109 UnitMods unitMod;
1110 float variance = 1.0f;
1111 switch (attType)
1112 {
1113 case BASE_ATTACK:
1114 default:
1115 variance = GetCreatureTemplate()->BaseVariance;
1116 unitMod = UNIT_MOD_DAMAGE_MAINHAND;
1117 break;
1118 case OFF_ATTACK:
1119 variance = GetCreatureTemplate()->BaseVariance;
1120 unitMod = UNIT_MOD_DAMAGE_OFFHAND;
1121 break;
1122 case RANGED_ATTACK:
1123 variance = GetCreatureTemplate()->RangeVariance;
1124 unitMod = UNIT_MOD_DAMAGE_RANGED;
1125 break;
1126 }
1127
1128 if (attType == OFF_ATTACK && !haveOffhandWeapon())
1129 {
1130 minDamage = 0.0f;
1131 maxDamage = 0.0f;
1132 return;
1133 }
1134
1135 float weaponMinDamage = GetWeaponDamageRange(attType, MINDAMAGE);
1136 float weaponMaxDamage = GetWeaponDamageRange(attType, MAXDAMAGE);
1137
1138 if (!CanUseAttackType(attType)) // disarm case
1139 {
1140 weaponMinDamage = 0.0f;
1141 weaponMaxDamage = 0.0f;
1142 }
1143
1144 float attackPower = GetTotalAttackPowerValue(attType);
1145 float attackSpeedMulti = GetAPMultiplier(attType, normalized);
1146 float baseValue = GetModifierValue(unitMod, BASE_VALUE) + (attackPower / 14.0f) * variance;
1147 float basePct = GetModifierValue(unitMod, BASE_PCT) * attackSpeedMulti;
1148 float totalValue = GetModifierValue(unitMod, TOTAL_VALUE);
1149 float totalPct = addTotalPct ? GetModifierValue(unitMod, TOTAL_PCT) : 1.0f;
1150 float dmgMultiplier = GetCreatureTemplate()->DamageModifier; // = DamageModifier * _GetDamageMod(rank);
1151
1152 minDamage = ((weaponMinDamage + baseValue) * dmgMultiplier * basePct + totalValue) * totalPct;
1153 maxDamage = ((weaponMaxDamage + baseValue) * dmgMultiplier * basePct + totalValue) * totalPct;
1154
1155 // pussywizard: crashfix (casting negative to uint => min > max => assertion in urand)
1156 if (minDamage < 0.0f || minDamage > 1000000000.0f)
1157 minDamage = 0.0f;
1158 if (maxDamage < 0.0f || maxDamage > 1000000000.0f)
1159 maxDamage = 0.0f;
1160 if (minDamage > maxDamage)
1161 minDamage = maxDamage;
1162}
@ OFF_ATTACK
Definition: Unit.h:397
@ BASE_ATTACK
Definition: Unit.h:396
@ RANGED_ATTACK
Definition: Unit.h:398
@ MINDAMAGE
Definition: Unit.h:254
@ MAXDAMAGE
Definition: Unit.h:255
UnitMods
Definition: Unit.h:261
@ UNIT_MOD_DAMAGE_OFFHAND
Definition: Unit.h:285
@ UNIT_MOD_DAMAGE_RANGED
Definition: Unit.h:286
@ UNIT_MOD_DAMAGE_MAINHAND
Definition: Unit.h:284
@ BASE_VALUE
Definition: Unit.h:245
@ TOTAL_VALUE
Definition: Unit.h:247
@ TOTAL_PCT
Definition: Unit.h:248
@ BASE_PCT
Definition: Unit.h:246
float BaseVariance
Definition: CreatureData.h:204
float RangeVariance
Definition: CreatureData.h:205
float DamageModifier
Definition: CreatureData.h:201
float GetTotalAttackPowerValue(WeaponAttackType attType, Unit *pVictim=nullptr) const
Definition: Unit.cpp:15320
bool CanUseAttackType(uint8 attacktype) const
Definition: Unit.h:1607
float GetWeaponDamageRange(WeaponAttackType attType, WeaponDamageRange type, uint8 damageIndex=0) const
Definition: Unit.cpp:15344
bool haveOffhandWeapon() const
Definition: Unit.cpp:540
float GetModifierValue(UnitMods unitMod, UnitModifierType modifierType) const
Definition: Unit.cpp:15180
float GetAPMultiplier(WeaponAttackType attType, bool normalized)
Definition: Unit.cpp:17389

References BASE_ATTACK, BASE_PCT, BASE_VALUE, CreatureTemplate::BaseVariance, Unit::CanUseAttackType(), CreatureTemplate::DamageModifier, Unit::GetAPMultiplier(), GetCreatureTemplate(), Unit::GetModifierValue(), Unit::GetTotalAttackPowerValue(), Unit::GetWeaponDamageRange(), Unit::haveOffhandWeapon(), MAXDAMAGE, MINDAMAGE, OFF_ATTACK, RANGED_ATTACK, CreatureTemplate::RangeVariance, TOTAL_PCT, TOTAL_VALUE, UNIT_MOD_DAMAGE_MAINHAND, UNIT_MOD_DAMAGE_OFFHAND, and UNIT_MOD_DAMAGE_RANGED.

◆ CallAssistance()

void Creature::CallAssistance ( Unit target = nullptr)
2358{
2359 if (!target)
2360 {
2361 target = GetVictim();
2362 }
2363
2364 if (!m_AlreadyCallAssistance && target && !IsPet() && !IsCharmed())
2365 {
2366 SetNoCallAssistance(true);
2367
2368 float radius = sWorld->getFloatConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS);
2369
2370 if (radius > 0)
2371 {
2372 std::list<Creature*> assistList;
2373
2374 Acore::AnyAssistCreatureInRangeCheck u_check(this, target, radius);
2376 Cell::VisitGridObjects(this, searcher, radius);
2377
2378 if (!assistList.empty())
2379 {
2380 AssistDelayEvent* e = new AssistDelayEvent(target->GetGUID(), this);
2381 while (!assistList.empty())
2382 {
2383 // Pushing guids because in delay can happen some creature gets despawned => invalid pointer
2384 e->AddAssistant((*assistList.begin())->GetGUID());
2385 assistList.pop_front();
2386 }
2388 }
2389 }
2390 }
2391}
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY
Definition: IWorld.h:281
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS
Definition: IWorld.h:197
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
void SetNoCallAssistance(bool val)
Definition: Creature.h:259
Definition: Creature.h:492
void AddAssistant(ObjectGuid guid)
Definition: Creature.h:497
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
EventProcessor m_Events
Definition: Unit.h:2094
Unit * GetVictim() const
Definition: Unit.h:1386
static void VisitGridObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:179
Definition: GridNotifiers.h:470
Definition: GridNotifiers.h:1262

References AssistDelayEvent::AddAssistant(), EventProcessor::AddEvent(), EventProcessor::CalculateTime(), CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY, CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS, Object::GetGUID(), Unit::GetVictim(), Unit::IsCharmed(), Unit::IsPet(), m_AlreadyCallAssistance, Unit::m_Events, SetNoCallAssistance(), sWorld, and Cell::VisitGridObjects().

Referenced by Unit::Attack(), AssistanceMovementGenerator::Finalize(), and Update().

◆ CallForHelp()

void Creature::CallForHelp ( float  fRadius,
Unit target = nullptr 
)
2394{
2395 if (radius <= 0.0f || IsPet() || IsCharmed())
2396 {
2397 return;
2398 }
2399
2400 if (!target)
2401 {
2402 target = GetVictim();
2403 }
2404
2405 if (!target)
2406 {
2407 return;
2408 }
2409
2410 Acore::CallOfHelpCreatureInRangeDo u_do(this, target, radius);
2412 Cell::VisitGridObjects(this, worker, radius);
2413}
Definition: GridNotifiers.h:486
Definition: GridNotifiers.h:1143

References Unit::GetVictim(), Unit::IsCharmed(), Unit::IsPet(), and Cell::VisitGridObjects().

Referenced by npc_boss_gothik_minion::npc_boss_gothik_minionAI::DamageTaken(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::DamageTaken(), boss_emperor_dagran_thaurissan::boss_draganthaurissanAI::JustEngagedWith(), boss_grand_champion::boss_grand_championAI::JustEngagedWith(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::JustEngagedWith(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::JustEngagedWith(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::JustEngagedWith(), boss_thorim_gauntlet_npcs::boss_thorim_gauntlet_npcsAI::JustEngagedWith(), boss_xt002::boss_xt002AI::JustEngagedWith(), boss_sartharion::boss_sartharionAI::JustEngagedWith(), boss_moroes::JustEngagedWith(), npc_sindragosa_trash::npc_sindragosa_trashAI::JustEngagedWith(), boss_anubrekhan::boss_anubrekhanAI::JustEngagedWith(), boss_faerlina::boss_faerlinaAI::JustEngagedWith(), boss_fathomlord_karathress::boss_fathomlord_karathressAI::JustEngagedWith(), boss_high_astromancer_solarian::boss_high_astromancer_solarianAI::JustEngagedWith(), boss_void_reaver::boss_void_reaverAI::JustEngagedWith(), npc_sentinel_leader::UpdateAI(), and npc_cork_gizelton::npc_cork_gizeltonAI::WaypointReached().

◆ CanAlwaysSee()

bool Creature::CanAlwaysSee ( WorldObject const *  obj) const
overrideprotectedvirtual

Reimplemented from WorldObject.

1865{
1866 if (IsAIEnabled && AI()->CanSeeAlways(obj))
1867 return true;
1868
1869 return false;
1870}
CreatureAI * AI() const
Definition: Creature.h:135

References AI(), and Unit::IsAIEnabled.

◆ CanAssistTo()

bool Creature::CanAssistTo ( Unit const *  u,
Unit const *  enemy,
bool  checkfaction = true 
) const
2416{
2417 // is it true?
2419 return false;
2420
2421 // we don't need help from zombies :)
2422 if (!IsAlive())
2423 return false;
2424
2425 // Xinef: we cannot assist in evade mode
2426 if (IsInEvadeMode())
2427 return false;
2428
2429 // pussywizard: or if enemy is in evade mode
2430 if (enemy && enemy->GetTypeId() == TYPEID_UNIT && enemy->ToCreature()->IsInEvadeMode())
2431 return false;
2432
2433 // we don't need help from non-combatant ;)
2434 if (IsCivilian())
2435 return false;
2436
2438 return false;
2439
2440 // skip fighting creature
2441 if (IsEngaged())
2442 return false;
2443
2444 // only free creature
2446 return false;
2447
2448 // Check for ignore assistance extra flag
2450 {
2451 return false;
2452 }
2453
2454 // only from same creature faction
2455 if (checkfaction)
2456 {
2457 if (GetFaction() != u->GetFaction())
2458 return false;
2459 }
2460 else
2461 {
2462 if (!IsFriendlyTo(u))
2463 return false;
2464 }
2465
2466 // skip non hostile to caster enemy creatures
2467 if (!IsHostileTo(enemy))
2468 return false;
2469
2470 // Check if can see the enemy
2471 if (!CanSeeOrDetect(enemy))
2472 {
2473 return false;
2474 }
2475
2476 return true;
2477}
@ CREATURE_FLAG_EXTRA_IGNORE_ASSISTANCE_CALL
Definition: CreatureData.h:74
@ TYPEID_UNIT
Definition: ObjectGuid.h:37
@ UNIT_FLAG_NON_ATTACKABLE
Definition: Unit.h:449
@ UNIT_FLAG_NOT_SELECTABLE
Definition: Unit.h:473
bool IsCivilian() const
Definition: Creature.h:76
bool HasReactState(ReactStates state) const
Definition: Creature.h:91
bool IsInEvadeMode() const
Definition: Creature.h:129
bool HasFlagsExtra(uint32 flag) const
Definition: CreatureData.h:272
bool CanSeeOrDetect(WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
Definition: Object.cpp:1726
bool HasUnitFlag(UnitFlags flags) const
Definition: Unit.h:1480
bool IsAlive() const
Definition: Unit.h:1808
uint32 GetFaction() const
Definition: Unit.h:1495
bool IsEngaged() const
Definition: Unit.h:1685
bool IsImmuneToNPC() const
Definition: Unit.h:1683
ObjectGuid GetCharmerOrOwnerGUID() const
Definition: Unit.h:1830

References WorldObject::CanSeeOrDetect(), CREATURE_FLAG_EXTRA_IGNORE_ASSISTANCE_CALL, Unit::GetCharmerOrOwnerGUID(), Unit::GetFaction(), Object::GetTypeId(), CreatureTemplate::HasFlagsExtra(), HasReactState(), Unit::HasUnitFlag(), Unit::IsAlive(), IsCivilian(), Unit::IsEngaged(), Unit::IsFriendlyTo(), Unit::IsHostileTo(), Unit::IsImmuneToNPC(), IsInEvadeMode(), m_creatureInfo, REACT_AGGRESSIVE, Object::ToCreature(), TYPEID_UNIT, UNIT_FLAG_NON_ATTACKABLE, and UNIT_FLAG_NOT_SELECTABLE.

Referenced by AssistDelayEvent::Execute(), Acore::CallOfHelpCreatureInRangeDo::operator()(), Acore::AnyAssistCreatureInRangeCheck::operator()(), and Acore::NearestAssistCreatureInCreatureRangeCheck::operator()().

◆ CanCreatureAttack()

bool Creature::CanCreatureAttack ( Unit const *  victim,
bool  skipDistCheck = false 
) const
2550{
2551 if (!victim->IsInMap(this))
2552 return false;
2553
2554 if (!IsValidAttackTarget(victim))
2555 return false;
2556
2557 if (!victim->isInAccessiblePlaceFor(this))
2558 return false;
2559
2560 if (IsAIEnabled && !AI()->CanAIAttack(victim))
2561 return false;
2562
2563 // pussywizard: we cannot attack in evade mode
2564 if (IsInEvadeMode())
2565 return false;
2566
2567 // pussywizard: or if enemy is in evade mode
2568 if (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsInEvadeMode())
2569 return false;
2570
2571 // cannot attack if is during 5 second grace period, unless being attacked
2572 if (m_respawnedTime && (GameTime::GetGameTime().count() - m_respawnedTime) < 5 && victim->getAttackers().empty())
2573 {
2574 return false;
2575 }
2576
2577 // if victim is in FD and we can't see that
2578 if (victim->HasUnitFlag2(UNIT_FLAG2_FEIGN_DEATH) && !CanIgnoreFeignDeath())
2579 {
2580 return false;
2581 }
2582
2584 {
2585 if (GetMap()->IsDungeon())
2586 return true;
2587
2588 // pussywizard: don't check distance to home position if recently damaged (allow kiting away from spawnpoint!)
2589 // xinef: this should include taunt auras
2591 return true;
2592 }
2593
2594 if (skipDistCheck)
2595 return true;
2596
2597 // xinef: added size factor for huge npcs
2598 float dist = std::min<float>(GetMap()->GetVisibilityRange() + GetObjectSize() * 2, 150.0f);
2599
2600 if (Unit* unit = GetCharmerOrOwner())
2601 return victim->IsWithinDist(unit, dist);
2602 else
2603 {
2604 // to prevent creatures in air ignore attacks because distance is already too high...
2605 if (GetMovementTemplate().IsFlightAllowed())
2606 return victim->IsInDist2d(&m_homePosition, dist);
2607 else
2608 return victim->IsInDist(&m_homePosition, dist);
2609 }
2610}
@ SPELL_AURA_MOD_TAUNT
Definition: SpellAuraDefines.h:74
bool isWorldBoss() const
Definition: Creature.h:115
time_t GetLastDamagedTime() const
Definition: Creature.cpp:3570
CreatureMovementData const & GetMovementTemplate() const
Definition: Creature.cpp:2884
float GetVisibilityRange() const
Definition: Object.cpp:1645
float GetObjectSize() const
Definition: Object.cpp:2734
Unit * GetCharmerOrOwner() const
Definition: Unit.h:1847
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:5617
bool IsValidAttackTarget(Unit const *target, SpellInfo const *bySpell=nullptr) const
Definition: Unit.cpp:13776

References AI(), CanIgnoreFeignDeath(), Unit::getAttackers(), Unit::GetCharmerOrOwner(), Unit::GetCharmerOrOwnerGUID(), GameTime::GetGameTime(), GetLastDamagedTime(), WorldObject::GetMap(), GetMovementTemplate(), WorldObject::GetObjectSize(), Object::GetTypeId(), WorldObject::GetVisibilityRange(), Unit::HasAuraType(), Unit::HasUnitFlag2(), Unit::IsAIEnabled, Unit::isInAccessiblePlaceFor(), Position::IsInDist(), Position::IsInDist2d(), IsInEvadeMode(), WorldObject::IsInMap(), Object::IsPlayer(), Unit::IsValidAttackTarget(), WorldObject::IsWithinDist(), isWorldBoss(), m_homePosition, m_respawnedTime, SPELL_AURA_MOD_TAUNT, Object::ToCreature(), TYPEID_UNIT, and UNIT_FLAG2_FEIGN_DEATH.

Referenced by PetAI::_needToStop(), boss_hadronox::boss_hadronoxAI::AnyPlayerValid(), CanStartAttack(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustSummoned(), PetAI::SelectNextTarget(), ThreatContainer::SelectNextVictim(), SelectVictim(), npc_pet_shaman_earth_elemental::UpdateAI(), and npc_pet_shaman_fire_elemental::UpdateAI().

◆ CanEnterWater()

bool Creature::CanEnterWater ( ) const
overridevirtual

Implements Unit.

3159{
3160 if (CanSwim())
3161 return true;
3162
3164}
bool CanSwim() const override
This method check the current flag/status of a creature and its inhabit type.
Definition: Creature.cpp:3147
bool IsSwimAllowed() const
Definition: CreatureData.h:141

References CanSwim(), GetMovementTemplate(), and CreatureMovementData::IsSwimAllowed().

Referenced by ConfusedMovementGenerator< T >::_InitSpecific(), RandomMovementGenerator< T >::_setRandomLocation(), Map::CanReachPositionAndGetValidCoords(), PathGenerator::CreateFilter(), Unit::isInAccessiblePlaceFor(), and RefreshSwimmingFlag().

◆ CanFly()

bool Creature::CanFly ( ) const
inlineoverridevirtual

◆ CanGeneratePickPocketLoot()

bool Creature::CanGeneratePickPocketLoot ( ) const

◆ CanHover()

bool Creature::CanHover ( ) const
inline
84{ return GetMovementTemplate().Ground == CreatureGroundMovementType::Hover || IsHovering(); }
CreatureGroundMovementType Ground
Definition: CreatureData.h:128
bool IsHovering() const
Definition: Unit.h:2382

References GetMovementTemplate(), CreatureMovementData::Ground, and Unit::IsHovering().

Referenced by LoadCreaturesAddon(), and UpdateMovementFlags().

◆ CanIgnoreFeignDeath()

bool Creature::CanIgnoreFeignDeath ( ) const
inline
264{ return (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_IGNORE_FEIGN_DEATH) != 0; }
@ CREATURE_FLAG_EXTRA_IGNORE_FEIGN_DEATH
Definition: CreatureData.h:65

References CREATURE_FLAG_EXTRA_IGNORE_FEIGN_DEATH, and GetCreatureTemplate().

Referenced by _IsTargetAcceptable(), and CanCreatureAttack().

◆ CanNotReachTarget()

bool Creature::CanNotReachTarget ( ) const
3556{
3557 return m_cannotReachTarget;
3558}
ObjectGuid m_cannotReachTarget
Definition: Creature.h:478

References m_cannotReachTarget.

Referenced by IsEvadingAttacks(), IsNotReachableAndNeedRegen(), and Update().

◆ CanPeriodicallyCallForAssistance()

bool Creature::CanPeriodicallyCallForAssistance ( ) const
private
3602{
3603 if (!IsInCombat())
3604 return false;
3605
3607 return false;
3608
3609 if (!CanHaveThreatList())
3610 return false;
3611
3612 if (IsSummon() && GetMap()->Instanceable())
3613 return false;
3614
3615 return true;
3616}
@ UNIT_STATE_POSSESSED
Definition: Unit.h:341
bool CanHaveThreatList() const
Definition: Unit.cpp:14509
bool IsSummon() const
Definition: Unit.h:1410
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1398
bool IsInCombat() const
Definition: Unit.h:1688

References Unit::CanHaveThreatList(), WorldObject::GetMap(), Unit::HasUnitState(), Unit::IsInCombat(), Unit::IsSummon(), UNIT_STATE_DIED, and UNIT_STATE_POSSESSED.

Referenced by Update().

◆ CanStartAttack()

bool Creature::CanStartAttack ( Unit const *  u) const
1888{
1889 if (IsCivilian())
1890 return false;
1891
1892 // This set of checks is should be done only for creatures
1893 if ((IsImmuneToNPC() && who->GetTypeId() != TYPEID_PLAYER) || // flag is valid only for non player characters
1894 (IsImmuneToPC() && who->GetTypeId() == TYPEID_PLAYER)) // immune to PC and target is a player, return false
1895 {
1896 return false;
1897 }
1898
1899 if (Unit* owner = who->GetOwner())
1900 if (owner->GetTypeId() == TYPEID_PLAYER && IsImmuneToPC()) // immune to PC and target has player owner
1901 return false;
1902
1903 // Do not attack non-combat pets
1904 if (who->GetTypeId() == TYPEID_UNIT && who->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET)
1905 return false;
1906
1907 if (!CanFly() && (GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE + m_CombatDistance)) // too much Z difference, skip very costy vmap calculations here
1908 return false;
1909
1910 if (!_IsTargetAcceptable(who))
1911 return false;
1912
1913 // pussywizard: at this point we are either hostile to who or friendly to who->getAttackerForHelper()
1914 // pussywizard: if who is in combat and has an attacker, help him if the distance is right (help because who is hostile or help because attacker is friendly)
1915 bool assist = false;
1916 if (who->IsEngaged() && IsWithinDist(who, ATTACK_DISTANCE))
1917 if (Unit* victim = who->getAttackerForHelper())
1919 assist = true;
1920
1921 if (!assist)
1922 if (IsNeutralToAll() || !IsWithinDistInMap(who, GetAggroRange(who) + m_CombatDistance, true, false)) // pussywizard: +m_combatDistance for turrets and similar
1923 return false;
1924
1925 if (!CanCreatureAttack(who))
1926 return false;
1927
1929 return false;
1930
1931 return IsWithinLOSInMap(who);
1932}
#define CREATURE_Z_ATTACK_RANGE
Definition: Creature.h:41
#define ATTACK_DISTANCE
Definition: ObjectDefines.h:25
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
@ UNIT_STATE_STUNNED
Definition: Unit.h:328
@ CREATURE_TYPE_NON_COMBAT_PET
Definition: SharedDefines.h:2611
bool _IsTargetAcceptable(Unit const *target) const
Definition: Creature.cpp:2481
bool CanFly() const override
Definition: Creature.h:83
bool CanCreatureAttack(Unit const *victim, bool skipDistCheck=false) const
Definition: Creature.cpp:2549
float GetAggroRange(Unit const *target) const
Definition: Creature.cpp:3278
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition: Object.cpp:1316
bool IsWithinLOSInMap(WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
Definition: Object.cpp:1347
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition: Object.cpp:1321
float GetDistanceZ(WorldObject const *obj) const
Definition: Object.cpp:1198
Unit * GetOwner() const
Definition: Unit.cpp:10560
bool IsImmuneToPC() const
Definition: Unit.h:1681

References _IsTargetAcceptable(), ATTACK_DISTANCE, CanCreatureAttack(), CanFly(), CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS, CREATURE_TYPE_NON_COMBAT_PET, CREATURE_Z_ATTACK_RANGE, GetAggroRange(), Unit::getAttackerForHelper(), Unit::GetCreatureType(), WorldObject::GetDistanceZ(), Unit::GetOwner(), Object::GetTypeId(), Unit::HasUnitState(), IsCivilian(), Unit::IsEngaged(), Unit::IsImmuneToNPC(), Unit::IsImmuneToPC(), Unit::IsNeutralToAll(), WorldObject::IsWithinDist(), WorldObject::IsWithinDistInMap(), WorldObject::IsWithinLOSInMap(), m_CombatDistance, sWorld, TYPEID_PLAYER, TYPEID_UNIT, and UNIT_STATE_STUNNED.

Referenced by CreatureAI::MoveInLineOfSight(), FollowerAI::MoveInLineOfSight(), npc_shay_leafrunner::npc_shay_leafrunnerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), SmartAI::MoveInLineOfSight(), and Acore::NearestHostileUnitInAttackDistanceCheck::operator()().

◆ CanSwim()

bool Creature::CanSwim ( ) const
overridevirtual

This method check the current flag/status of a creature and its inhabit type.

Pets should swim by default to properly follow the player NOTE: You can set the UNIT_FLAG_CANNOT_SWIM temporary to deny a creature to swim

Reimplemented from Unit.

3148{
3149 if (Unit::CanSwim() || (!Unit::CanSwim() && !CanFly()))
3150 return true;
3151
3152 if (IsPet())
3153 return true;
3154
3155 return false;
3156}
virtual bool CanSwim() const
this method checks the current flag of a unit
Definition: Unit.cpp:20134

References CanFly(), Unit::CanSwim(), and Unit::IsPet().

Referenced by PathGenerator::BuildPolyPath(), CanEnterWater(), PathGenerator::IsSwimmableSegment(), WorldObject::UpdateAllowedPositionZ(), and UpdateMovementFlags().

◆ CanWalk()

◆ Create()

bool Creature::Create ( ObjectGuid::LowType  guidlow,
Map map,
uint32  phaseMask,
uint32  Entry,
uint32  vehId,
float  x,
float  y,
float  z,
float  ang,
const CreatureData data = nullptr 
)

Relocate before CreateFromProto, to initialize coords and allow returning correct zone id for selecting OutdoorPvP/Battlefield script

Need to be called after LoadCreaturesAddon - MOVEMENTFLAG_HOVER is set there

1102{
1103 ASSERT(map);
1104 SetMap(map);
1105 SetPhaseMask(phaseMask, false);
1106
1107 CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(Entry);
1108 if (!cinfo)
1109 {
1110 LOG_ERROR("sql.sql", "Creature::Create(): creature template (guidlow: {}, entry: {}) does not exist.", guidlow, Entry);
1111 return false;
1112 }
1113
1116 Relocate(x, y, z, ang);
1117
1118 if (!IsPositionValid())
1119 {
1120 LOG_ERROR("entities.unit", "Creature::Create(): given coordinates for creature (guidlow {}, entry {}) are not valid (X: {}, Y: {}, Z: {}, O: {})", guidlow, Entry, x, y, z, ang);
1121 return false;
1122 }
1123
1124 // area/zone id is needed immediately for ZoneScript::GetCreatureEntry hook before it is known which creature template to load (no model/scale available yet)
1125 PositionFullTerrainStatus terrainData;
1127 ProcessPositionDataChanged(terrainData);
1128
1129 //oX = x; oY = y; dX = x; dY = y; m_moveTime = 0; m_startMove = 0;
1130 if (!CreateFromProto(guidlow, Entry, vehId, data))
1131 return false;
1132
1134
1135 switch (GetCreatureTemplate()->rank)
1136 {
1139 break;
1142 break;
1145 break;
1147 // Xinef: Reduce corpse delay for bossess outside of instance
1148 if (!GetInstanceId())
1149 m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_ELITE) * 2;
1150 else
1152 break;
1153 default:
1155 break;
1156 }
1157
1158 uint32 displayID = GetNativeDisplayId();
1159 if (sObjectMgr->GetCreatureModelRandomGender(&displayID) && !IsTotem()) // Cancel load if no model defined or if totem
1160 {
1161 SetDisplayId(displayID);
1162 SetNativeDisplayId(displayID);
1163 }
1164
1166
1169
1171
1173 {
1176 }
1177 else if (cinfo->type_flags & CREATURE_TYPE_FLAG_VISIBLE_TO_GHOSTS) // Xinef: Add ghost visibility for ghost units
1179
1180 if (Entry == VISUAL_WAYPOINT)
1181 SetVisible(false);
1182
1185
1186 return true;
1187}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:159
@ CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING
Definition: CreatureData.h:78
@ CREATURE_FLAG_EXTRA_GHOST_VISIBILITY
Definition: CreatureData.h:59
#define DEFAULT_COLLISION_HEIGHT
Definition: ObjectDefines.h:50
@ UNIT_STATE_IGNORE_PATHFINDING
Definition: Unit.h:352
#define sObjectMgr
Definition: ObjectMgr.h:1640
#define VISUAL_WAYPOINT
Definition: MotionMaster.h:32
@ CONFIG_CORPSE_DECAY_ELITE
Definition: IWorld.h:300
@ CONFIG_CORPSE_DECAY_NORMAL
Definition: IWorld.h:298
@ CONFIG_CORPSE_DECAY_WORLDBOSS
Definition: IWorld.h:302
@ CONFIG_CORPSE_DECAY_RARE
Definition: IWorld.h:299
@ CONFIG_CORPSE_DECAY_RAREELITE
Definition: IWorld.h:301
uint32 const Entry[3]
Definition: instance_blackwing_lair.cpp:70
@ SERVERSIDE_VISIBILITY_GHOST
Definition: SharedDefines.h:1246
@ GHOST_VISIBILITY_ALIVE
Definition: SharedDefines.h:1253
@ GHOST_VISIBILITY_GHOST
Definition: SharedDefines.h:1254
@ CREATURE_TYPE_FLAG_VISIBLE_TO_GHOSTS
Definition: SharedDefines.h:2668
bool LoadCreaturesAddon(bool reload=false)
Definition: Creature.cpp:2625
void SetDisplayId(uint32 modelId) override
Definition: Creature.cpp:3405
bool CreateFromProto(ObjectGuid::LowType guidlow, uint32 Entry, uint32 vehId, const CreatureData *data=nullptr)
Definition: Creature.cpp:1599
uint32 GetScriptId() const
Definition: Creature.cpp:2947
void UpdateMovementFlags()
Definition: Creature.cpp:3323
Definition: CreatureData.h:176
uint32 type_flags
Definition: CreatureData.h:216
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:360
uint32 GetPhaseMask() const
Definition: Object.h:434
uint32 LastUsedScriptID
Definition: Object.h:582
uint32 GetInstanceId() const
Definition: Object.h:431
virtual void SetMap(Map *map)
Definition: Object.cpp:2071
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
Definition: Object.h:510
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition: Object.h:509
float m_positionZ
Definition: Position.h:58
float GetPositionZ() const
Definition: Position.h:119
bool IsPositionValid() const
Definition: Position.cpp:175
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118
void Relocate(float x, float y)
Definition: Position.h:73
void SetVisible(bool x)
Definition: Unit.cpp:14129
void AddUnitState(uint32 f)
Definition: Unit.h:1397
float GetHoverHeight() const
Definition: Unit.h:2387
uint32 GetNativeDisplayId() const
Definition: Unit.h:2170
void SetNativeDisplayId(uint32 modelId)
Definition: Unit.h:2172
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition: Unit.cpp:19217
void ProcessPositionDataChanged(PositionFullTerrainStatus const &data) override
Definition: Unit.cpp:4194
bool IsSpiritHealer() const
Definition: Unit.h:1660
bool IsTotem() const
Definition: Unit.h:1415
bool IsSpiritGuide() const
Definition: Unit.h:1661
Definition: Map.h:181
void GetFullTerrainStatusForPosition(uint32 phaseMask, float x, float y, float z, float collisionHeight, PositionFullTerrainStatus &data, uint8 reqLiquidType=MAP_ALL_LIQUIDS)
Definition: Map.cpp:2290

References Unit::AddUnitState(), ASSERT, CONFIG_CORPSE_DECAY_ELITE, CONFIG_CORPSE_DECAY_NORMAL, CONFIG_CORPSE_DECAY_RARE, CONFIG_CORPSE_DECAY_RAREELITE, CONFIG_CORPSE_DECAY_WORLDBOSS, CreateFromProto(), CREATURE_ELITE_ELITE, CREATURE_ELITE_RARE, CREATURE_ELITE_RAREELITE, CREATURE_ELITE_WORLDBOSS, CREATURE_FLAG_EXTRA_GHOST_VISIBILITY, CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING, CREATURE_TYPE_FLAG_VISIBLE_TO_GHOSTS, DEFAULT_COLLISION_HEIGHT, Entry, GetCreatureTemplate(), Map::GetFullTerrainStatusForPosition(), Unit::GetHoverHeight(), WorldObject::GetInstanceId(), WorldObject::GetMap(), Unit::GetNativeDisplayId(), WorldObject::GetPhaseMask(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetScriptId(), GHOST_VISIBILITY_ALIVE, GHOST_VISIBILITY_GHOST, Position::IsPositionValid(), Unit::IsSpiritGuide(), Unit::IsSpiritHealer(), Unit::IsTotem(), WorldObject::LastUsedScriptID, LoadCreaturesAddon(), LOG_ERROR, m_corpseDelay, Position::m_positionZ, WorldObject::m_serverSideVisibility, WorldObject::m_serverSideVisibilityDetect, Unit::ProcessPositionDataChanged(), Position::Relocate(), SERVERSIDE_VISIBILITY_GHOST, SetDisplayId(), WorldObject::SetMap(), Unit::SetNativeDisplayId(), Unit::SetPhaseMask(), FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue(), Unit::SetVisible(), sObjectMgr, sWorld, CreatureTemplate::type_flags, UNIT_STATE_IGNORE_PATHFINDING, UpdateMovementFlags(), and VISUAL_WAYPOINT.

Referenced by Battleground::AddCreature(), debug_commandscript::HandleDebugSpawnVehicleCommand(), npc_commandscript::HandleNpcAddCommand(), wp_commandscript::HandleWpModifyCommand(), wp_commandscript::HandleWpShowCommand(), LoadCreatureFromDB(), Battlefield::SpawnCreature(), and Map::SummonCreature().

◆ CreateFromProto()

bool Creature::CreateFromProto ( ObjectGuid::LowType  guidlow,
uint32  Entry,
uint32  vehId,
const CreatureData data = nullptr 
)
protected
1600{
1601 SetZoneScript();
1602 if (GetZoneScript() && data)
1603 {
1604 uint32 FirstEntry = GetZoneScript()->GetCreatureEntry(guidlow, data);
1605 if (!FirstEntry)
1606 return false;
1607 }
1608
1609 CreatureTemplate const* normalInfo = sObjectMgr->GetCreatureTemplate(Entry);
1610 if (!normalInfo)
1611 {
1612 LOG_ERROR("sql.sql", "Creature::CreateFromProto(): creature template (guidlow: {}, entry: {}) does not exist.", guidlow, Entry);
1613 return false;
1614 }
1615
1617
1618 Object::_Create(guidlow, Entry, (vehId || normalInfo->VehicleId) ? HighGuid::Vehicle : HighGuid::Unit);
1619
1620 // Xinef: select proper vehicle id
1621 if (!vehId)
1622 {
1623 CreatureTemplate const* cinfo = normalInfo;
1624 for (uint8 diff = uint8(GetMap()->GetSpawnMode()); diff > 0 && !IsPet();)
1625 {
1626 // we already have valid Map pointer for current creature!
1627 if (cinfo->DifficultyEntry[diff - 1])
1628 {
1629 cinfo = sObjectMgr->GetCreatureTemplate(normalInfo->DifficultyEntry[diff - 1]);
1630 if (cinfo && cinfo->VehicleId)
1631 break; // template found
1632
1633 // check and reported at startup, so just ignore (restore normalInfo)
1634 cinfo = normalInfo;
1635 }
1636
1637 // for instances heroic to normal, other cases attempt to retrieve previous difficulty
1638 if (diff >= RAID_DIFFICULTY_10MAN_HEROIC && GetMap()->IsRaid())
1639 diff -= 2; // to normal raid difficulty cases
1640 else
1641 --diff;
1642 }
1643
1644 if (cinfo->VehicleId)
1645 CreateVehicleKit(cinfo->VehicleId, (cinfo->VehicleId != normalInfo->VehicleId ? cinfo->Entry : normalInfo->Entry));
1646 }
1647 else
1648 CreateVehicleKit(vehId, Entry);
1649
1650 if (!UpdateEntry(Entry, data))
1651 return false;
1652
1653 return true;
1654}
@ RAID_DIFFICULTY_10MAN_HEROIC
Definition: DBCEnums.h:280
bool UpdateEntry(uint32 entry, const CreatureData *data=nullptr, bool changelevel=true, bool updateAI=false)
Definition: Creature.cpp:483
void SetOriginalEntry(uint32 entry)
Definition: Creature.h:359
uint32 Entry
Definition: CreatureData.h:177
uint32 VehicleId
Definition: CreatureData.h:223
uint32 DifficultyEntry[MAX_DIFFICULTY - 1]
Definition: CreatureData.h:178
void _Create(ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
Definition: Object.cpp:134
void SetZoneScript()
Definition: Object.cpp:2296
bool CreateVehicleKit(uint32 id, uint32 creatureEntry)
Definition: Unit.cpp:18883
bool IsRaid() const
Definition: Map.h:449
virtual uint32 GetCreatureEntry(ObjectGuid::LowType, CreatureData const *data)
Definition: ZoneScript.h:32

References Object::_Create(), Unit::CreateVehicleKit(), CreatureTemplate::DifficultyEntry, CreatureTemplate::Entry, Entry, ZoneScript::GetCreatureEntry(), WorldObject::GetMap(), WorldObject::GetZoneScript(), Unit::IsPet(), Map::IsRaid(), LOG_ERROR, RAID_DIFFICULTY_10MAN_HEROIC, SetOriginalEntry(), WorldObject::SetZoneScript(), sObjectMgr, UpdateEntry(), and CreatureTemplate::VehicleId.

Referenced by Create().

◆ DeleteFromDB()

void Creature::DeleteFromDB ( )
virtual

Reimplemented in Pet.

1822{
1823 if (!m_spawnId)
1824 {
1825 LOG_ERROR("entities.unit", "Trying to delete not saved creature: {}", GetGUID().ToString());
1826 return;
1827 }
1828
1830 sObjectMgr->DeleteCreatureData(m_spawnId);
1831
1832 WorldDatabaseTransaction trans = WorldDatabase.BeginTransaction();
1833
1835 stmt->SetData(0, m_spawnId);
1836 trans->Append(stmt);
1837
1838 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE_ADDON);
1839 stmt->SetData(0, m_spawnId);
1840 trans->Append(stmt);
1841
1842 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAME_EVENT_CREATURE);
1843 stmt->SetData(0, m_spawnId);
1844 trans->Append(stmt);
1845
1846 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAME_EVENT_MODEL_EQUIP);
1847 stmt->SetData(0, m_spawnId);
1848 trans->Append(stmt);
1849
1850 WorldDatabase.CommitTransaction(trans);
1851}
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
SQLTransaction< WorldDatabaseConnection > WorldDatabaseTransaction
Definition: DatabaseEnvFwd.h:72
@ WORLD_DEL_GAME_EVENT_MODEL_EQUIP
Definition: WorldDatabase.h:94
@ WORLD_DEL_CREATURE_ADDON
Definition: WorldDatabase.h:73
@ WORLD_DEL_GAME_EVENT_CREATURE
Definition: WorldDatabase.h:93
@ WORLD_DEL_CREATURE
Definition: WorldDatabase.h:83
Definition: PreparedStatement.h:158
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition: PreparedStatement.h:78
std::string ToString() const
Definition: Position.cpp:51
void RemoveCreatureRespawnTime(ObjectGuid::LowType dbGuid)
Definition: Map.cpp:3351

References Object::GetGUID(), WorldObject::GetMap(), LOG_ERROR, m_spawnId, Map::RemoveCreatureRespawnTime(), PreparedStatementBase::SetData(), sObjectMgr, Position::ToString(), WORLD_DEL_CREATURE, WORLD_DEL_CREATURE_ADDON, WORLD_DEL_GAME_EVENT_CREATURE, WORLD_DEL_GAME_EVENT_MODEL_EQUIP, and WorldDatabase.

Referenced by npc_commandscript::HandleNpcDeleteCommand().

◆ DespawnOnEvade()

void Creature::DespawnOnEvade ( Seconds  respawnDelay = 20s)
2117{
2119
2120 if (respawnDelay < 2s)
2121 {
2122 LOG_WARN("entities.unit", "DespawnOnEvade called with delay of {} seconds, defaulting to 2.", respawnDelay.count());
2123 respawnDelay = 2s;
2124 }
2125
2126 if (TempSummon* whoSummon = ToTempSummon())
2127 {
2128 LOG_WARN("entities.unit", "DespawnOnEvade called on a temporary summon.");
2129 whoSummon->UnSummon();
2130 return;
2131 }
2132
2133 DespawnOrUnsummon(Milliseconds(0), respawnDelay);
2134}
#define LOG_WARN(filterType__,...)
Definition: Log.h:163
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition: Duration.h:27
virtual void SummonedCreatureDespawnAll()
Definition: CreatureAI.h:136
void DespawnOrUnsummon(Milliseconds msTimeToDespawn, Seconds forcedRespawnTimer)
Definition: Creature.cpp:2108
Definition: TemporarySummon.h:40
TempSummon * ToTempSummon()
Definition: Unit.h:2400

References AI(), DespawnOrUnsummon(), LOG_WARN, CreatureAI::SummonedCreatureDespawnAll(), and Unit::ToTempSummon().

Referenced by CreatureAI::EnterEvadeMode(), and boss_midnight::boss_midnightAI::EnterEvadeMode().

◆ DespawnOrUnsummon() [1/2]

void Creature::DespawnOrUnsummon ( Milliseconds  msTimeToDespawn,
Seconds  forcedRespawnTimer 
)
2109{
2110 if (TempSummon* summon = this->ToTempSummon())
2111 summon->UnSummon(msTimeToDespawn.count());
2112 else
2113 ForcedDespawn(msTimeToDespawn.count(), forcedRespawnTimer);
2114}
void ForcedDespawn(uint32 timeMSToDespawn=0, Seconds forcedRespawnTimer=0s)
Definition: Creature.cpp:2086

References ForcedDespawn(), and Unit::ToTempSummon().

Referenced by npc_mograine::npc_mograineAI::AshbringerEvent(), spell_the_lich_king_shadow_trap_periodic::spell_the_lich_king_shadow_trap_periodic_SpellScript::CheckTargetCount(), npc_simone::npc_simoneAI::CorpseRemoved(), Player::CreatePet(), boss_headless_horseman_head::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), npc_power_spark::npc_power_sparkAI::DamageTaken(), boss_freya::boss_freyaAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_tiger_matriarch::npc_tiger_matriarchAI::DamageTaken(), MotionTransport::DelayedTeleportTransport(), SummonList::DespawnAll(), SummonList::DespawnEntry(), brann_bronzebeard::brann_bronzebeardAI::DespawnHeads(), DespawnOnEvade(), spell_rotface_unstable_ooze_explosion_suicide::spell_rotface_unstable_ooze_explosion_suicide_AuraScript::DespawnSelf(), Vehicle::Dismiss(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), npc_ulduar_toasty_fire::npc_ulduar_toasty_fireAI::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), npc_saurfang_event::npc_saurfang_eventAI::DoAction(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::DoAction(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::DoAction(), npc_bone_spike::npc_bone_spikeAI::DoAction(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::DoAction(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), boss_infinite_corruptor::boss_infinite_corruptorAI::DoAction(), npc_twilight_summon::npc_twilight_summonAI::DoAction(), npc_snobold_vassal::npc_snobold_vassalAI::DoAction(), npc_living_mojo::npc_living_mojoAI::DoAction(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::DoAction(), npc_spark_of_ionar::npc_spark_of_ionarAI::DoAction(), npc_molten_golem::npc_molten_golemAI::DoAction(), npc_auriaya_feral_defender::npc_auriaya_feral_defenderAI::DoAction(), boss_thorim_sif::boss_thorim_sifAI::DoAction(), Spell::EffectScriptEffect(), Spell::EffectTameCreature(), boss_rend_blackhand::boss_rend_blackhandAI::EnterEvadeMode(), boss_attumen::boss_attumenAI::EnterEvadeMode(), boss_entropius::boss_entropiusAI::EnterEvadeMode(), boss_black_knight::boss_black_knightAI::EnterEvadeMode(), npc_phantom_hallucination::npc_phantom_hallucinationAI::EnterEvadeMode(), boss_ahune::boss_ahuneAI::EnterEvadeMode(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::EnterEvadeMode(), npc_hallows_end_soh::EnterEvadeMode(), boss_ouro::EnterEvadeMode(), npc_dirt_mound::EnterEvadeMode(), npc_toc_pet_warlock::npc_toc_pet_warlockAI::EnterEvadeMode(), npc_toc_pet_hunter::npc_toc_pet_hunterAI::EnterEvadeMode(), npc_fel_infernal::npc_fel_infernalAI::EnterEvadeMode(), npc_mistress_of_pain::npc_mistress_of_painAI::EnterEvadeMode(), npc_inner_demon::npc_inner_demonAI::EnterEvadeMode(), boss_nazan::boss_nazanAI::EnterEvadeMode(), boss_vazruden::boss_vazrudenAI::EnterEvadeMode(), ForcedDespawnDelayEvent::Execute(), VehicleDespawnEvent::Execute(), DelayedCastEvent::Execute(), EoEDrakeEnterVehicleEvent::Execute(), SuckBackEvent::Execute(), npc_shay_leafrunner::npc_shay_leafrunnerAI::FailQuest(), npc_hallows_end_soh::FinishEvent(), spell_gen_despawn_self::HandleDummy(), spell_item_lil_xt::HandleDummy(), spell_q12096_q12092_dummy::spell_q12096_q12092_dummy_SpellScript::HandleDummy(), spell_q12096_q12092_bark::spell_q12096_q12092_bark_SpellScript::HandleDummy(), spell_item_complete_raptor_capture::HandleDummy(), spell_item_rocket_chicken::HandleDummyTick(), spell_mc_play_dead::spell_mc_play_dead_AuraScript::HandleEffectRemove(), spell_dtk_raise_dead::spell_dtk_raise_dead_AuraScript::HandleEffectRemove(), spell_q11919_q11940_drake_hunt::spell_q11919_q11940_drake_hunt_AuraScript::HandleEffectRemove(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_putricide_eat_ooze::spell_putricide_eat_ooze_SpellScript::HandleScript(), spell_rotface_little_ooze_combine::spell_rotface_little_ooze_combine_SpellScript::HandleScript(), spell_rotface_large_ooze_combine::spell_rotface_large_ooze_combine_SpellScript::HandleScript(), spell_rotface_large_ooze_buff_combine::spell_rotface_large_ooze_buff_combine_SpellScript::HandleScript(), spell_shredder_delivery::spell_shredder_delivery_SpellScript::HandleScript(), spell_q12690_burst_at_the_seams::HandleScript(), spell_illidan_cage_trap::spell_illidan_cage_trap_SpellScript::HandleScriptEffect(), spell_winter_veil_racer_slam_hit::HandleScriptEffect(), spell_q11065_wrangle_some_aether_rays_aura::if(), boss_twilight_corrupter::InitializeAI(), npc_preparations_for_war_vehicle::InitializeAI(), npc_underbog_mushroom::InitializeAI(), Guardian::InitStatsForLevel(), npc_taldaram_flamesphere::IsSummonedBy(), npc_putricide_oozeAI::IsSummonedBy(), npc_ranshalla::npc_ranshallaAI::JustDidDialogueStep(), npc_blackhand_incarcerator::npc_blackhand_incarceratorAI::JustDied(), boss_majordomo::boss_majordomoAI::JustDied(), npc_zulian_prowler::npc_zulian_prowlerAI::JustDied(), npc_chained_spirit::JustDied(), npc_belnistrasz::npc_belnistraszAI::JustDied(), npc_living_inferno::npc_living_infernoAI::JustDied(), npc_memory::npc_memoryAI::JustDied(), npc_argent_soldier::npc_argent_soldierAI::JustDied(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::JustDied(), npc_fel_infernal::npc_fel_infernalAI::JustDied(), npc_mistress_of_pain::npc_mistress_of_painAI::JustDied(), npc_dark_nucleus::npc_dark_nucleusAI::JustDied(), npc_gunship::npc_gunshipAI::JustDied(), npc_little_ooze::npc_little_oozeAI::JustDied(), npc_big_ooze::npc_big_oozeAI::JustDied(), npc_ice_tomb::npc_ice_tombAI::JustDied(), npc_eoe_wyrmrest_skytalon::npc_eoe_wyrmrest_skytalonAI::JustDied(), npc_ulduar_saronite_animus::npc_ulduar_saronite_animusAI::JustDied(), npc_ichor_globule::npc_ichor_globuleAI::JustDied(), npc_vh_void_sentry::npc_vh_void_sentryAI::JustDied(), npc_thassarian2::npc_thassarian2AI::JustDied(), npc_wintergarde_gryphon::JustDied(), npc_q24545_vegard::npc_q24545_vegardAI::JustDied(), npc_blessed_banner::npc_blessed_bannerAI::JustDied(), boss_ahune::boss_ahuneAI::JustDied(), npc_ahune_frozen_core::npc_ahune_frozen_coreAI::JustDied(), boss_warbringer_omrogg::boss_warbringer_omroggAI::JustDied(), npc_buru_egg::JustDied(), boss_bug_trio::JustDied(), npc_frost_tomb::npc_frost_tombAI::JustDied(), npc_dirt_mound::JustEngagedWith(), boss_dorothee::boss_dorotheeAI::JustReachedHome(), boss_arlokk::boss_arlokkAI::JustReachedHome(), boss_headless_horseman::JustReachedHome(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::JustReachedHome(), npc_precious::npc_preciousAI::JustReachedHome(), npc_ouro_spawner::JustSummoned(), boss_rend_blackhand::boss_rend_blackhandAI::JustSummoned(), boss_kiljaeden::boss_kiljaedenAI::JustSummoned(), npc_medivh_bm::JustSummoned(), boss_gal_darah::boss_gal_darahAI::JustSummoned(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustSummoned(), boss_professor_putricide::boss_professor_putricideAI::JustSummoned(), boss_rotface::boss_rotfaceAI::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), npc_risen_archmage::npc_risen_archmageAI::JustSummoned(), npc_gluttonous_abomination::npc_gluttonous_abominationAI::JustSummoned(), boss_malygos::boss_malygosAI::JustSummoned(), npc_tiger_matriarch::npc_tiger_matriarchAI::KilledUnit(), npc_brew_bubble::MoveInLineOfSight(), npc_khunok_the_behemoth::npc_khunok_the_behemothAI::MoveInLineOfSight(), npc_captured_beryl_sorcerer::npc_captured_beryl_sorcererAI::MoveInLineOfSight(), FollowerAI::MovementInform(), npc_brann_bronzebeard_algalon::npc_brann_bronzebeard_algalonAI::MovementInform(), npc_spirit_shade::npc_spirit_shadeAI::MovementInform(), npc_forest_frog::npc_forest_frogAI::MovementInform(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::MovementInform(), npc_troll_volunteer::npc_troll_volunteerAI::MovementInform(), boss_grand_champion::boss_grand_championAI::MovementInform(), npc_concentrated_ball::npc_concentrated_ballAI::MovementInform(), npc_darnavan::npc_darnavanAI::MovementInform(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::MovementInform(), npc_enslaved_netherwing_drake::npc_enslaved_netherwing_drakeAI::MovementInform(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::MovementInform(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::MovementInform(), npc_chained_spirit::MovementInform(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), npc_assembly_lightning::npc_assembly_lightningAI::MovementInform(), npc_xt002_scrapbot::npc_xt002_scrapbotAI::MovementInform(), npc_released_offspring_harkoa::npc_released_offspring_harkoaAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::MovementInform(), npc_image_of_medivh::npc_image_of_medivhAI::NextStep(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::npc_lk_spirit_bombAI(), BattlefieldWG::OnCreatureCreate(), instance_gnomeregan::instance_gnomeregan_InstanceMapScript::OnCreatureCreate(), instance_dire_maul::instance_dire_maul_InstanceMapScript::OnCreatureCreate(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), instance_sethekk_halls::instance_sethekk_halls_InstanceMapScript::OnCreatureCreate(), go_scourge_enclosure::OnGossipHello(), go_jotunheim_cage::OnGossipHello(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), npc_grandmother::OnGossipSelect(), npc_ulduar_keeper::OnGossipSelect(), npc_adventurous_dwarf::OnGossipSelect(), spell_kaelthas_flame_strike::spell_kaelthas_flame_strike_AuraScript::OnRemove(), npc_valithria_portal::npc_valithria_portalAI::OnSpellClick(), boss_yoggsaron_descend_portal::boss_yoggsaron_descend_portalAI::OnSpellClick(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnUnitDeath(), FrostwingGauntletRespawner::operator()(), ValithriaDespawner::operator()(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::PassengerBoarded(), npc_ulduar_vx001::npc_ulduar_vx001AI::PassengerBoarded(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::PassengerBoarded(), npc_eoe_wyrmrest_skytalon::npc_eoe_wyrmrest_skytalonAI::PassengerBoarded(), npc_oculus_drake::npc_oculus_drakeAI::PassengerBoarded(), npc_ulduar_flames_initial::npc_ulduar_flames_initialAI::RemoveAll(), boss_gyth::boss_gythAI::Reset(), boss_nefarian::Reset(), boss_servant_quarters::Reset(), npc_image_of_medivh::npc_image_of_medivhAI::Reset(), npc_singularity::npc_singularityAI::Reset(), boss_infinite_corruptor::boss_infinite_corruptorAI::Reset(), boss_mal_ganis::boss_mal_ganisAI::Reset(), npc_eye_tentacle::Reset(), npc_claw_tentacle::Reset(), npc_xerestrasza::npc_xerestraszaAI::Reset(), npc_raging_spirit::npc_raging_spiritAI::Reset(), npc_assembly_lightning::npc_assembly_lightningAI::Reset(), npc_xt002_pummeller::npc_xt002_pummellerAI::Reset(), npc_xt002_life_spark::npc_xt002_life_sparkAI::Reset(), npc_oscillating_frequency_scanner_master_bunny::npc_oscillating_frequency_scanner_master_bunnyAI::Reset(), npc_simon_bunny::npc_simon_bunnyAI::ResetNode(), NPCStaveQuestAI::RevealForm(), spell_putricide_ooze_channel::spell_putricide_ooze_channel_SpellScript::SelectTarget(), npc_frost_sphere::npc_frost_sphereAI::SpellHit(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::SpellHit(), npc_ulduar_flames_spread::npc_ulduar_flames_spreadAI::SpellHit(), npc_vics_flying_machine::npc_vics_flying_machineAI::SpellHit(), npc_captured_rageclaw::npc_captured_rageclawAI::SpellHit(), boss_headless_horseman_pumpkin::SpellHit(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::SpellHit(), npc_living_constellation::npc_living_constellationAI::SpellHit(), npc_drakuru_shackles::npc_drakuru_shacklesAI::SpellHit(), npc_midsummer_torch_target::SpellHit(), boss_magus_telestra::boss_magus_telestraAI::SpellHit(), npc_iron_watcher::npc_iron_watcherAI::SpellHit(), npc_vengeful_shade::npc_vengeful_shadeAI::SpellHitTarget(), boss_headless_horseman_head::SpellHitTarget(), npc_q24545_lich_king::npc_q24545_lich_kingAI::SpellHitTarget(), boss_ouro::Submerge(), boss_kelidan_the_breaker::boss_kelidan_the_breakerAI::SummonChannelers(), npc_time_rift::SummonedCreatureDies(), boss_hazzarah::SummonedCreatureDies(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonedCreatureDies(), npc_creature_generator_akama::npc_creature_generator_akamaAI::SummonedCreatureDies(), boss_vexallus::boss_vexallusAI::SummonedCreatureDies(), boss_razorgore::boss_razorgoreAI::SummonMovementInform(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), npc_drakuru_shackles::npc_drakuru_shacklesAI::UnlockRageclaw(), VehicleAI::UpdateAI(), npc_escortAI::UpdateAI(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_victor_nefarius::boss_victor_nefariusAI::UpdateAI(), npc_kernobee::npc_kernobeeAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), boss_kalec::boss_kalecAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_dark_iron_attack_mole_machine::UpdateAI(), npc_brew_bubble::UpdateAI(), npc_love_in_air_snivel_real::UpdateAI(), npc_belnistrasz::npc_belnistraszAI::UpdateAI(), npc_spitelashes::npc_spitelashesAI::UpdateAI(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), npc_depth_charge::npc_depth_chargeAI::UpdateAI(), npc_draenei_survivor::npc_draenei_survivorAI::UpdateAI(), npc_stillpine_capitive::npc_stillpine_capitiveAI::UpdateAI(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::UpdateAI(), npc_shay_leafrunner::npc_shay_leafrunnerAI::UpdateAI(), npc_giant_spotlight::npc_giant_spotlightAI::UpdateAI(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::UpdateAI(), npc_fos_corrupted_soul_fragment::npc_fos_corrupted_soul_fragmentAI::UpdateAI(), boss_drakkari_elemental::boss_drakkari_elementalAI::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), npc_vengeful_shade::npc_vengeful_shadeAI::UpdateAI(), npc_bone_spike::npc_bone_spikeAI::UpdateAI(), npc_ice_tomb::npc_ice_tombAI::UpdateAI(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::UpdateAI(), npc_valithria_cloud::npc_valithria_cloudAI::UpdateAI(), npc_blistering_zombie::npc_blistering_zombieAI::UpdateAI(), npc_impaling_spear::npc_impaling_spearAI::UpdateAI(), npc_vortex_ride::npc_vortex_rideAI::UpdateAI(), npc_power_spark::npc_power_sparkAI::UpdateAI(), npc_oculus_drake::npc_oculus_drakeAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_freya_lifebinder::boss_freya_lifebinderAI::UpdateAI(), boss_freya_healthy_spore::boss_freya_healthy_sporeAI::UpdateAI(), boss_freya_summons::boss_freya_summonsAI::UpdateAI(), boss_freya_nature_bomb::boss_freya_nature_bombAI::UpdateAI(), npc_ulduar_flash_freeze::npc_ulduar_flash_freezeAI::UpdateAI(), boss_kologarn_eyebeam::boss_kologarn_eyebeamAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_ulduar_magnetic_core::npc_ulduar_magnetic_coreAI::UpdateAI(), npc_ulduar_bot_summon_trigger::npc_ulduar_bot_summon_triggerAI::UpdateAI(), npc_ulduar_flames_initial::npc_ulduar_flames_initialAI::UpdateAI(), boss_thorim::boss_thorimAI::UpdateAI(), boss_thorim_sif::boss_thorim_sifAI::UpdateAI(), boss_skadi_grauf::boss_skadi_graufAI::UpdateAI(), npc_vh_teleportation_portal::npc_vh_teleportation_portalAI::UpdateAI(), npc_azure_saboteur::npc_azure_saboteurAI::UpdateAI(), npc_lurgglbr::npc_lurgglbrAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_preparations_for_war_vehicle::UpdateAI(), npc_minigob_manabonk::npc_minigob_manabonkAI::UpdateAI(), npc_hourglass_of_eternity::npc_hourglass_of_eternityAI::UpdateAI(), npc_wintergarde_gryphon::UpdateAI(), npc_wounded_skirmisher::UpdateAI(), npc_lake_frog::npc_lake_frogAI::UpdateAI(), npc_lord_arete::npc_lord_areteAI::UpdateAI(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), npc_blessed_banner::npc_blessed_bannerAI::UpdateAI(), npc_feedin_da_goolz::npc_feedin_da_goolzAI::UpdateAI(), npc_crusade_recruit::npc_crusade_recruitAI::UpdateAI(), npc_voidtraveler::npc_voidtravelerAI::UpdateAI(), npc_fel_guard_hound::npc_fel_guard_houndAI::UpdateAI(), npc_corki::npc_corkiAI::UpdateAI(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::UpdateAI(), npc_pet_gen_target_following_bomb::UpdateAI(), npc_pet_gen_imp_in_a_bottle::UpdateAI(), npc_pet_gen_fetch_ball::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), npc_elder_clearwater::npc_elder_clearwaterAI::UpdateAI(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::UpdateAI(), npc_ichor_globule::npc_ichor_globuleAI::UpdateAI(), FollowerAI::UpdateAI(), npc_brunnhildar_prisoner::npc_brunnhildar_prisonerAI::UpdateAI(), SmartAI::UpdateDespawn(), npc_rinji::npc_rinjiAI::UpdateEscortAI(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI(), SmartAI::UpdatePath(), npc_daphne_stilwell::npc_daphne_stilwellAI::WaypointReached(), npc_apothecary_hanes::npc_Apothecary_HanesAI::WaypointReached(), and npc_plaguehound_tracker::npc_plaguehound_trackerAI::WaypointReached().

◆ DespawnOrUnsummon() [2/2]

void Creature::DespawnOrUnsummon ( uint32  msTimeToDespawn = 0)
inline
274{ DespawnOrUnsummon(Milliseconds(msTimeToDespawn), 0s); };

References DespawnOrUnsummon().

Referenced by DespawnOrUnsummon().

◆ DisappearAndDie()

void Creature::DisappearAndDie ( )
318{
320 //SetVisibility(VISIBILITY_OFF);
321 //ObjectAccessor::UpdateObjectVisibility(this);
322 if (IsAlive())
324 RemoveCorpse(false, true);
325}
@ JUST_DIED
Definition: Unit.h:317
void setDeathState(DeathState s, bool despawn=false) override
Definition: Creature.cpp:1934
void RemoveCorpse(bool setSpawnTime=true, bool skipVisibility=false)
Definition: Creature.cpp:347
void DestroyForNearbyPlayers()
Definition: Object.cpp:2873

References WorldObject::DestroyForNearbyPlayers(), Unit::IsAlive(), JUST_DIED, RemoveCorpse(), and setDeathState().

Referenced by npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI::EnterEvadeMode(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::EnterEvadeMode(), npc_dark_iron_guzzler::FindNextKeg(), Battlefield::HideNpc(), npc_taldaram_flamesphere::MovementInform(), instance_blackrock_spire::instance_blackrock_spireMapScript::OnCreatureCreate(), go_ulduar_tower::OnDestroyed(), go_dragonflayer_cage::OnGossipHello(), boss_nightbane::boss_nightbaneAI::Reset(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), npc_janalai_hatcher::npc_janalai_hatcherAI::UpdateAI(), npc_janalai_hatchling::npc_janalai_hatchlingAI::UpdateAI(), npc_amanitar_mushrooms::UpdateAI(), npc_taldaram_flamesphere::UpdateAI(), npc_swarm_scarab::npc_swarm_scarabAI::UpdateAI(), npc_beryl_sorcerer::npc_beryl_sorcererAI::UpdateAI(), npc_venture_co_straggler::npc_venture_co_stragglerAI::UpdateAI(), npc_tyrion_spybot::npc_tyrion_spybotAI::UpdateAI(), and npc_emily::npc_emilyAI::WaypointReached().

◆ DoFleeToGetAssistance()

void Creature::DoFleeToGetAssistance ( )
1032{
1033 if (!GetVictim())
1034 return;
1035
1037 return;
1038
1039 float radius = sWorld->getFloatConfig(CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS);
1040 if (radius > 0)
1041 {
1042 Creature* creature = nullptr;
1043
1046
1047 Cell::VisitGridObjects(this, searcher, radius);
1048
1050 UpdateSpeed(MOVE_RUN, false);
1051
1052 if (!creature)
1053 //SetFeared(true, GetVictim()->GetGUID(), 0, sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY));
1054 //TODO: use 31365
1056 else
1057 GetMotionMaster()->MoveSeekAssistance(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ());
1058 }
1059}
@ UNIT_STATE_FLEEING
Definition: Unit.h:332
@ MOVE_RUN
Definition: Unit.h:379
@ SPELL_AURA_PREVENTS_FLEEING
Definition: SpellAuraDefines.h:155
@ CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS
Definition: IWorld.h:196
void SetNoSearchAssistance(bool val)
Definition: Creature.h:260
MotionMaster * GetMotionMaster()
Definition: Unit.h:2262
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition: Unit.cpp:18192
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition: Unit.cpp:14147
Definition: GridNotifiers.h:455
Definition: GridNotifiers.h:1293
void MoveSeekAssistance(float x, float y, float z)
Definition: MotionMaster.cpp:620

References CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS, Unit::GetMotionMaster(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Unit::GetVictim(), Unit::HasAuraType(), MOVE_RUN, MotionMaster::MoveSeekAssistance(), Unit::SetControlled(), SetNoSearchAssistance(), SPELL_AURA_PREVENTS_FLEEING, sWorld, UNIT_STATE_FLEEING, Unit::UpdateSpeed(), and Cell::VisitGridObjects().

Referenced by npc_blackhand_incarcerator::npc_blackhand_incarceratorAI::DamageTaken(), SmartScript::ProcessAction(), and npc_sentinel_infiltrator::UpdateAI().

◆ DoImmediateBoundaryCheck()

void Creature::DoImmediateBoundaryCheck ( )
inline
297{ m_boundaryCheckTime = 0; }

References m_boundaryCheckTime.

Referenced by CreatureAI::SetBoundary().

◆ FocusTarget()

void Creature::FocusTarget ( Spell const *  focusSpell,
WorldObject const *  target 
)
3431{
3432 // already focused
3433 if (_focusSpell)
3434 return;
3435
3436 _focusSpell = focusSpell;
3437
3438 SetGuidValue(UNIT_FIELD_TARGET, this == target ? ObjectGuid::Empty : target->GetGUID());
3439 if (focusSpell->GetSpellInfo()->HasAttribute(SPELL_ATTR5_AI_DOESNT_FACE_TARGET))
3441
3442 // Set serverside orientation if needed (needs to be after attribute check)
3443 if (this == target && (movespline->Finalized() || GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE))
3445 else
3446 SetInFront(target);
3447}
@ UNIT_FIELD_TARGET
Definition: UpdateFields.h:92
@ UNIT_STATE_ROTATING
Definition: Unit.h:345
@ CHASE_MOTION_TYPE
Definition: MotionMaster.h:43
@ SPELL_ATTR5_AI_DOESNT_FACE_TARGET
Definition: SharedDefines.h:558
void SetGuidValue(uint16 index, ObjectGuid value)
Definition: Object.cpp:723
static ObjectGuid const Empty
Definition: ObjectGuid.h:122
float GetOrientation() const
Definition: Position.h:120
void SetFacingTo(float ori)
Definition: Unit.cpp:20782
Movement::MoveSpline * movespline
Definition: Unit.h:2440
void SetInFront(WorldObject const *target)
Definition: Unit.cpp:20776
bool Finalized() const
Definition: MoveSpline.h:116

References _focusSpell, Unit::AddUnitState(), CHASE_MOTION_TYPE, ObjectGuid::Empty, Movement::MoveSpline::Finalized(), Object::GetGUID(), Unit::GetMotionMaster(), Position::GetOrientation(), Spell::GetSpellInfo(), SpellInfo::HasAttribute(), Unit::movespline, Unit::SetFacingTo(), Object::SetGuidValue(), Unit::SetInFront(), SPELL_ATTR5_AI_DOESNT_FACE_TARGET, UNIT_FIELD_TARGET, and UNIT_STATE_ROTATING.

Referenced by Spell::prepare().

◆ ForcedDespawn()

void Creature::ForcedDespawn ( uint32  timeMSToDespawn = 0,
Seconds  forcedRespawnTimer = 0s 
)
private
2087{
2088 if (timeMSToDespawn)
2089 {
2090 ForcedDespawnDelayEvent* pEvent = new ForcedDespawnDelayEvent(*this, forceRespawnTimer);
2091 m_Events.AddEvent(pEvent, m_Events.CalculateTime(timeMSToDespawn));
2092 return;
2093 }
2094
2095 if (IsAlive())
2096 setDeathState(JUST_DIED, true);
2097
2098 // Xinef: set new respawn time, ignore corpse decay time...
2099 RemoveCorpse(true);
2100
2101 if (forceRespawnTimer > Seconds::zero())
2102 {
2103 m_respawnTime = GameTime::GetGameTime().count() + forceRespawnTimer.count();
2104 m_respawnDelay = forceRespawnTimer.count();
2105 }
2106}
Definition: Creature.h:508

References EventProcessor::AddEvent(), EventProcessor::CalculateTime(), GameTime::GetGameTime(), Unit::IsAlive(), JUST_DIED, Unit::m_Events, m_respawnDelay, m_respawnTime, RemoveCorpse(), and setDeathState().

Referenced by DespawnOrUnsummon().

◆ GetAggroRange()

float Creature::GetAggroRange ( Unit const *  target) const
3279{
3280 // Determines the aggro range for creatures
3281 // Based on data from wowwiki due to lack of 3.3.5a data
3282
3283 float aggroRate = sWorld->getRate(RATE_CREATURE_AGGRO);
3284 if (aggroRate == 0)
3285 return 0.0f;
3286
3287 auto creatureLevel = target->getLevelForTarget(this);
3288 auto playerLevel = getLevelForTarget(target);
3289 int32 levelDiff = int32(creatureLevel) - int32(playerLevel);
3290
3291 // The maximum Aggro Radius is capped at 45 yards (25 level difference)
3292 if (levelDiff < -25)
3293 levelDiff = -25;
3294
3295 // The base aggro radius for mob of same level
3296 auto aggroRadius = GetDetectionRange();
3297 if (aggroRadius < 1)
3298 {
3299 return 0.0f;
3300 }
3301 // Aggro Radius varies with level difference at a rate of roughly 1 yard/level
3302 aggroRadius -= (float)levelDiff;
3303
3304 // detect range auras
3306
3307 // detected range auras
3308 aggroRadius += target->GetTotalAuraModifier(SPELL_AURA_MOD_DETECTED_RANGE);
3309
3310 // Just in case, we don't want pets running all over the map
3311 if (aggroRadius > MAX_AGGRO_RADIUS)
3312 aggroRadius = MAX_AGGRO_RADIUS;
3313
3314 // Minimum Aggro Radius for a mob seems to be combat range (5 yards)
3315 // hunter pets seem to ignore minimum aggro radius so we'll default it a little higher
3316 float minRange = IsPet() ? 10.0f : 5.0f;
3317 if (aggroRadius < minRange)
3318 aggroRadius = minRange;
3319
3320 return (aggroRadius * aggroRate);
3321}
std::int32_t int32
Definition: Define.h:104
#define MAX_AGGRO_RADIUS
Definition: Unit.h:162
@ SPELL_AURA_MOD_DETECTED_RANGE
Definition: SpellAuraDefines.h:215
@ SPELL_AURA_MOD_DETECT_RANGE
Definition: SpellAuraDefines.h:154
@ RATE_CREATURE_AGGRO
Definition: IWorld.h:490
float GetDetectionRange() const
Definition: Creature.h:249
uint8 getLevelForTarget(WorldObject const *target) const override
Definition: Creature.cpp:2924
int32 GetTotalAuraModifier(AuraType auratype) const
Definition: Unit.cpp:5822

References GetDetectionRange(), Unit::getLevelForTarget(), getLevelForTarget(), Unit::GetTotalAuraModifier(), Unit::IsPet(), MAX_AGGRO_RADIUS, RATE_CREATURE_AGGRO, SPELL_AURA_MOD_DETECT_RANGE, SPELL_AURA_MOD_DETECTED_RANGE, and sWorld.

Referenced by CanStartAttack().

◆ GetAIName()

std::string const & Creature::GetAIName ( ) const
2938{
2939 return sObjectMgr->GetCreatureTemplate(GetEntry())->AIName;
2940}
uint32 GetEntry() const
Definition: Object.h:109

References Object::GetEntry(), and sObjectMgr.

Referenced by GetDebugInfo(), npc_commandscript::HandleNpcInfoCommand(), npc_commandscript::HandleNpcSetDataCommand(), InitializeReactState(), SmartScript::IsSmart(), and UpdateMoveInLineOfSightState().

◆ GetAttackDistance()

float Creature::GetAttackDistance ( Unit const *  player) const
3476{
3477 float aggroRate = sWorld->getRate(RATE_CREATURE_AGGRO);
3478
3479 if (aggroRate == 0)
3480 return 0.0f;
3481
3482 if (!player)
3483 return 0.0f;
3484
3485 uint32 playerLevel = player->getLevelForTarget(this);
3486 uint32 creatureLevel = getLevelForTarget(player);
3487
3488 int32 levelDiff = static_cast<int32>(playerLevel) - static_cast<int32>(creatureLevel);
3489
3490 // "The maximum Aggro Radius has a cap of 25 levels under. Example: A level 30 char has the same Aggro Radius of a level 5 char on a level 60 mob."
3491 if (levelDiff < -25)
3492 levelDiff = -25;
3493
3494 // "The aggro radius of a mob having the same level as the player is roughly 20 yards"
3495 float retDistance = 20.0f;
3496
3497 // "Aggro Radius varies with level difference at a rate of roughly 1 yard/level"
3498 // radius grow if playlevel < creaturelevel
3499 retDistance -= static_cast<float>(levelDiff);
3500
3501 if (creatureLevel + 5 <= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
3502 {
3503 // detect range auras
3504 retDistance += static_cast<float>( GetTotalAuraModifier(SPELL_AURA_MOD_DETECT_RANGE) );
3505
3506 // detected range auras
3507 retDistance += static_cast<float>( player->GetTotalAuraModifier(SPELL_AURA_MOD_DETECTED_RANGE) );
3508 }
3509
3510 // "Minimum Aggro Radius for a mob seems to be combat range (5 yards)"
3511 if (retDistance < 5.0f)
3512 retDistance = 5.0f;
3513
3514 return (retDistance * aggroRate);
3515}
@ CONFIG_MAX_PLAYER_LEVEL
Definition: IWorld.h:234

References CONFIG_MAX_PLAYER_LEVEL, Unit::getLevelForTarget(), getLevelForTarget(), Unit::GetTotalAuraModifier(), RATE_CREATURE_AGGRO, SPELL_AURA_MOD_DETECT_RANGE, SPELL_AURA_MOD_DETECTED_RANGE, and sWorld.

Referenced by WorldObject::CanDetectStealthOf().

◆ GetCombatPulseDelay()

uint32 Creature::GetCombatPulseDelay ( ) const
inline
286{ return m_combatPulseDelay; }

References m_combatPulseDelay.

◆ GetCorpseDelay()

uint32 Creature::GetCorpseDelay ( ) const
inline

◆ GetCreatureAddon()

CreatureAddon const * Creature::GetCreatureAddon ( ) const
2613{
2614 if (m_spawnId)
2615 {
2616 if (CreatureAddon const* addon = sObjectMgr->GetCreatureAddon(m_spawnId))
2617 return addon;
2618 }
2619
2620 // dependent from difficulty mode entry
2621 return sObjectMgr->GetCreatureTemplateAddon(GetCreatureTemplate()->Entry);
2622}
Definition: CreatureData.h:429

References Entry, GetCreatureTemplate(), m_spawnId, and sObjectMgr.

Referenced by boss_grand_champion::boss_grand_championAI::AddCreatureAddonAuras(), wp_commandscript::HandleWpUnLoadCommand(), LoadCreaturesAddon(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::OnCreatureCreate(), and UpdateEntry().

◆ GetCreatureData()

◆ GetCreatureTemplate()

CreatureTemplate const * Creature::GetCreatureTemplate ( ) const
inline
197{ return m_creatureInfo; }

References m_creatureInfo.

Referenced by KillRewarder::_InitXP(), Unit::_IsValidAttackTarget(), AllLootRemovedFromCorpse(), Vehicle::ApplyAllImmunities(), Unit::ApplyDiminishingToDuration(), npc_escortAI::AssistPlayerInCombatAgainst(), FollowerAI::AssistPlayerInCombatAgainst(), SmartAI::AssistPlayerInCombatAgainst(), Player::BuildPetTalentsInfoData(), Unit::BuildValuesUpdate(), CalculateMinMaxDamage(), CanIgnoreFeignDeath(), Spell::CheckCast(), SpellInfo::CheckTarget(), Create(), Pet::CreateBaseAtCreature(), boss_high_king_maulgar::DoAction(), Spell::DoSpellHitOnUnit(), Spell::EffectForceDeselect(), Spell::EffectSanctuary(), Spell::EffectSkinning(), Spell::EffectSummonType(), Acore::XP::Gain(), GetCreatureAddon(), Unit::GetCreatureType(), Player::GetDefaultGossipMenuForSource(), GetMovementTemplate(), GetNativeObjectScale(), Pet::GetNativeObjectScale(), Player::GetNPCIfCanInteractWith(), AuraEffect::HandleFeignDeath(), WorldSession::HandleGossipHelloOpcode(), learn_commandscript::HandleLearnAllMyPetTalentsCommand(), npc_commandscript::HandleNpcInfoCommand(), npc_commandscript::HandleNpcSetFactionIdCommand(), npc_commandscript::HandleNpcTameCommand(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), WorldSession::HandleQuestgiverHelloOpcode(), ArenaSpectator::HandleResetCommand(), WorldSession::HandleSellItemOpcode(), HasMechanicTemplateImmunity(), Pet::HaveInDiet(), InitEntry(), Pet::InitLevelupSpellsForLevel(), Guardian::InitStatsForLevel(), IsAvoidingAOE(), isCanTrainingAndResetTalentsOf(), IsCivilian(), isElite(), IsGuard(), Player::isHonorOrXPTarget(), IsImmunedToSpellEffect(), Unit::IsInPartyWith(), Unit::IsInRaidWith(), Pet::IsPermanentPetFor(), IsRacialLeader(), Unit::isSpellBlocked(), IsTrigger(), isWorldBoss(), npc_escortAI::JustRespawned(), FollowerAI::JustRespawned(), SmartAI::JustRespawned(), Unit::Kill(), Pet::LearnPetPassives(), Player::LearnPetTalent(), LoadCreatureFromDB(), Pet::LoadPetFromDB(), LoadSpellTemplateImmunity(), Unit::MeleeSpellHitResult(), boss_onyxia::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_eye_of_acherus::npc_eye_of_acherus(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::npc_scarlet_miner_cartAI(), npc_thrall_old_hillsbrad::OnGossipHello(), npc_artorius::OnGossipHello(), npc_simone::OnGossipHello(), npc_nelson::OnGossipHello(), npc_franklin::OnGossipHello(), Player::PetSpellInitialize(), Unit::RemoveCharmedBy(), Player::RemovePet(), boss_onyxia::Reset(), boss_sindragosa::boss_sindragosaAI::Reset(), Pet::resetTalents(), Player::RewardReputation(), Unit::RollMeleeOutcomeAgainst(), SaveToDB(), SelectLevel(), Player::SendLoot(), WorldSession::SendPetNameQuery(), WorldSession::SendTrainerList(), Unit::SetCharmedBy(), setDeathState(), npc_tirion_fordring_tft::npc_tirion_fordringAI::sGossipSelect(), npc_harrison_jones::npc_harrison_jonesAI::sGossipSelect(), npc_captured_rageclaw::npc_captured_rageclawAI::SpellHit(), boss_priestess_delrissa::boss_priestess_delrissaAI::SummonedCreatureDies(), Player::SummonPet(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_sinkhole_kill_credit::npc_sinkhole_kill_creditAI::UpdateAI(), npc_pet_gen_valkyr_guardian::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), generic_creature::generic_creatureAI::UpdateAI(), UpdateEntry(), UpdateMovementFlags(), Unit::UpdateSpeed(), and Player::UpdateWeaponSkill().

◆ GetCurrentEquipmentId()

◆ GetCurrentWaypointID()

uint32 Creature::GetCurrentWaypointID ( ) const
inline
341{ return m_waypointID; }

References m_waypointID.

◆ GetDebugInfo()

std::string Creature::GetDebugInfo ( ) const
overridevirtual

Reimplemented from Object.

Reimplemented in TempSummon, Minion, Guardian, and Pet.

3712{
3713 std::stringstream sstr;
3714 sstr << Unit::GetDebugInfo() << "\n"
3715 << "AIName: " << GetAIName() << " ScriptName: " << GetScriptName()
3716 << " WaypointPath: " << GetWaypointPath() << " SpawnId: " << GetSpawnId();
3717 return sstr.str();
3718}
uint32 GetWaypointPath() const
Definition: Creature.h:338
ObjectGuid::LowType GetSpawnId() const
Definition: Creature.h:67
std::string GetScriptName() const
Definition: Creature.cpp:2942
std::string const & GetAIName() const
Definition: Creature.cpp:2937
std::string GetDebugInfo() const override
Definition: Unit.cpp:21462

References GetAIName(), Unit::GetDebugInfo(), GetScriptName(), GetSpawnId(), and GetWaypointPath().

Referenced by TempSummon::GetDebugInfo(), SetCannotReachTarget(), and Update().

◆ GetDefaultMovementType()

MovementGeneratorType Creature::GetDefaultMovementType ( ) const
inlineoverridevirtual

-------—End of Pet responses methods-------—

Reimplemented from Unit.

86{ return m_defaultMovementType; }

References m_defaultMovementType.

Referenced by SaveToDB().

◆ GetDetectionRange()

float Creature::GetDetectionRange ( ) const
inline
249{ return m_detectionDistance; }

References m_detectionDistance.

Referenced by GetAggroRange().

◆ GetFormation() [1/2]

CreatureGroup * Creature::GetFormation ( )
inline
346{ return m_formation; }

References m_formation.

◆ GetFormation() [2/2]

◆ GetHomePosition() [1/2]

Position const & Creature::GetHomePosition ( ) const
inline
331{ return m_homePosition; }

References m_homePosition.

Referenced by GetRespawnPosition().

◆ GetHomePosition() [2/2]

void Creature::GetHomePosition ( float &  x,
float &  y,
float &  z,
float &  ori 
) const
inline
330{ m_homePosition.GetPosition(x, y, z, ori); }
void GetPosition(float &x, float &y) const
Definition: Position.h:122

References Position::GetPosition(), and m_homePosition.

Referenced by HomeMovementGenerator< Creature >::_setTargetLocation(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::AttackStart(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::AttackStart(), boss_ayamiss::boss_ayamiss(), npc_icc_spire_frostwyrm::npc_icc_spire_frostwyrmAI::CanAIAttack(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::CanAIAttack(), boss_halion::boss_halionAI::CanAIAttack(), boss_attumen::boss_attumenAI::CanMeleeHit(), boss_midnight::boss_midnightAI::CanMeleeHit(), boss_trollgore::boss_trollgoreAI::CheckEvadeIfOutOfCombatArea(), boss_anomalus::boss_anomalusAI::CheckEvadeIfOutOfCombatArea(), boss_gurtogg_bloodboil::boss_gurtogg_bloodboilAI::CheckEvadeIfOutOfCombatArea(), boss_illidan_stormrage::boss_illidan_stormrageAI::CheckEvadeIfOutOfCombatArea(), boss_teron_gorefiend::boss_teron_gorefiendAI::CheckEvadeIfOutOfCombatArea(), boss_lady_vashj::boss_lady_vashjAI::CheckEvadeIfOutOfCombatArea(), boss_kaelthas::boss_kaelthasAI::CheckEvadeIfOutOfCombatArea(), boss_onyxia::CheckInRoom(), boss_isle_of_conquest::boss_isle_of_conquestAI::CheckRageBuff(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), npc_icc_spire_frostwyrm::npc_icc_spire_frostwyrmAI::DoAction(), boss_taldaram::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::DoAction(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::EnterEvadeMode(), boss_professor_putricide::boss_professor_putricideAI::EnterEvadeMode(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::EnterEvadeMode(), UtherBatteredHiltEvent::Execute(), DistractMovementGenerator::Finalize(), npc_arthas_teleport_visual::GetAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::InitializeAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::InitializeAI(), boss_prince_valanar_icc::boss_prince_valanarAI::InitializeAI(), npc_sindragosa_trash::npc_sindragosa_trashAI::InitializeAI(), boss_halion::boss_halionAI::IsAnyPlayerValid(), boss_loatheb::boss_loathebAI::IsInRoom(), boss_algalon_the_observer::boss_algalon_the_observerAI::IsInRoom(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), boss_professor_putricide::boss_professor_putricideAI::JustEngagedWith(), boss_rotface::boss_rotfaceAI::JustEngagedWith(), npc_daphne_stilwell::npc_daphne_stilwellAI::JustSummoned(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::MoveInLineOfSight(), boss_lady_vashj::boss_lady_vashjAI::MovementInform(), npc_dragonflayer_forge_master::npc_dragonflayer_forge_masterAI::npc_dragonflayer_forge_masterAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::npc_icc_vengeful_fleshreaperAI(), instance_ulduar::instance_ulduar_InstanceMapScript::OnCreatureCreate(), instance_the_black_morass::instance_the_black_morass_InstanceMapScript::OnCreatureRemove(), spell_halion_twilight_phasing::spell_halion_twilight_phasing_SpellScript::Phase(), SmartScript::ProcessAction(), boss_four_horsemen::boss_four_horsemenAI::Reset(), boss_thaddius::boss_thaddiusAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), boss_nexusprince_shaffar::boss_nexusprince_shaffarAI::Reset(), SmartAI::ReturnToLastOOCPos(), npc_escortAI::ReturnToLastPoint(), instance_naxxramas::instance_naxxramas_InstanceMapScript::SetBossState(), Player::SetClientControl(), npc_alexstraza_the_lifebinder::SetData(), npc_pet_gen_fetch_ball::SpellHitTarget(), npc_av_marshal_or_warmaster::npc_av_marshal_or_warmasterAI::UpdateAI(), boss_balinda::boss_balindaAI::UpdateAI(), boss_drekthar::boss_drektharAI::UpdateAI(), boss_galvangar::boss_galvangarAI::UpdateAI(), boss_vanndar::boss_vanndarAI::UpdateAI(), npc_blackhand_incarcerator::npc_blackhand_incarceratorAI::UpdateAI(), boss_broodlord::boss_broodlordAI::UpdateAI(), boss_priestess_delrissa::boss_priestess_delrissaAI::UpdateAI(), npc_scarlet_cannon::npc_scarlet_cannonAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), npc_alexstraza_the_lifebinder::UpdateAI(), boss_elder_nadox::UpdateAI(), boss_frostsworn_general::boss_frostsworn_generalAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_bloodmage_laurith::npc_bloodmage_laurithAI::UpdateAI(), boss_lady_vashj::boss_lady_vashjAI::UpdateAI(), boss_the_black_stalker::UpdateAI(), and boss_kaelthas::boss_kaelthasAI::UpdateAI().

◆ GetLastDamagedTime()

time_t Creature::GetLastDamagedTime ( ) const
3571{
3572 if (!_lastDamagedTime)
3573 return time_t(0);
3574
3575 return *_lastDamagedTime;
3576}

References _lastDamagedTime.

Referenced by CanCreatureAttack().

◆ GetLastDamagedTimePtr()

std::shared_ptr< time_t > const & Creature::GetLastDamagedTimePtr ( ) const
3579{
3580 return _lastDamagedTime;
3581}

References _lastDamagedTime.

Referenced by AssistDelayEvent::Execute().

◆ getLevelForTarget()

uint8 Creature::getLevelForTarget ( WorldObject const *  target) const
overridevirtual

Reimplemented from WorldObject.

2925{
2926 if (!isWorldBoss() || !target->ToUnit())
2927 return Unit::getLevelForTarget(target);
2928
2929 uint16 level = target->ToUnit()->GetLevel() + sWorld->getIntConfig(CONFIG_WORLD_BOSS_LEVEL_DIFF);
2930 if (level < 1)
2931 return 1;
2932 if (level > 255)
2933 return 255;
2934 return uint8(level);
2935}
std::uint16_t uint16
Definition: Define.h:109
@ CONFIG_WORLD_BOSS_LEVEL_DIFF
Definition: IWorld.h:284
uint8 getLevelForTarget(WorldObject const *) const override
Definition: Unit.h:1421

References CONFIG_WORLD_BOSS_LEVEL_DIFF, Unit::GetLevel(), Unit::getLevelForTarget(), isWorldBoss(), sWorld, and Object::ToUnit().

Referenced by GetAggroRange(), and GetAttackDistance().

◆ GetLootMode()

uint16 Creature::GetLootMode ( ) const
inline

◆ GetLootRecipient()

◆ GetLootRecipientGroup()

Group * Creature::GetLootRecipientGroup ( ) const
1286{
1288 return nullptr;
1289 return sGroupMgr->GetGroupByGUID(m_lootRecipientGroup);
1290}
#define sGroupMgr
Definition: GroupMgr.h:51

References m_lootRecipientGroup, and sGroupMgr.

Referenced by SmartScript::GetTargets(), Player::isAllowedToLoot(), isTappedBy(), Unit::Kill(), and Player::SendLoot().

◆ GetLootRecipientGroupGUID()

ObjectGuid::LowType Creature::GetLootRecipientGroupGUID ( ) const
inline

◆ GetLootRecipientGUID()

ObjectGuid Creature::GetLootRecipientGUID ( ) const
inline

◆ GetMeleeDamageSchoolMask()

SpellSchoolMask Creature::GetMeleeDamageSchoolMask ( WeaponAttackType  = BASE_ATTACK,
uint8  = 0 
) const
inlineoverridevirtual

Implements Unit.

159{ return m_meleeDamageSchoolMask; }

References m_meleeDamageSchoolMask.

Referenced by ThreatContainer::SelectNextVictim().

◆ GetMovementTemplate()

◆ GetNameForLocaleIdx()

std::string const & Creature::GetNameForLocaleIdx ( LocaleConstant  locale_idx) const
overridevirtual

Reimplemented from WorldObject.

3040{
3041 if (loc_idx != DEFAULT_LOCALE)
3042 {
3043 uint8 uloc_idx = uint8(loc_idx);
3044 CreatureLocale const* cl = sObjectMgr->GetCreatureLocale(GetEntry());
3045 if (cl)
3046 {
3047 if (cl->Name.size() > uloc_idx && !cl->Name[uloc_idx].empty())
3048 return cl->Name[uloc_idx];
3049 }
3050 }
3051
3052 return GetName();
3053}
#define DEFAULT_LOCALE
Definition: Common.h:88
Definition: CreatureData.h:332
std::vector< std::string > Name
Definition: CreatureData.h:333
std::string const & GetName() const
Definition: Object.h:446

References DEFAULT_LOCALE, Object::GetEntry(), WorldObject::GetName(), CreatureLocale::Name, and sObjectMgr.

Referenced by Pet::CreateBaseAtCreature(), and WorldSession::SendPetNameQuery().

◆ GetNativeObjectScale()

float Creature::GetNativeObjectScale ( ) const
overridevirtual

Reimplemented from Unit.

Reimplemented in Pet.

3382{
3383 return GetCreatureTemplate()->scale;
3384}
float scale
Definition: CreatureData.h:198

References GetCreatureTemplate(), and CreatureTemplate::scale.

Referenced by Pet::GetNativeObjectScale(), InitEntry(), and Guardian::InitStatsForLevel().

◆ GetOriginalEntry()

uint32 Creature::GetOriginalEntry ( ) const
inline

◆ GetOriginalEquipmentId()

◆ GetPetAutoSpellOnPos()

virtual uint32 Creature::GetPetAutoSpellOnPos ( uint8  pos) const
inlinevirtual

Reimplemented in Pet.

314 {
316 return 0;
317 else
318 return m_charmInfo->GetCharmSpell(pos)->GetAction();
319 }
#define MAX_SPELL_CHARM
Definition: Unit.h:157
@ ACT_ENABLED
Definition: Unit.h:1015
ActiveStates GetType() const
Definition: Unit.h:1047
uint32 GetAction() const
Definition: Unit.h:1048
CharmSpellInfo * GetCharmSpell(uint8 index)
Definition: Unit.h:1125
CharmInfo * m_charmInfo
Definition: Unit.h:2522

References ACT_ENABLED, UnitActionBarEntry::GetAction(), CharmInfo::GetCharmSpell(), UnitActionBarEntry::GetType(), Unit::m_charmInfo, and MAX_SPELL_CHARM.

Referenced by PetAI::_canMeleeAttack(), and PetAI::UpdateAI().

◆ GetPetAutoSpellSize()

virtual uint8 Creature::GetPetAutoSpellSize ( ) const
inlinevirtual

Reimplemented in Pet.

312{ return MAX_SPELL_CHARM; }

References MAX_SPELL_CHARM.

Referenced by PetAI::_canMeleeAttack(), and PetAI::UpdateAI().

◆ GetPlayerDamageReq()

uint32 Creature::GetPlayerDamageReq ( ) const
3707{
3708 return _playerDamageReq;
3709}

References _playerDamageReq.

Referenced by Acore::XP::Gain().

◆ GetRandomId()

uint32 Creature::GetRandomId ( uint32  id1,
uint32  id2,
uint32  id3 
)
3619{
3620 uint32 id = id1;
3621 uint8 ids = 0;
3622
3623 if (id2)
3624 {
3625 ++ids;
3626 if (id3) ++ids;
3627 }
3628
3629 if (ids)
3630 {
3631 uint8 idNumber = urand(0, ids);
3632 switch (idNumber)
3633 {
3634 case 0:
3635 id = id1;
3636 break;
3637 case 1:
3638 id = id2;
3639 break;
3640 case 2:
3641 id = id3;
3642 break;
3643 }
3644 }
3645 return id;
3646}
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44

References urand().

Referenced by LoadCreatureFromDB(), and Respawn().

◆ GetReactState()

ReactStates Creature::GetReactState ( ) const
inline
90{ return m_reactState; }

References m_reactState.

Referenced by boss_kiljaeden::boss_kiljaedenAI::AttackStart(), boss_icehowl::boss_icehowlAI::AttackStart(), boss_the_lurker_below::boss_the_lurker_belowAI::AttackStart(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::CanAIAttack(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::CanAIAttack(), npc_lk_wicked_spirit::npc_lk_wicked_spiritAI::CanAIAttack(), SmartAI::CanAIAttack(), boss_renataki::boss_renatakiAI::CanAlwaysBeDetectable(), boss_renataki::boss_renatakiAI::CanBeSeen(), boss_renataki::boss_renatakiAI::CanSeeAlways(), CharmInfo::CharmInfo(), Player::CharmSpellInitialize(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), boss_brutallus::boss_brutallusAI::DamageTaken(), boss_kiljaeden::boss_kiljaedenAI::EnterEvadeMode(), Pet::FillPetInfo(), boss_ick::boss_ickAI::KilledUnit(), npc_chesspiece::OnCharmed(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::OwnerAttackedBy(), Player::PetSpellInitialize(), npc_imprisoned_beryl_sorcerer::npc_imprisoned_beryl_sorcererAI::Reset(), Pet::SavePetToDB(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), boss_thekal::boss_thekalAI::UpdateAI(), npc_zealot_lorkhan::npc_zealot_lorkhanAI::UpdateAI(), npc_zealot_zath::npc_zealot_zathAI::UpdateAI(), boss_viscidus::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), npc_gunship_boarding_leader::npc_gunship_boarding_leaderAI::UpdateAI(), npc_gunship_boarding_add::npc_gunship_boarding_add_realAI::UpdateAI(), npc_gunship_mage::npc_gunship_mageAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_lady_vashj::boss_lady_vashjAI::UpdateAI(), boss_the_lurker_below::boss_the_lurker_belowAI::UpdateAI(), npc_gunship_rocketeer::npc_gunship_rocketeerAI::UpdateAI(), and Player::VehicleSpellInitialize().

◆ GetRespawnDelay()

◆ GetRespawnPosition()

void Creature::GetRespawnPosition ( float &  x,
float &  y,
float &  z,
float *  ori = nullptr,
float *  dist = nullptr 
) const
2845{
2846 if (m_spawnId)
2847 {
2848 if (CreatureData const* data = sObjectMgr->GetCreatureData(m_spawnId))
2849 {
2850 x = data->posX;
2851 y = data->posY;
2852 z = data->posZ;
2853 if (ori)
2854 *ori = data->orientation;
2855 if (dist)
2856 *dist = data->wander_distance;
2857
2858 return;
2859 }
2860 }
2861
2862 // xinef: changed this from current position to home position, fixes world summons with infinite duration
2863 if (GetTransport())
2864 {
2865 x = GetPositionX();
2866 y = GetPositionY();
2867 z = GetPositionZ();
2868 if (ori)
2869 *ori = GetOrientation();
2870 }
2871 else
2872 {
2874 x = homePos.GetPositionX();
2875 y = homePos.GetPositionY();
2876 z = homePos.GetPositionZ();
2877 if (ori)
2878 *ori = homePos.GetOrientation();
2879 }
2880 if (dist)
2881 *dist = 0;
2882}
Position const homePos
Definition: boss_chromaggus.cpp:69
Position const & GetHomePosition() const
Definition: Creature.h:331
Definition: CreatureData.h:359
Transport * GetTransport() const
Definition: Object.h:585
Definition: Position.h:28

References GetHomePosition(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::GetTransport(), homePos, m_spawnId, and sObjectMgr.

Referenced by RemoveCorpse(), and npc_escortAI::UpdateAI().

◆ GetRespawnTime()

time_t const & Creature::GetRespawnTime ( ) const
inline

◆ GetRespawnTimeEx()

time_t Creature::GetRespawnTimeEx ( ) const
2835{
2836 time_t now = GameTime::GetGameTime().count();
2837
2838 if (m_respawnTime > now)
2839 return m_respawnTime;
2840 else
2841 return now;
2842}

References GameTime::GetGameTime(), and m_respawnTime.

Referenced by npc_commandscript::HandleNpcInfoCommand().

◆ GetScriptId()

◆ GetScriptName()

std::string Creature::GetScriptName ( ) const

◆ GetShieldBlockValue()

uint32 Creature::GetShieldBlockValue ( ) const
inlineoverridevirtual

Implements Unit.

155 {
156 return (GetLevel() / 2 + uint32(GetStat(STAT_STRENGTH) / 20));
157 }
@ STAT_STRENGTH
Definition: SharedDefines.h:230
float GetStat(Stats stat) const
Definition: Unit.h:1430
uint8 GetLevel() const
Definition: Unit.h:1420

References Unit::GetLevel(), Unit::GetStat(), and STAT_STRENGTH.

◆ GetSpawnId()

ObjectGuid::LowType Creature::GetSpawnId ( ) const
inline
67{ return m_spawnId; }

References m_spawnId.

Referenced by BattlegroundAV::AddAVCreature(), CreatureGroup::AddMember(), Vehicle::ApplyAllImmunities(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::boss_valithria_dreamwalkerAI(), boss_ghazan::DoAction(), RandomMovementGenerator< T >::DoInitialize(), GetDebugInfo(), CreatureGroup::GetNewTargetForMember(), GameEventMgr::GetNPCFlag(), SmartScript::GetScript(), WorldSession::HandleAuctionSellItem(), debug_commandscript::HandleDebugGetLootRecipientCommand(), OPvPCapturePointZM_GraveYard::HandleGossipOption(), npc_commandscript::HandleNpcAddCommand(), npc_commandscript::HandleNpcAddFormationCommand(), npc_commandscript::HandleNpcGuidCommand(), npc_commandscript::HandleNpcInfoCommand(), npc_commandscript::HandleNpcMoveCommand(), npc_commandscript::HandleNpcSetLinkCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetSpawnTimeCommand(), npc_commandscript::HandleNpcSetWanderDistanceCommand(), wp_commandscript::HandleWpLoadCommand(), wp_commandscript::HandleWpModifyCommand(), wp_commandscript::HandleWpShowCommand(), wp_commandscript::HandleWpUnLoadCommand(), npc_eastvale_peasent::Initialize(), npc_spinestalker::npc_spinestalkerAI::InitializeAI(), npc_rimefang::npc_rimefangAI::InitializeAI(), npc_sindragosa_trash::npc_sindragosa_trashAI::InitializeAI(), npc_risen_archmage::npc_risen_archmageAI::JustEngagedWith(), npc_spinestalker::npc_spinestalkerAI::JustRespawned(), npc_rimefang::npc_rimefangAI::JustRespawned(), npc_sindragosa_trash::npc_sindragosa_trashAI::JustRespawned(), CreatureGroup::MemberEngagingTarget(), CreatureGroup::MemberEvaded(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnCreatureCreate(), instance_sunwell_plateau::instance_sunwell_plateau_InstanceMapScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnUnitDeath(), RisenArchmageCheck::operator()(), ValithriaDespawner::operator()(), DoorsGuidCheck::operator()(), FormationMgr::RemoveCreatureFromGroup(), npc_ahnqiraji_critter::Reset(), Respawn(), SearchFormation(), boss_kaelthas::boss_kaelthasAI::SummonedCreatureDies(), and npc_risen_archmage::npc_risen_archmageAI::UpdateAI().

◆ GetSpellCooldown()

uint32 Creature::GetSpellCooldown ( uint32  spell_id) const
2811{
2812 CreatureSpellCooldowns::const_iterator itr = m_CreatureSpellCooldowns.find(spell_id);
2813 if (itr == m_CreatureSpellCooldowns.end())
2814 return 0;
2815
2816 return itr->second.end > GameTime::GetGameTimeMS().count() ? itr->second.end - GameTime::GetGameTimeMS().count() : 0;
2817}

References GameTime::GetGameTimeMS(), and m_CreatureSpellCooldowns.

◆ GetSpellDamageMod()

float Creature::GetSpellDamageMod ( int32  Rank)
1581{
1582 switch (Rank) // define rates for each elite rank
1583 {
1594 default:
1596 }
1597}
@ RATE_CREATURE_NORMAL_SPELLDAMAGE
Definition: IWorld.h:485
@ RATE_CREATURE_ELITE_ELITE_SPELLDAMAGE
Definition: IWorld.h:486
@ RATE_CREATURE_ELITE_RAREELITE_SPELLDAMAGE
Definition: IWorld.h:487
@ RATE_CREATURE_ELITE_WORLDBOSS_SPELLDAMAGE
Definition: IWorld.h:488
@ RATE_CREATURE_ELITE_RARE_SPELLDAMAGE
Definition: IWorld.h:489

References CREATURE_ELITE_ELITE, CREATURE_ELITE_NORMAL, CREATURE_ELITE_RARE, CREATURE_ELITE_RAREELITE, CREATURE_ELITE_WORLDBOSS, RATE_CREATURE_ELITE_ELITE_SPELLDAMAGE, RATE_CREATURE_ELITE_RARE_SPELLDAMAGE, RATE_CREATURE_ELITE_RAREELITE_SPELLDAMAGE, RATE_CREATURE_ELITE_WORLDBOSS_SPELLDAMAGE, RATE_CREATURE_NORMAL_SPELLDAMAGE, and sWorld.

Referenced by Unit::SpellDamageBonusDone().

◆ GetTrainerSpells()

TrainerSpellData const * Creature::GetTrainerSpells ( ) const
3034{
3035 return sObjectMgr->GetNpcTrainerSpells(GetEntry());
3036}

References Object::GetEntry(), and sObjectMgr.

Referenced by WorldSession::HandleTrainerBuySpellOpcode(), and WorldSession::SendTrainerList().

◆ GetTransportHomePosition() [1/2]

Position const & Creature::GetTransportHomePosition ( ) const
inline

◆ GetTransportHomePosition() [2/2]

void Creature::GetTransportHomePosition ( float &  x,
float &  y,
float &  z,
float &  ori 
) const
inline

◆ GetVendorItemCurrentCount()

uint32 Creature::GetVendorItemCurrentCount ( VendorItem const *  vItem)
2962{
2963 if (!vItem->maxcount)
2964 return vItem->maxcount;
2965
2966 VendorItemCounts::iterator itr = m_vendorItemCounts.begin();
2967 for (; itr != m_vendorItemCounts.end(); ++itr)
2968 if (itr->itemId == vItem->item)
2969 break;
2970
2971 if (itr == m_vendorItemCounts.end())
2972 return vItem->maxcount;
2973
2974 VendorItemCount* vCount = &*itr;
2975
2976 time_t ptime = GameTime::GetGameTime().count();
2977
2978 if (time_t(vCount->lastIncrementTime + vItem->incrtime) <= ptime)
2979 {
2980 ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(vItem->item);
2981
2982 uint32 diff = uint32((ptime - vCount->lastIncrementTime) / vItem->incrtime);
2983 if ((vCount->count + diff * pProto->BuyCount) >= vItem->maxcount)
2984 {
2985 m_vendorItemCounts.erase(itr);
2986 return vItem->maxcount;
2987 }
2988
2989 vCount->count += diff * pProto->BuyCount;
2990 vCount->lastIncrementTime = ptime;
2991 }
2992
2993 return vCount->count;
2994}
Definition: CreatureData.h:485
time_t lastIncrementTime
Definition: CreatureData.h:490
uint32 count
Definition: CreatureData.h:489
Definition: ItemTemplate.h:628
uint32 BuyCount
Definition: ItemTemplate.h:638

References ItemTemplate::BuyCount, VendorItemCount::count, GameTime::GetGameTime(), VendorItem::incrtime, VendorItem::item, VendorItemCount::lastIncrementTime, m_vendorItemCounts, VendorItem::maxcount, and sObjectMgr.

Referenced by Player::BuyItemFromVendorSlot(), and WorldSession::SendListInventory().

◆ GetVendorItems()

VendorItemData const * Creature::GetVendorItems ( ) const
2957{
2958 return sObjectMgr->GetNpcVendorItemList(GetEntry());
2959}

References Object::GetEntry(), and sObjectMgr.

Referenced by Player::BuyItemFromVendorSlot(), and WorldSession::SendListInventory().

◆ GetWanderDistance()

float Creature::GetWanderDistance ( ) const
inline

◆ GetWaypointPath()

◆ hasInvolvedQuest()

bool Creature::hasInvolvedQuest ( uint32  quest_id) const
overridevirtual

Reimplemented from Object.

1811{
1812 QuestRelationBounds qir = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(GetEntry());
1813 for (QuestRelations::const_iterator itr = qir.first; itr != qir.second; ++itr)
1814 {
1815 if (itr->second == quest_id)
1816 return true;
1817 }
1818 return false;
1819}
std::pair< QuestRelations::const_iterator, QuestRelations::const_iterator > QuestRelationBounds
Definition: ObjectMgr.h:519

References Object::GetEntry(), and sObjectMgr.

◆ HasLootMode()

bool Creature::HasLootMode ( uint16  lootMode) const
inline
233{ return m_LootMode & lootMode; }

References m_LootMode.

◆ hasLootRecipient()

◆ HasMechanicTemplateImmunity()

bool Creature::HasMechanicTemplateImmunity ( uint32  mask) const
2147{
2149}
uint32 MechanicImmuneMask
Definition: CreatureData.h:237
bool IsPlayer() const
Definition: ObjectGuid.h:170
ObjectGuid GetOwnerGUID() const
Definition: Unit.h:1814

References GetCreatureTemplate(), Unit::GetOwnerGUID(), ObjectGuid::IsPlayer(), and CreatureTemplate::MechanicImmuneMask.

Referenced by Unit::HandleProcTriggerSpell(), IsImmunedToSpell(), IsImmunedToSpellEffect(), and Unit::UpdateSpeed().

◆ hasQuest()

bool Creature::hasQuest ( uint32  quest_id) const
overridevirtual

Reimplemented from Object.

1800{
1801 QuestRelationBounds qr = sObjectMgr->GetCreatureQuestRelationBounds(GetEntry());
1802 for (QuestRelations::const_iterator itr = qr.first; itr != qr.second; ++itr)
1803 {
1804 if (itr->second == quest_id)
1805 return true;
1806 }
1807 return false;
1808}

References Object::GetEntry(), and sObjectMgr.

◆ HasReactState()

◆ HasSearchedAssistance()

bool Creature::HasSearchedAssistance ( )
inline

References m_AlreadySearchedAssistance.

Referenced by setDeathState().

◆ HasSpell()

bool Creature::HasSpell ( uint32  spellID) const
overridevirtual

Reimplemented from Unit.

Reimplemented in Pet.

2826{
2827 uint8 i;
2828 for (i = 0; i < MAX_CREATURE_SPELLS; ++i)
2829 if (spellID == m_spells[i])
2830 break;
2831 return i < MAX_CREATURE_SPELLS; //broke before end of iteration of known spells
2832}

References m_spells, and MAX_CREATURE_SPELLS.

Referenced by WorldSession::HandleCastSpellOpcode().

◆ HasSpellCooldown()

bool Creature::HasSpellCooldown ( uint32  spell_id) const
overridevirtual

◆ HasSpellFocus()

bool Creature::HasSpellFocus ( Spell const *  focusSpell = nullptr) const
3450{
3451 if (isDead()) // dead creatures cannot focus
3452 {
3453 return false;
3454 }
3455
3456 return focusSpell ? (focusSpell == _spellFocusInfo.Spell) : (_spellFocusInfo.Spell || _spellFocusInfo.Delay);
3457}
struct Creature::@210 _spellFocusInfo
bool isDead() const
Definition: Unit.h:1810

References _spellFocusInfo, and Unit::isDead().

Referenced by IsMovementPreventedByCasting().

◆ HasSwimmingFlagOutOfCombat()

bool Creature::HasSwimmingFlagOutOfCombat ( ) const
inline

◆ InitEntry()

bool Creature::InitEntry ( uint32  Entry,
const CreatureData data = nullptr 
)
protected

change the entry of creature until respawn

386{
387 CreatureTemplate const* normalInfo = sObjectMgr->GetCreatureTemplate(Entry);
388 if (!normalInfo)
389 {
390 LOG_ERROR("sql.sql", "Creature::InitEntry creature entry {} does not exist.", Entry);
391 return false;
392 }
393
394 // get difficulty 1 mode entry
395 // Xinef: Skip for pets!
396 CreatureTemplate const* cinfo = normalInfo;
397 for (uint8 diff = uint8(GetMap()->GetSpawnMode()); diff > 0 && !IsPet();)
398 {
399 // we already have valid Map pointer for current creature!
400 if (normalInfo->DifficultyEntry[diff - 1])
401 {
402 cinfo = sObjectMgr->GetCreatureTemplate(normalInfo->DifficultyEntry[diff - 1]);
403 if (cinfo)
404 break; // template found
405
406 // check and reported at startup, so just ignore (restore normalInfo)
407 cinfo = normalInfo;
408 }
409
410 // for instances heroic to normal, other cases attempt to retrieve previous difficulty
411 if (diff >= RAID_DIFFICULTY_10MAN_HEROIC && GetMap()->IsRaid())
412 diff -= 2; // to normal raid difficulty cases
413 else
414 --diff;
415 }
416
417 SetEntry(Entry); // normal entry always
418 m_creatureInfo = cinfo; // map mode related always
419
420 // equal to player Race field, but creature does not have race
422
423 // known valid are: CLASS_WARRIOR, CLASS_PALADIN, CLASS_ROGUE, CLASS_MAGE
425
426 // Cancel load if no model defined
427 if (!(cinfo->GetFirstValidModelId()))
428 {
429 LOG_ERROR("sql.sql", "Creature (Entry: {}) has no model defined in table `creature_template`, can't load. ", Entry);
430 return false;
431 }
432
434 if (!sObjectMgr->GetCreatureModelRandomGender(&displayID)) // Cancel load if no model defined
435 {
436 LOG_ERROR("sql.sql", "Creature (Entry: {}) has no model defined in table `creature_template`, can't load. ", Entry);
437 return false;
438 }
439
440 SetDisplayId(displayID);
441 SetNativeDisplayId(displayID);
442
443 // Load creature equipment
444 if (!data)
445 {
446 LoadEquipment(); // use default from the template
447 }
448 else if (data->equipmentId == 0)
449 {
450 LoadEquipment(0); // 0 means no equipment for creature table
451 }
452 else
453 {
456 }
457
458 SetName(normalInfo->Name); // at normal entry always
459
461
463 SetSpeed(MOVE_RUN, cinfo->speed_run);
466
467 // Will set UNIT_FIELD_BOUNDINGRADIUS and UNIT_FIELD_COMBATREACH
469
471
472 // checked at loading
476
477 for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
479
480 return true;
481}
@ UNIT_FIELD_BYTES_0
Definition: UpdateFields.h:95
@ UNIT_MOD_CAST_SPEED
Definition: UpdateFields.h:137
@ UNIT_FIELD_HOVERHEIGHT
Definition: UpdateFields.h:173
@ MOVE_FLIGHT
Definition: Unit.h:384
@ MOVE_SWIM
Definition: Unit.h:381
@ MOVE_WALK
Definition: Unit.h:378
MovementGeneratorType
Definition: MotionMaster.h:36
@ RANDOM_MOTION_TYPE
Definition: MotionMaster.h:38
void SetObjectScale(float scale) override
Definition: Creature.cpp:3386
void LoadEquipment(int8 id=1, bool force=false)
Definition: Creature.cpp:1777
float GetNativeObjectScale() const override
Definition: Creature.cpp:3381
uint32 GetFirstValidModelId() const
Definition: Creature.cpp:133
float speed_run
Definition: CreatureData.h:194
std::string Name
Definition: CreatureData.h:184
uint32 spells[MAX_CREATURE_SPELLS]
Definition: CreatureData.h:221
float speed_swim
Definition: CreatureData.h:195
uint32 MovementType
Definition: CreatureData.h:227
uint32 unit_class
Definition: CreatureData.h:206
float speed_walk
Definition: CreatureData.h:193
float HoverHeight
Definition: CreatureData.h:229
float speed_flight
Definition: CreatureData.h:196
int8 equipmentId
Definition: CreatureData.h:367
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition: Object.cpp:750
void SetFloatValue(uint16 index, float value)
Definition: Object.cpp:737
void SetEntry(uint32 entry)
Definition: Object.h:110
void SetName(std::string const &newname)
Definition: Object.h:447
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition: Unit.cpp:14323
static uint32 ChooseDisplayId(CreatureTemplate const *cinfo, CreatureData const *data=nullptr)
Definition: ObjectMgr.cpp:1717

References ObjectMgr::ChooseDisplayId(), CreatureTemplate::DifficultyEntry, Entry, CreatureData::equipmentId, GetCreatureTemplate(), CreatureTemplate::GetFirstValidModelId(), WorldObject::GetMap(), GetNativeObjectScale(), CreatureTemplate::HoverHeight, IDLE_MOTION_TYPE, Unit::IsPet(), Map::IsRaid(), LoadEquipment(), LOG_ERROR, m_creatureInfo, m_defaultMovementType, m_originalEquipmentId, m_spells, m_wanderDistance, MAX_CREATURE_SPELLS, MOVE_FLIGHT, MOVE_RUN, MOVE_SWIM, MOVE_WALK, CreatureTemplate::MovementType, CreatureTemplate::Name, RAID_DIFFICULTY_10MAN_HEROIC, RANDOM_MOTION_TYPE, Object::SetByteValue(), SetDisplayId(), Object::SetEntry(), Object::SetFloatValue(), WorldObject::SetName(), Unit::SetNativeDisplayId(), SetObjectScale(), Unit::SetSpeed(), sObjectMgr, CreatureTemplate::speed_flight, CreatureTemplate::speed_run, CreatureTemplate::speed_swim, CreatureTemplate::speed_walk, CreatureTemplate::spells, CreatureTemplate::unit_class, UNIT_FIELD_BYTES_0, UNIT_FIELD_HOVERHEIGHT, and UNIT_MOD_CAST_SPEED.

Referenced by Pet::Create(), and UpdateEntry().

◆ InitializeReactState()

void Creature::InitializeReactState ( )
2137{
2138 if ((IsTotem() || IsTrigger() || IsCritter() || IsSpiritService()) && GetAIName() != "SmartAI" && !GetScriptId())
2140 else
2142 /*else if (IsCivilian())
2143 SetReactState(REACT_DEFENSIVE);*/
2144}
@ REACT_PASSIVE
Definition: Unit.h:1023
bool IsTrigger() const
Definition: Creature.h:77
void SetReactState(ReactStates st)
Definition: Creature.h:89
bool IsCritter() const
Definition: Unit.h:1674
bool IsSpiritService() const
Definition: Unit.h:1673

References GetAIName(), GetScriptId(), Unit::IsCritter(), Unit::IsSpiritService(), Unit::IsTotem(), IsTrigger(), REACT_AGGRESSIVE, REACT_PASSIVE, and SetReactState().

Referenced by Respawn(), and UpdateEntry().

◆ IsAlwaysDetectableFor()

bool Creature::IsAlwaysDetectableFor ( WorldObject const *  seer) const
overrideprotectedvirtual

Reimplemented from WorldObject.

1873{
1875 {
1876 return true;
1877 }
1878
1879 if (IsAIEnabled && AI()->CanAlwaysBeDetectable(seer))
1880 {
1881 return true;
1882 }
1883
1884 return false;
1885}
bool IsAlwaysDetectableFor(WorldObject const *seer) const override
Definition: Unit.cpp:14111

References AI(), Unit::IsAIEnabled, and Unit::IsAlwaysDetectableFor().

◆ IsAvoidingAOE()

◆ isCanInteractWithBattleMaster()

bool Creature::isCanInteractWithBattleMaster ( Player player,
bool  msg 
) const
1190{
1191 if (!IsBattleMaster())
1192 return false;
1193
1194 BattlegroundTypeId bgTypeId = sBattlegroundMgr->GetBattleMasterBG(GetEntry());
1195 if (!msg)
1196 return player->GetBGAccessByLevel(bgTypeId);
1197
1198 if (!player->GetBGAccessByLevel(bgTypeId))
1199 {
1200 ClearGossipMenuFor(player);
1201 switch (bgTypeId)
1202 {
1203 case BATTLEGROUND_AV:
1204 SendGossipMenuFor(player, 7616, this);
1205 break;
1206 case BATTLEGROUND_WS:
1207 SendGossipMenuFor(player, 7599, this);
1208 break;
1209 case BATTLEGROUND_AB:
1210 SendGossipMenuFor(player, 7642, this);
1211 break;
1212 case BATTLEGROUND_EY:
1213 case BATTLEGROUND_NA:
1214 case BATTLEGROUND_BE:
1215 case BATTLEGROUND_AA:
1216 case BATTLEGROUND_RL:
1217 case BATTLEGROUND_SA:
1218 case BATTLEGROUND_DS:
1219 case BATTLEGROUND_RV:
1220 SendGossipMenuFor(player, 10024, this);
1221 break;
1222 default:
1223 break;
1224 }
1225 return false;
1226 }
1227 return true;
1228}
void SendGossipMenuFor(Player *player, uint32 npcTextID, ObjectGuid const guid)
Definition: ScriptedGossip.cpp:45
void ClearGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:22
#define sBattlegroundMgr
Definition: BattlegroundMgr.h:188
BattlegroundTypeId
Definition: SharedDefines.h:3451
@ BATTLEGROUND_AA
Definition: SharedDefines.h:3458
@ BATTLEGROUND_WS
Definition: SharedDefines.h:3454
@ BATTLEGROUND_EY
Definition: SharedDefines.h:3459
@ BATTLEGROUND_AV
Definition: SharedDefines.h:3453
@ BATTLEGROUND_BE
Definition: SharedDefines.h:3457
@ BATTLEGROUND_RV
Definition: SharedDefines.h:3463
@ BATTLEGROUND_NA
Definition: SharedDefines.h:3456
@ BATTLEGROUND_DS
Definition: SharedDefines.h:3462
@ BATTLEGROUND_SA
Definition: SharedDefines.h:3461
@ BATTLEGROUND_AB
Definition: SharedDefines.h:3455
@ BATTLEGROUND_RL
Definition: SharedDefines.h:3460
bool GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const
Definition: Player.cpp:12219
bool IsBattleMaster() const
Definition: Unit.h:1657

References BATTLEGROUND_AA, BATTLEGROUND_AB, BATTLEGROUND_AV, BATTLEGROUND_BE, BATTLEGROUND_DS, BATTLEGROUND_EY, BATTLEGROUND_NA, BATTLEGROUND_RL, BATTLEGROUND_RV, BATTLEGROUND_SA, BATTLEGROUND_WS, ClearGossipMenuFor(), Player::GetBGAccessByLevel(), Object::GetEntry(), Unit::IsBattleMaster(), sBattlegroundMgr, and SendGossipMenuFor().

◆ isCanTrainingAndResetTalentsOf()

bool Creature::isCanTrainingAndResetTalentsOf ( Player player) const
1231{
1232 return player->GetLevel() >= 10
1234 && player->getClass() == GetCreatureTemplate()->trainer_class;
1235}
@ TRAINER_TYPE_CLASS
Definition: SharedDefines.h:2589
uint32 trainer_class
Definition: CreatureData.h:213
uint32 trainer_type
Definition: CreatureData.h:211
uint8 getClass() const
Definition: Unit.h:1426

References Unit::getClass(), GetCreatureTemplate(), Unit::GetLevel(), CreatureTemplate::trainer_class, CreatureTemplate::trainer_type, and TRAINER_TYPE_CLASS.

Referenced by WorldSession::HandleTalentWipeConfirmOpcode().

◆ IsCivilian()

◆ IsDamageEnoughForLootingAndReward()

◆ IsDungeonBoss()

◆ isElite()

bool Creature::isElite ( ) const
inline
107 {
108 if (IsPet())
109 return false;
110
112 return rank != CREATURE_ELITE_NORMAL && rank != CREATURE_ELITE_RARE;
113 }
uint32 rank
Definition: CreatureData.h:199

References CREATURE_ELITE_NORMAL, CREATURE_ELITE_RARE, GetCreatureTemplate(), Unit::IsPet(), and CreatureTemplate::rank.

Referenced by Spell::EffectSkinning(), and Acore::XP::Gain().

◆ IsEvadingAttacks()

bool Creature::IsEvadingAttacks ( ) const
inline

◆ IsFreeToMove()

bool Creature::IsFreeToMove ( )
911{
913 // Do not reposition ourself when we are not allowed to move
915 (GetMotionMaster()->GetCurrentMovementGeneratorType() != CHASE_MOTION_TYPE ||
916 moveFlags & MOVEMENTFLAG_SPLINE_ENABLED))
917 {
918 return false;
919 }
920
921 return true;
922}
@ MOVEMENTFLAG_SPLINE_ENABLED
Definition: Unit.h:579
bool IsMovementPreventedByCasting() const override
Definition: Creature.cpp:3517
uint32 GetMovementFlags() const
Definition: Object.h:318
MovementInfo m_movementInfo
Definition: Object.h:595
bool CanFreeMove() const
Definition: Unit.h:1401
bool isMoving() const
Definition: Unit.h:2380

References Unit::CanFreeMove(), CHASE_MOTION_TYPE, Unit::GetMotionMaster(), MovementInfo::GetMovementFlags(), IsMovementPreventedByCasting(), Unit::isMoving(), WorldObject::m_movementInfo, and MOVEMENTFLAG_SPLINE_ENABLED.

Referenced by CreatureAI::MoveBackwardsChecks(), and CreatureAI::MoveCircleChecks().

◆ IsGuard()

bool Creature::IsGuard ( ) const
inline

◆ IsImmunedToSpell()

bool Creature::IsImmunedToSpell ( SpellInfo const *  spellInfo,
Spell const *  spell = nullptr 
)
overridevirtual

Reimplemented from Unit.

2182{
2183 if (!spellInfo)
2184 return false;
2185
2186 // Xinef: this should exclude self casts...
2187 // Spells that don't have effectMechanics.
2188 if (spellInfo->Mechanic > MECHANIC_NONE && HasMechanicTemplateImmunity(1 << (spellInfo->Mechanic - 1)))
2189 return true;
2190
2191 // This check must be done instead of 'if (GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1)))' for not break
2192 // the check of mechanic immunity on DB (tested) because GetCreatureTemplate()->MechanicImmuneMask and m_spellImmune[IMMUNITY_MECHANIC] don't have same data.
2193 bool immunedToAllEffects = true;
2194 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
2195 if (spellInfo->Effects[i].IsEffect() && !IsImmunedToSpellEffect(spellInfo, i))
2196 {
2197 immunedToAllEffects = false;
2198 break;
2199 }
2200 if (immunedToAllEffects)
2201 return true;
2202
2203 return Unit::IsImmunedToSpell(spellInfo, spell);
2204}
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1610
@ MECHANIC_NONE
Definition: SharedDefines.h:1297
bool HasMechanicTemplateImmunity(uint32 mask) const
Definition: Creature.cpp:2146
bool IsImmunedToSpellEffect(SpellInfo const *spellInfo, uint32 index) const override
Definition: Creature.cpp:2206
virtual bool IsImmunedToSpell(SpellInfo const *spellInfo, Spell const *spell=nullptr)
Definition: Unit.cpp:12827

References SpellInfo::Effects, HasMechanicTemplateImmunity(), Unit::IsImmunedToSpell(), IsImmunedToSpellEffect(), MAX_SPELL_EFFECTS, SpellInfo::Mechanic, and MECHANIC_NONE.

◆ IsImmunedToSpellEffect()

bool Creature::IsImmunedToSpellEffect ( SpellInfo const *  spellInfo,
uint32  index 
) const
overridevirtual

Reimplemented from Unit.

Reimplemented in Totem.

2207{
2208 // Xinef: this should exclude self casts...
2209 if (spellInfo->Effects[index].Mechanic > MECHANIC_NONE && HasMechanicTemplateImmunity(1 << (spellInfo->Effects[index].Mechanic - 1)))
2210 return true;
2211
2212 if (GetCreatureTemplate()->type == CREATURE_TYPE_MECHANICAL && spellInfo->Effects[index].Effect == SPELL_EFFECT_HEAL)
2213 return true;
2214
2215 return Unit::IsImmunedToSpellEffect(spellInfo, index);
2216}
@ SPELL_EFFECT_HEAL
Definition: SharedDefines.h:760
@ CREATURE_TYPE_MECHANICAL
Definition: SharedDefines.h:2608
virtual bool IsImmunedToSpellEffect(SpellInfo const *spellInfo, uint32 index) const
Definition: Unit.cpp:12917

References CREATURE_TYPE_MECHANICAL, SpellInfo::Effects, GetCreatureTemplate(), HasMechanicTemplateImmunity(), Unit::IsImmunedToSpellEffect(), MECHANIC_NONE, and SPELL_EFFECT_HEAL.

Referenced by IsImmunedToSpell(), and Totem::IsImmunedToSpellEffect().

◆ IsImmuneToKnockback()

bool Creature::IsImmuneToKnockback ( ) const
3073{
3074 if (GetOwnerGUID().IsPlayer())
3075 return false;
3076
3077 CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(GetEntry());
3078 return cinfo && (cinfo->flags_extra & CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK);
3079}
@ CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK
Definition: CreatureData.h:79

References CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK, CreatureTemplate::flags_extra, Object::GetEntry(), Unit::GetOwnerGUID(), Object::IsPlayer(), and sObjectMgr.

◆ IsInEvadeMode()

◆ IsInvisibleDueToDespawn()

bool Creature::IsInvisibleDueToDespawn ( ) const
overrideprotectedvirtual

Reimplemented from WorldObject.

1854{
1856 return true;
1857
1859 return false;
1860
1861 return true;
1862}
virtual bool IsInvisibleDueToDespawn() const
Definition: Object.h:649

References GameTime::GetGameTime(), Unit::IsAlive(), WorldObject::IsInvisibleDueToDespawn(), and m_corpseRemoveTime.

◆ IsMoveInLineOfSightDisabled()

bool Creature::IsMoveInLineOfSightDisabled ( )
inline

◆ IsMoveInLineOfSightStrictlyDisabled()

bool Creature::IsMoveInLineOfSightStrictlyDisabled ( )
inline

◆ IsMovementPreventedByCasting()

bool Creature::IsMovementPreventedByCasting ( ) const
overridevirtual

Reimplemented from Unit.

3518{
3520 // first check if currently a movement allowed channel is active and we're not casting
3521 if (spell && spell->getState() != SPELL_STATE_FINISHED && spell->IsChannelActive() && spell->GetSpellInfo()->IsActionAllowedChannel())
3522 {
3523 return false;
3524 }
3525
3526 if (HasSpellFocus())
3527 {
3528 return true;
3529 }
3530
3532 {
3533 return true;
3534 }
3535
3536 return false;
3537}
@ CURRENT_CHANNELED_SPELL
Definition: Unit.h:980
@ UNIT_STATE_CASTING
Definition: Unit.h:340
@ SPELL_STATE_FINISHED
Definition: Spell.h:226
bool HasSpellFocus(Spell const *focusSpell=nullptr) const
Definition: Creature.cpp:3449
Spell * m_currentSpells[CURRENT_MAX_SPELL]
Definition: Unit.h:2501
Definition: Spell.h:284
SpellInfo const * GetSpellInfo() const
Definition: Spell.h:574
uint32 getState() const
Definition: Spell.h:482
bool IsChannelActive() const
Definition: Spell.h:553
bool IsActionAllowedChannel() const
Definition: SpellInfo.cpp:1245

References CURRENT_CHANNELED_SPELL, Spell::GetSpellInfo(), Spell::getState(), HasSpellFocus(), Unit::HasUnitState(), SpellInfo::IsActionAllowedChannel(), Spell::IsChannelActive(), Unit::m_currentSpells, SPELL_STATE_FINISHED, and UNIT_STATE_CASTING.

Referenced by WaypointMovementGenerator< Creature >::DoUpdate(), RandomMovementGenerator< T >::DoUpdate(), ChaseMovementGenerator< T >::DoUpdate(), FollowMovementGenerator< T >::DoUpdate(), IsFreeToMove(), and WaypointMovementGenerator< Creature >::StartMove().

◆ IsNotReachableAndNeedRegen()

bool Creature::IsNotReachableAndNeedRegen ( ) const
3561{
3562 if (CanNotReachTarget())
3563 {
3565 }
3566
3567 return false;
3568}
constexpr auto IN_MILLISECONDS
Definition: Common.h:62
@ CONFIG_NPC_REGEN_TIME_IF_NOT_REACHABLE_IN_RAID
Definition: IWorld.h:408

References CanNotReachTarget(), CONFIG_NPC_REGEN_TIME_IF_NOT_REACHABLE_IN_RAID, IN_MILLISECONDS, m_cannotReachTimer, and sWorld.

Referenced by Update().

◆ IsRacialLeader()

bool Creature::IsRacialLeader ( ) const
inline
bool RacialLeader
Definition: CreatureData.h:234

References GetCreatureTemplate(), and CreatureTemplate::RacialLeader.

Referenced by Player::RewardHonor().

◆ isRegeneratingHealth()

◆ IsReputationGainDisabled()

bool Creature::IsReputationGainDisabled ( ) const
inline
352{ return DisableReputationGain; }

References DisableReputationGain.

Referenced by Player::RewardReputation().

◆ IsSpellProhibited()

bool Creature::IsSpellProhibited ( SpellSchoolMask  idSchoolMask) const
2741{
2742 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
2743 {
2744 if (idSchoolMask & (1 << i))
2745 {
2747 {
2748 return true;
2749 }
2750 }
2751 }
2752
2753 return false;
2754}

References GameTime::GetGameTimeMS(), m_ProhibitSchoolTime, MAX_SPELL_SCHOOL, and SPELL_SCHOOL_NORMAL.

Referenced by Spell::CheckCast(), and SmartScript::ProcessAction().

◆ isTappedBy()

bool Creature::isTappedBy ( Player const *  player) const
1354{
1355 if (player->GetGUID() == m_lootRecipient)
1356 return true;
1357
1358 Group const* playerGroup = player->GetGroup();
1359 if (!playerGroup || playerGroup != GetLootRecipientGroup()) // if we dont have a group we arent the recipient
1360 return false; // if creature doesnt have group bound it means it was solo killed by someone else
1361
1362 return true;
1363}
Group * GetLootRecipientGroup() const
Definition: Creature.cpp:1285
Definition: Group.h:168

References Player::GetGroup(), Object::GetGUID(), GetLootRecipientGroup(), and m_lootRecipient.

Referenced by Unit::BuildValuesUpdate().

◆ IsTrigger()

◆ IsValidTrainerForPlayer()

bool Creature::IsValidTrainerForPlayer ( Player player,
uint32 npcFlags = nullptr 
) const
1238{
1239 if (!IsTrainer())
1240 {
1241 return false;
1242 }
1243
1245 {
1246 case TRAINER_TYPE_CLASS:
1247 case TRAINER_TYPE_PETS:
1249 {
1250 if (npcFlags)
1251 *npcFlags &= ~UNIT_NPC_FLAG_TRAINER_CLASS;
1252
1253 return false;
1254 }
1255 break;
1258 {
1259 return false;
1260 }
1261 break;
1264 {
1265 if (npcFlags)
1266 *npcFlags &= ~UNIT_NPC_FLAG_TRAINER_PROFESSION;
1267
1268 return false;
1269 }
1270 break;
1271 default:
1272 break;
1273 }
1274
1275 return true;
1276}
@ TRAINER_TYPE_TRADESKILLS
Definition: SharedDefines.h:2591
@ TRAINER_TYPE_PETS
Definition: SharedDefines.h:2592
@ TRAINER_TYPE_MOUNTS
Definition: SharedDefines.h:2590
uint32 trainer_spell
Definition: CreatureData.h:212
uint32 trainer_race
Definition: CreatureData.h:214
bool HasSpell(uint32 spell) const override
Definition: Player.cpp:3818
bool IsTrainer() const
Definition: Unit.h:1652
uint8 getRace(bool original=false) const
Definition: Unit.cpp:21185

References Unit::getClass(), Unit::getRace(), Player::HasSpell(), Unit::IsTrainer(), m_creatureInfo, CreatureTemplate::trainer_class, CreatureTemplate::trainer_race, CreatureTemplate::trainer_spell, CreatureTemplate::trainer_type, TRAINER_TYPE_CLASS, TRAINER_TYPE_MOUNTS, TRAINER_TYPE_PETS, and TRAINER_TYPE_TRADESKILLS.

Referenced by Unit::BuildValuesUpdate().

◆ isVendorWithIconSpeak()

bool Creature::isVendorWithIconSpeak ( ) const
1657{
1659}
@ UNIT_NPC_FLAG_VENDOR
Definition: Unit.h:523
std::string IconName
Definition: CreatureData.h:186
uint32 npcflag
Definition: CreatureData.h:379

References CreatureTemplate::IconName, m_creatureData, m_creatureInfo, CreatureData::npcflag, and UNIT_NPC_FLAG_VENDOR.

◆ isWorldBoss()

◆ LoadCreatureFromDB()

bool Creature::LoadCreatureFromDB ( ObjectGuid::LowType  guid,
Map map,
bool  addToMap = true,
bool  gridLoad = false,
bool  allowDuplicate = false 
)
1662{
1663 if (!allowDuplicate)
1664 {
1665 // If an alive instance of this spawnId is already found, skip creation
1666 // If only dead instance(s) exist, despawn them and spawn a new (maybe also dead) version
1667 const auto creatureBounds = map->GetCreatureBySpawnIdStore().equal_range(spawnId);
1668 std::vector <Creature*> despawnList;
1669
1670 if (creatureBounds.first != creatureBounds.second)
1671 {
1672 for (auto itr = creatureBounds.first; itr != creatureBounds.second; ++itr)
1673 {
1674 if (itr->second->IsAlive())
1675 {
1676 LOG_DEBUG("maps", "Would have spawned {} but {} already exists", spawnId, creatureBounds.first->second->GetGUID().ToString());
1677 return false;
1678 }
1679 else
1680 {
1681 despawnList.push_back(itr->second);
1682 LOG_DEBUG("maps", "Despawned dead instance of spawn {} ({})", spawnId, itr->second->GetGUID().ToString());
1683 }
1684 }
1685
1686 for (Creature* despawnCreature : despawnList)
1687 {
1688 despawnCreature->AddObjectToRemoveList();
1689 }
1690 }
1691 }
1692
1693 CreatureData const* data = sObjectMgr->GetCreatureData(spawnId);
1694 if (!data)
1695 {
1696 LOG_ERROR("sql.sql", "Creature (SpawnId: {}) not found in table `creature`, can't load. ", spawnId);
1697 return false;
1698 }
1699
1700 // xinef: fix from db
1701 if ((addToMap || gridLoad) && !data->overwrittenZ)
1702 {
1703 float tz = map->GetHeight(data->posX, data->posY, data->posZ + 1.0f, true);
1704 if (tz >= data->posZ && tz - data->posZ <= 1.0f)
1705 const_cast<CreatureData*>(data)->posZ = tz + 0.1f;
1706
1707 const_cast<CreatureData*>(data)->overwrittenZ = true;
1708 }
1709
1710 // xinef: this has to be assigned before Create function, properly loads equipment id from DB
1711 m_creatureData = data;
1712 m_spawnId = spawnId;
1713
1714 // Add to world
1715 uint32 entry = GetRandomId(data->id1, data->id2, data->id3);
1716
1717 if (!Create(map->GenerateLowGuid<HighGuid::Unit>(), map, data->phaseMask, entry, 0, data->posX, data->posY, data->posZ, data->orientation, data))
1718 return false;
1719
1720 //We should set first home position, because then AI calls home movement
1721 SetHomePosition(data->posX, data->posY, data->posZ, data->orientation);
1722
1724
1727
1729 if (m_respawnTime) // respawn on Update
1730 {
1732 if (CanFly())
1733 {
1734 float tz = map->GetHeight(GetPhaseMask(), data->posX, data->posY, data->posZ, true, MAX_FALL_DISTANCE);
1735 if (data->posZ - tz > 0.1f && Acore::IsValidMapCoord(tz))
1736 {
1737 Relocate(data->posX, data->posY, tz);
1738 }
1739 }
1740 }
1741
1742 uint32 curhealth;
1743
1744 if (!m_regenHealth)
1745 {
1746 curhealth = data->curhealth;
1747 if (curhealth)
1748 {
1749 curhealth = uint32(curhealth * _GetHealthMod(GetCreatureTemplate()->rank));
1750 if (curhealth < 1)
1751 curhealth = 1;
1752 }
1753 SetPower(POWER_MANA, data->curmana);
1754 }
1755 else
1756 {
1757 curhealth = GetMaxHealth();
1759 }
1760
1761 SetHealth(m_deathState == ALIVE ? curhealth : 0);
1762
1763 // checked at creature_template loading
1765
1766 if (addToMap && !GetMap()->AddToMap(this))
1767 return false;
1768 return true;
1769}
@ DEAD
Definition: Unit.h:319
@ ALIVE
Definition: Unit.h:316
#define MAX_FALL_DISTANCE
Definition: Map.h:165
@ POWER_MANA
Definition: SharedDefines.h:241
bool IsValidMapCoord(float c)
Definition: GridDefines.h:216
void SetHomePosition(float x, float y, float z, float o)
Definition: Creature.h:328
static float _GetHealthMod(int32 Rank)
Definition: Creature.cpp:1542
bool Create(ObjectGuid::LowType guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 vehId, float x, float y, float z, float ang, const CreatureData *data=nullptr)
Definition: Creature.cpp:1101
uint32 GetRandomId(uint32 id1, uint32 id2, uint32 id3)
Definition: Creature.cpp:3618
float wander_distance
Definition: CreatureData.h:373
uint32 phaseMask
Definition: CreatureData.h:365
uint32 spawntimesecs
Definition: CreatureData.h:372
uint8 movementType
Definition: CreatureData.h:377
uint32 id2
Definition: CreatureData.h:362
uint32 curhealth
Definition: CreatureData.h:375
float orientation
Definition: CreatureData.h:371
uint32 curmana
Definition: CreatureData.h:376
uint32 id3
Definition: CreatureData.h:363
float posY
Definition: CreatureData.h:369
float posX
Definition: CreatureData.h:368
bool overwrittenZ
Definition: CreatureData.h:384
float posZ
Definition: CreatureData.h:370
uint32 id1
Definition: CreatureData.h:361
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition: Unit.cpp:15458
uint32 GetMaxHealth() const
Definition: Unit.h:1441
DeathState m_deathState
Definition: Unit.h:2490
void SetHealth(uint32 val)
Definition: Unit.cpp:15370
uint32 GetMaxPower(Powers power) const
Definition: Unit.h:1462
float GetHeight(float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
Definition: Map.cpp:2043
time_t GetCreatureRespawnTime(ObjectGuid::LowType dbGuid) const
Definition: Map.h:571
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:632

References _GetHealthMod(), ALIVE, CanFly(), Create(), CreatureData::curhealth, CreatureData::curmana, DEAD, Map::GenerateLowGuid(), Map::GetCreatureBySpawnIdStore(), Map::GetCreatureRespawnTime(), GetCreatureTemplate(), Map::GetHeight(), WorldObject::GetMap(), Unit::GetMaxHealth(), Unit::GetMaxPower(), WorldObject::GetPhaseMask(), GetRandomId(), CreatureData::id1, CreatureData::id2, CreatureData::id3, Acore::IsValidMapCoord(), LOG_DEBUG, LOG_ERROR, m_creatureData, Unit::m_deathState, m_defaultMovementType, m_regenHealth, m_respawnDelay, m_respawnTime, m_spawnId, m_wanderDistance, MAX_FALL_DISTANCE, CreatureData::movementType, CreatureData::orientation, CreatureData::overwrittenZ, CreatureData::phaseMask, CreatureData::posX, CreatureData::posY, CreatureData::posZ, POWER_MANA, Position::Relocate(), Unit::SetHealth(), SetHomePosition(), Unit::SetPower(), sObjectMgr, CreatureData::spawntimesecs, and CreatureData::wander_distance.

Referenced by ObjectMgr::AddCreData(), MotionTransport::CreateNPCPassenger(), GameEventMgr::GameEventSpawn(), npc_commandscript::HandleNpcAddCommand(), wp_commandscript::HandleWpModifyCommand(), wp_commandscript::HandleWpShowCommand(), LoadFromDB(), and PoolGroup< T >::Spawn1Object().

◆ LoadCreaturesAddon()

bool Creature::LoadCreaturesAddon ( bool  reload = false)

Suspected correlation between UNIT_FIELD_BYTES_1, offset 3, value 0x2: If no inhabittype_fly (if no MovementFlag_DisableGravity or MovementFlag_CanFly flag found in sniffs) Check using InhabitType as movement flags are assigned dynamically basing on whether the creature is in air or not Set MovementFlag_Hover. Otherwise do nothing.

2626{
2627 CreatureAddon const* cainfo = GetCreatureAddon();
2628 if (!cainfo)
2629 return false;
2630
2631 if (cainfo->mount != 0)
2632 Mount(cainfo->mount);
2633
2634 if (cainfo->bytes1 != 0)
2635 {
2636 // 0 StandState
2637 // 1 FreeTalentPoints Pet only, so always 0 for default creature
2638 // 2 StandFlags
2639 // 3 StandMiscFlags
2640
2642 //SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_PET_TALENTS, uint8((cainfo->bytes1 >> 8) & 0xFF));
2646
2652 if (CanHover())
2654 }
2655
2656 if (cainfo->bytes2 != 0)
2657 {
2658 // 0 SheathState
2659 // 1 Bytes2Flags
2660 // 2 UnitRename Pet only, so always 0 for default creature
2661 // 3 ShapeshiftForm Must be determined/set by shapeshift spell/aura
2662
2663 SetByteValue(UNIT_FIELD_BYTES_2, 0, uint8(cainfo->bytes2 & 0xFF));
2664 //SetByteValue(UNIT_FIELD_BYTES_2, 1, uint8((cainfo->bytes2 >> 8) & 0xFF));
2665 //SetByteValue(UNIT_FIELD_BYTES_2, 2, uint8((cainfo->bytes2 >> 16) & 0xFF));
2667 //SetByteValue(UNIT_FIELD_BYTES_2, 3, uint8((cainfo->bytes2 >> 24) & 0xFF));
2669 }
2670
2672
2673 // Check if visibility distance different
2674 if (cainfo->visibilityDistanceType != VisibilityDistanceType::Normal)
2675 {
2677 }
2678
2679 //Load Path
2680 if (cainfo->path_id != 0)
2681 {
2683 setActive(true);
2684 m_path_id = cainfo->path_id;
2685 }
2686
2687 if (!cainfo->auras.empty())
2688 {
2689 for (std::vector<uint32>::const_iterator itr = cainfo->auras.begin(); itr != cainfo->auras.end(); ++itr)
2690 {
2691 SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(*itr);
2692 if (!AdditionalSpellInfo)
2693 {
2694 LOG_ERROR("sql.sql", "Creature ({}) has wrong spell {} defined in `auras` field.", GetGUID().ToString(), *itr);
2695 continue;
2696 }
2697
2698 // skip already applied aura
2699 if (HasAura(*itr))
2700 {
2701 if (!reload)
2702 LOG_ERROR("sql.sql", "Creature ({}) has duplicate aura (spell {}) in `auras` field.", GetGUID().ToString(), *itr);
2703
2704 continue;
2705 }
2706
2707 AddAura(*itr, this);
2708 LOG_DEBUG("entities.unit", "Spell: {} added to creature ({})", *itr, GetGUID().ToString());
2709 }
2710 }
2711
2712 return true;
2713}
@ UNIT_NPC_EMOTESTATE
Definition: UpdateFields.h:140
@ UNIT_FIELD_BYTES_1
Definition: UpdateFields.h:131
@ UNIT_FIELD_BYTES_2
Definition: UpdateFields.h:161
@ MOVEMENTFLAG_HOVER
Definition: Unit.h:582
@ UNIT_BYTES_1_OFFSET_ANIM_TIER
Definition: Unit.h:47
@ UNIT_BYTES_1_OFFSET_PET_TALENTS
Definition: Unit.h:45
@ UNIT_BYTES_1_OFFSET_STAND_STATE
Definition: Unit.h:44
@ UNIT_BYTES_1_OFFSET_VIS_FLAG
Definition: Unit.h:46
@ CONFIG_SET_ALL_CREATURES_WITH_WAYPOINT_MOVEMENT_ACTIVE
Definition: IWorld.h:164
bool CanHover() const
Definition: Creature.h:84
CreatureAddon const * GetCreatureAddon() const
Definition: Creature.cpp:2612
std::vector< uint32 > auras
Definition: CreatureData.h:435
uint32 mount
Definition: CreatureData.h:431
uint32 emote
Definition: CreatureData.h:434
uint32 path_id
Definition: CreatureData.h:430
VisibilityDistanceType visibilityDistanceType
Definition: CreatureData.h:436
uint32 bytes1
Definition: CreatureData.h:432
uint32 bytes2
Definition: CreatureData.h:433
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:650
void setActive(bool isActiveObject)
Definition: Object.cpp:1085
void SetVisibilityDistanceOverride(VisibilityDistanceType type)
Definition: Object.cpp:1122
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:19031
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5610
void Mount(uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
Definition: Unit.cpp:13376
void AddUnitMovementFlag(uint32 f)
Definition: Unit.h:2272

References Unit::AddAura(), Unit::AddUnitMovementFlag(), CreatureAddon::auras, CreatureAddon::bytes1, CreatureAddon::bytes2, CanHover(), CONFIG_SET_ALL_CREATURES_WITH_WAYPOINT_MOVEMENT_ACTIVE, CreatureAddon::emote, GetCreatureAddon(), Object::GetGUID(), Unit::HasAura(), LOG_DEBUG, LOG_ERROR, m_path_id, CreatureAddon::mount, Unit::Mount(), MOVEMENTFLAG_HOVER, CreatureAddon::path_id, WorldObject::setActive(), Object::SetByteValue(), Object::SetUInt32Value(), WorldObject::SetVisibilityDistanceOverride(), sSpellMgr, sWorld, Position::ToString(), UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTES_1_OFFSET_PET_TALENTS, UNIT_BYTES_1_OFFSET_STAND_STATE, UNIT_BYTES_1_OFFSET_VIS_FLAG, UNIT_FIELD_BYTES_1, UNIT_FIELD_BYTES_2, UNIT_NPC_EMOTESTATE, and CreatureAddon::visibilityDistanceType.

Referenced by CreatureAI::_EnterEvadeMode(), Create(), HomeMovementGenerator< Creature >::DoFinalize(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode(), npc_pet_hunter_snake_trap::EnterEvadeMode(), hyjalAI::EnterEvadeMode(), boss_urom::boss_uromAI::LeaveCombat(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::Reset(), npc_valithria_cloud::npc_valithria_cloudAI::Reset(), and setDeathState().

◆ LoadEquipment()

void Creature::LoadEquipment ( int8  id = 1,
bool  force = false 
)
1778{
1779 if (id == 0)
1780 {
1781 if (force)
1782 {
1783 for (uint8 i = 0; i < MAX_EQUIPMENT_ITEMS; ++i)
1785 m_equipmentId = 0;
1786 }
1787 return;
1788 }
1789
1790 EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(GetEntry(), id);
1791 if (!einfo)
1792 return;
1793
1794 m_equipmentId = id;
1795 for (uint8 i = 0; i < 3; ++i)
1797}
#define MAX_EQUIPMENT_ITEMS
Definition: CreatureData.h:39
@ UNIT_VIRTUAL_ITEM_SLOT_ID
Definition: UpdateFields.h:116
Definition: CreatureData.h:349
uint32 ItemEntry[MAX_EQUIPMENT_ITEMS]
Definition: CreatureData.h:350

References Object::GetEntry(), EquipmentInfo::ItemEntry, m_equipmentId, MAX_EQUIPMENT_ITEMS, Object::SetUInt32Value(), sObjectMgr, and UNIT_VIRTUAL_ITEM_SLOT_ID.

Referenced by boss_thekal::boss_thekalAI::CheckPhaseTransition(), boss_twinemperorsAI::DoAction(), spell_marli_transform::HandleApply(), spell_boss_magus_telestra_summon_telestra_clones::spell_boss_magus_telestra_summon_telestra_clones_AuraScript::HandleApply(), spell_marli_transform::HandleRemove(), spell_boss_magus_telestra_summon_telestra_clones::spell_boss_magus_telestra_summon_telestra_clones_AuraScript::HandleRemove(), spell_death_knight_initiate_visual::HandleScriptEffect(), InitEntry(), npc_unworthy_initiate::npc_unworthy_initiateAI::MovementInform(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), spell_illidan_demon_transform1::spell_illidan_demon_transform1_AuraScript::OnPeriodic(), spell_illidan_demon_transform2::spell_illidan_demon_transform2_AuraScript::OnPeriodic(), boss_mr_smite::boss_mr_smiteAI::Reset(), npc_unworthy_initiate::npc_unworthy_initiateAI::Reset(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::Reset(), boss_thekal::boss_thekalAI::Reset(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::Reset(), boss_illidan_stormrage::boss_illidan_stormrageAI::Reset(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::Reset(), Respawn(), ScriptedAI::SetEquipmentSlots(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::SummonedCreatureDies(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_partygoer_pather::UpdateAI(), npc_partygoer::UpdateAI(), npc_forest_frog::npc_forest_frogAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::UpdateAI(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI(), and npc_koltira_deathweaver::npc_koltira_deathweaverAI::WaypointReached().

◆ LoadFromDB()

bool Creature::LoadFromDB ( ObjectGuid::LowType  guid,
Map map,
bool  allowDuplicate = false 
)
inline
211{ return LoadCreatureFromDB(guid, map, false, true, allowDuplicate); }
bool LoadCreatureFromDB(ObjectGuid::LowType guid, Map *map, bool addToMap=true, bool gridLoad=false, bool allowDuplicate=false)
Definition: Creature.cpp:1661

References LoadCreatureFromDB().

◆ LoadPath()

◆ LoadSpellTemplateImmunity()

void Creature::LoadSpellTemplateImmunity ( )
2152{
2153 // uint32 max used for "spell id", the immunity system will not perform SpellInfo checks against invalid spells
2154 // used so we know which immunities were loaded from template
2155 static uint32 const placeholderSpellId = std::numeric_limits<uint32>::max();
2156
2157 // unapply template immunities (in case we're updating entry)
2158 for (uint8 i = SPELL_SCHOOL_NORMAL; i <= SPELL_SCHOOL_ARCANE; ++i)
2159 {
2160 ApplySpellImmune(placeholderSpellId, IMMUNITY_SCHOOL, i, false);
2161 }
2162
2163 // don't inherit immunities for hunter pets
2164 if (GetOwnerGUID().IsPlayer() && IsHunterPet())
2165 {
2166 return;
2167 }
2168
2169 if (uint8 mask = GetCreatureTemplate()->SpellSchoolImmuneMask)
2170 {
2171 for (uint8 i = SPELL_SCHOOL_NORMAL; i <= SPELL_SCHOOL_ARCANE; ++i)
2172 {
2173 if (mask & (1 << i))
2174 {
2175 ApplySpellImmune(placeholderSpellId, IMMUNITY_SCHOOL, 1 << i, true);
2176 }
2177 }
2178 }
2179}
@ SPELL_SCHOOL_ARCANE
Definition: SharedDefines.h:261
@ IMMUNITY_SCHOOL
Definition: SharedDefines.h:1368
bool IsHunterPet() const
Definition: Unit.h:1414
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
Definition: Unit.cpp:13300

References Unit::ApplySpellImmune(), GetCreatureTemplate(), Unit::GetOwnerGUID(), IMMUNITY_SCHOOL, Unit::IsHunterPet(), Object::IsPlayer(), SPELL_SCHOOL_ARCANE, and SPELL_SCHOOL_NORMAL.

Referenced by UpdateEntry().

◆ LowerPlayerDamageReq()

void Creature::LowerPlayerDamageReq ( uint32  unDamage,
bool  damagedByPlayer = true 
)
3690{
3691 if (_playerDamageReq)
3692 _playerDamageReq > unDamage ? _playerDamageReq -= unDamage : _playerDamageReq = 0;
3693
3694 if (!_damagedByPlayer)
3695 {
3696 _damagedByPlayer = damagedByPlayer;
3697 }
3698}

References _damagedByPlayer, and _playerDamageReq.

Referenced by boss_viscidus::boss_viscidus(), boss_viscidus::DamageTaken(), boss_buru::DamageTaken(), boss_twinemperorsAI::DamageTaken(), npc_artorius::npc_artoriusAI::DamageTaken(), npc_franklin::npc_franklinAI::DamageTaken(), npc_heated_battle::npc_heated_battleAI::DamageTaken(), boss_razuvious::boss_razuviousAI::DamageTaken(), boss_kologarn::boss_kologarnAI::DamageTaken(), Unit::DealDamage(), boss_xt002::boss_xt002AI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), boss_ichoron::boss_ichoronAI::DoAction(), Spell::DoAllEffectOnTarget(), misc_commandscript::HandleDamageCommand(), misc_commandscript::HandleDieCommand(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::HealReceived(), boss_twin_valkyrAI::JustEngagedWith(), boss_sister_svalna::boss_sister_svalnaAI::JustEngagedWith(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::JustEngagedWith(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustEngagedWith(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustEngagedWith(), npc_dirt_mound::JustSummoned(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustSummoned(), boss_viscidus::SummonedCreatureDies(), npc_boneguard_footman::npc_boneguard_footmanAI::UpdateAI(), npc_phase_hunter::npc_phase_hunterAI::UpdateAI(), and npc_target_dummy::npc_target_dummyAI::UpdateAI().

◆ ModifyThreatPercentTemp()

void Creature::ModifyThreatPercentTemp ( Unit victim,
int32  percent,
Milliseconds  duration 
)
3669{
3670 if (victim)
3671 {
3672 float currentThreat = GetThreatMgr().GetThreat(victim);
3673
3674 if (percent != 0.0f)
3675 {
3676 GetThreatMgr().ModifyThreatByPercent(victim, percent);
3677 }
3678
3679 TemporaryThreatModifierEvent* pEvent = new TemporaryThreatModifierEvent(*this, victim->GetGUID(), currentThreat);
3680 m_Events.AddEvent(pEvent, m_Events.CalculateTime(duration.count()));
3681 }
3682}
float GetThreat(Unit *victim, bool alsoSearchOfflineList=false)
Definition: ThreatMgr.cpp:526
void ModifyThreatByPercent(Unit *victim, int32 percent)
Definition: ThreatMgr.cpp:509
Definition: Creature.h:519
ThreatMgr & GetThreatMgr()
Definition: Unit.h:2145

References EventProcessor::AddEvent(), EventProcessor::CalculateTime(), Object::GetGUID(), ThreatMgr::GetThreat(), Unit::GetThreatMgr(), Unit::m_Events, and ThreatMgr::ModifyThreatByPercent().

◆ Motion_Initialize()

void Creature::Motion_Initialize ( )
1087{
1088 if (!m_formation)
1090 else if (m_formation->GetLeader() == this)
1091 {
1092 m_formation->FormationReset(false, true);
1094 }
1095 else if (m_formation->IsFormed())
1096 GetMotionMaster()->MoveIdle(); //wait the order of leader
1097 else
1099}
Creature * GetLeader() const
Definition: CreatureGroups.h:98
void FormationReset(bool dismiss, bool initMotionMaster)
Definition: CreatureGroups.cpp:334
bool IsFormed() const
Definition: CreatureGroups.h:102
void Initialize()
Definition: MotionMaster.cpp:72
void MoveIdle()
Definition: MotionMaster.cpp:231

References CreatureGroup::FormationReset(), CreatureGroup::GetLeader(), Unit::GetMotionMaster(), MotionMaster::Initialize(), CreatureGroup::IsFormed(), m_formation, and MotionMaster::MoveIdle().

Referenced by AddToWorld(), Pet::AddToWorld(), and setDeathState().

◆ ProhibitSpellSchool()

void Creature::ProhibitSpellSchool ( SpellSchoolMask  idSchoolMask,
uint32  unTimeMs 
)
overridevirtual

Reimplemented from Unit.

2730{
2731 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
2732 {
2733 if (idSchoolMask & (1 << i))
2734 {
2735 m_ProhibitSchoolTime[i] = GameTime::GetGameTimeMS().count() + unTimeMs;
2736 }
2737 }
2738}

References GameTime::GetGameTimeMS(), m_ProhibitSchoolTime, MAX_SPELL_SCHOOL, and SPELL_SCHOOL_NORMAL.

◆ reachWithSpellAttack()

SpellInfo const * Creature::reachWithSpellAttack ( Unit victim)
2219{
2220 if (!victim)
2221 return nullptr;
2222
2223 for (uint32 i = 0; i < MAX_CREATURE_SPELLS; ++i)
2224 {
2225 if (!m_spells[i])
2226 continue;
2227 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]);
2228 if (!spellInfo)
2229 {
2230 LOG_ERROR("entities.unit", "WORLD: unknown spell id {}", m_spells[i]);
2231 continue;
2232 }
2233
2234 bool bcontinue = true;
2235 for (uint32 j = 0; j < MAX_SPELL_EFFECTS; j++)
2236 {
2237 if ((spellInfo->Effects[j].Effect == SPELL_EFFECT_SCHOOL_DAMAGE) ||
2238 (spellInfo->Effects[j].Effect == SPELL_EFFECT_INSTAKILL) ||
2239 (spellInfo->Effects[j].Effect == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) ||
2240 (spellInfo->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH)
2241 )
2242 {
2243 bcontinue = false;
2244 break;
2245 }
2246 }
2247 if (bcontinue)
2248 continue;
2249
2250 if (spellInfo->ManaCost > GetPower(POWER_MANA))
2251 continue;
2252 float range = spellInfo->GetMaxRange(false);
2253 float minrange = spellInfo->GetMinRange(false);
2254 float dist = GetDistance(victim);
2255 if (dist > range || dist < minrange)
2256 continue;
2258 continue;
2260 continue;
2261 return spellInfo;
2262 }
2263 return nullptr;
2264}
@ UNIT_FLAG_PACIFIED
Definition: Unit.h:465
@ UNIT_FLAG_SILENCED
Definition: Unit.h:461
@ SPELL_EFFECT_HEALTH_LEECH
Definition: SharedDefines.h:759
@ SPELL_EFFECT_ENVIRONMENTAL_DAMAGE
Definition: SharedDefines.h:757
@ SPELL_EFFECT_SCHOOL_DAMAGE
Definition: SharedDefines.h:752
@ SPELL_EFFECT_INSTAKILL
Definition: SharedDefines.h:751
@ SPELL_PREVENTION_TYPE_SILENCE
Definition: SharedDefines.h:1526
@ SPELL_PREVENTION_TYPE_PACIFY
Definition: SharedDefines.h:1527
float GetDistance(WorldObject const *obj) const
Definition: Object.cpp:1245
uint32 GetPower(Powers power) const
Definition: Unit.h:1461
uint32 PreventionType
Definition: SpellInfo.h:388
float GetMinRange(bool positive=false) const
Definition: SpellInfo.cpp:2297
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition: SpellInfo.h:391
float GetMaxRange(bool positive=false, Unit *caster=nullptr, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:2306
uint32 ManaCost
Definition: SpellInfo.h:361

References SpellInfo::Effects, WorldObject::GetDistance(), SpellInfo::GetMaxRange(), SpellInfo::GetMinRange(), Unit::GetPower(), Unit::HasUnitFlag(), LOG_ERROR, m_spells, SpellInfo::ManaCost, MAX_CREATURE_SPELLS, MAX_SPELL_EFFECTS, POWER_MANA, SpellInfo::PreventionType, SPELL_EFFECT_ENVIRONMENTAL_DAMAGE, SPELL_EFFECT_HEALTH_LEECH, SPELL_EFFECT_INSTAKILL, SPELL_EFFECT_SCHOOL_DAMAGE, SPELL_PREVENTION_TYPE_PACIFY, SPELL_PREVENTION_TYPE_SILENCE, sSpellMgr, UNIT_FLAG_PACIFIED, and UNIT_FLAG_SILENCED.

◆ reachWithSpellCure()

SpellInfo const * Creature::reachWithSpellCure ( Unit victim)
2267{
2268 if (!victim)
2269 return nullptr;
2270
2271 for (uint32 i = 0; i < MAX_CREATURE_SPELLS; ++i)
2272 {
2273 if (!m_spells[i])
2274 continue;
2275 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]);
2276 if (!spellInfo)
2277 {
2278 LOG_ERROR("entities.unit", "WORLD: unknown spell id {}", m_spells[i]);
2279 continue;
2280 }
2281
2282 bool bcontinue = true;
2283 for (uint32 j = 0; j < MAX_SPELL_EFFECTS; j++)
2284 {
2285 if ((spellInfo->Effects[j].Effect == SPELL_EFFECT_HEAL))
2286 {
2287 bcontinue = false;
2288 break;
2289 }
2290 }
2291 if (bcontinue)
2292 continue;
2293
2294 if (spellInfo->ManaCost > GetPower(POWER_MANA))
2295 continue;
2296
2297 float range = spellInfo->GetMaxRange(true);
2298 float minrange = spellInfo->GetMinRange(true);
2299 float dist = GetDistance(victim);
2300 //if (!isInFront(victim, range) && spellInfo->AttributesEx)
2301 // continue;
2302 if (dist > range || dist < minrange)
2303 continue;
2305 continue;
2307 continue;
2308 return spellInfo;
2309 }
2310 return nullptr;
2311}

References SpellInfo::Effects, WorldObject::GetDistance(), SpellInfo::GetMaxRange(), SpellInfo::GetMinRange(), Unit::GetPower(), Unit::HasUnitFlag(), LOG_ERROR, m_spells, SpellInfo::ManaCost, MAX_CREATURE_SPELLS, MAX_SPELL_EFFECTS, POWER_MANA, SpellInfo::PreventionType, SPELL_EFFECT_HEAL, SPELL_PREVENTION_TYPE_PACIFY, SPELL_PREVENTION_TYPE_SILENCE, sSpellMgr, UNIT_FLAG_PACIFIED, and UNIT_FLAG_SILENCED.

◆ RefreshSwimmingFlag()

void Creature::RefreshSwimmingFlag ( bool  recheck = false)
3167{
3168 if (!_isMissingSwimmingFlagOutOfCombat || recheck)
3170
3171 // Check if the creature has UNIT_FLAG_SWIMMING and add it if it's missing
3172 // Creatures must be able to chase a target in water if they can enter water
3175}
@ UNIT_FLAG_SWIMMING
Definition: Unit.h:463
bool CanEnterWater() const override
Definition: Creature.cpp:3158

References _isMissingSwimmingFlagOutOfCombat, CanEnterWater(), Unit::HasUnitFlag(), Unit::SetUnitFlag(), and UNIT_FLAG_SWIMMING.

◆ Regenerate()

void Creature::Regenerate ( Powers  power)
protected
925{
926 uint32 curValue = GetPower(power);
927 uint32 maxValue = GetMaxPower(power);
928
929 // Xinef: implement power regeneration flag
931 return;
932
933 if (!m_regenPower)
934 {
935 return;
936 }
937
938 if (curValue >= maxValue)
939 return;
940
941 float addvalue = 0.0f;
942
943 switch (power)
944 {
945 case POWER_FOCUS:
946 {
947 // For hunter pets.
948 addvalue = 24 * sWorld->getRate(RATE_POWER_FOCUS);
949 break;
950 }
951 case POWER_ENERGY:
952 {
953 // For deathknight's ghoul.
954 addvalue = 20;
955 break;
956 }
957 case POWER_MANA:
958 {
959 // Combat and any controlled creature
961 {
963 {
964 addvalue = uint32((GetStat(STAT_SPIRIT) / (IsUnderLastManaUseEffect() ? 8.0f : 5.0f) + 17.0f));
965 }
966 else if (!IsUnderLastManaUseEffect())
967 {
968 float ManaIncreaseRate = sWorld->getRate(RATE_POWER_MANA);
969 float Spirit = GetStat(STAT_SPIRIT);
970
971 addvalue = uint32((Spirit / 5.0f + 17.0f) * ManaIncreaseRate);
972 }
973 }
974 else
975 addvalue = maxValue / 3;
976 break;
977 }
978 default:
979 return;
980 }
981
982 // Apply modifiers (if any).
984 for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
985 if (Powers((*i)->GetMiscValue()) == power)
986 AddPct(addvalue, (*i)->GetAmount());
987
989
990 ModifyPower(power, int32(addvalue));
991}
T AddPct(T &base, U pct)
Definition: Util.h:67
constexpr Milliseconds PET_FOCUS_REGEN_INTERVAL
Definition: CreatureData.h:41
@ NPC_WATER_ELEMENTAL_TEMP
Definition: PetDefines.h:104
@ NPC_IMP
Definition: PetDefines.h:95
@ NPC_WATER_ELEMENTAL_PERM
Definition: PetDefines.h:106
@ UNIT_FLAG2_REGENERATE_POWER
Definition: Unit.h:498
@ SPELL_AURA_MOD_POWER_REGEN
Definition: SpellAuraDefines.h:148
@ SPELL_AURA_MOD_POWER_REGEN_PERCENT
Definition: SpellAuraDefines.h:173
@ RATE_POWER_MANA
Definition: IWorld.h:422
@ RATE_POWER_FOCUS
Definition: IWorld.h:427
Powers
Definition: SharedDefines.h:240
@ POWER_ENERGY
Definition: SharedDefines.h:244
@ POWER_FOCUS
Definition: SharedDefines.h:243
@ STAT_SPIRIT
Definition: SharedDefines.h:234
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition: Unit.cpp:14051
bool IsUnderLastManaUseEffect() const
Definition: Unit.cpp:17414
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1967
bool HasUnitFlag2(UnitFlags2 flags) const
Definition: Unit.h:1486
int32 GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const
Definition: Unit.cpp:5926
std::list< AuraEffect * > AuraEffectList
Definition: Unit.h:1306

References AddPct(), CREATURE_REGEN_INTERVAL, Unit::GetAuraEffectsByType(), Unit::GetCharmerOrOwnerGUID(), Object::GetEntry(), Unit::GetMaxPower(), Unit::GetOwnerGUID(), Unit::GetPower(), Unit::GetStat(), Unit::GetTotalAuraModifierByMiscValue(), Unit::HasUnitFlag2(), IN_MILLISECONDS, Unit::IsInCombat(), Object::IsPlayer(), Unit::IsUnderLastManaUseEffect(), m_regenPower, Unit::ModifyPower(), NPC_IMP, NPC_WATER_ELEMENTAL_PERM, NPC_WATER_ELEMENTAL_TEMP, PET_FOCUS_REGEN_INTERVAL, POWER_ENERGY, POWER_FOCUS, POWER_MANA, RATE_POWER_FOCUS, RATE_POWER_MANA, SPELL_AURA_MOD_POWER_REGEN, SPELL_AURA_MOD_POWER_REGEN_PERCENT, STAT_SPIRIT, sWorld, and UNIT_FLAG2_REGENERATE_POWER.

Referenced by Pet::Update(), and Update().

◆ RegenerateHealth()

void Creature::RegenerateHealth ( )
protected
994{
996 return;
997
998 uint32 curValue = GetHealth();
999 uint32 maxValue = GetMaxHealth();
1000
1001 if (curValue >= maxValue)
1002 return;
1003
1004 uint32 addvalue = 0;
1005
1006 // Not only pet, but any controlled creature
1007 // Xinef: fix polymorph rapid regen
1009 addvalue = maxValue / 3;
1010 else //if (GetCharmerOrOwnerGUID())
1011 {
1012 float HealthIncreaseRate = sWorld->getRate(RATE_HEALTH);
1013 float Spirit = GetStat(STAT_SPIRIT);
1014
1015 if (GetPower(POWER_MANA) > 0)
1016 addvalue = uint32(Spirit * 0.25 * HealthIncreaseRate);
1017 else
1018 addvalue = uint32(Spirit * 0.80 * HealthIncreaseRate);
1019 }
1020
1021 // Apply modifiers (if any).
1023 for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
1024 AddPct(addvalue, (*i)->GetAmount());
1025
1027
1028 ModifyHealth(addvalue);
1029}
@ SPELL_AURA_MOD_HEALTH_REGEN_PERCENT
Definition: SpellAuraDefines.h:151
@ SPELL_AURA_MOD_REGEN
Definition: SpellAuraDefines.h:147
@ RATE_HEALTH
Definition: IWorld.h:421
bool isRegeneratingHealth()
Definition: Creature.h:309
int32 ModifyHealth(int32 val)
Definition: Unit.cpp:13993
bool IsPolymorphed() const
Definition: Unit.cpp:16915
uint32 GetHealth() const
Definition: Unit.h:1440

References AddPct(), CREATURE_REGEN_INTERVAL, Unit::GetAuraEffectsByType(), Unit::GetCharmerOrOwnerGUID(), Unit::GetHealth(), Unit::GetMaxHealth(), Unit::GetPower(), Unit::GetStat(), Unit::GetTotalAuraModifier(), IN_MILLISECONDS, Unit::IsPolymorphed(), isRegeneratingHealth(), Unit::ModifyHealth(), POWER_MANA, RATE_HEALTH, SPELL_AURA_MOD_HEALTH_REGEN_PERCENT, SPELL_AURA_MOD_REGEN, STAT_SPIRIT, and sWorld.

Referenced by Update().

◆ ReleaseFocus()

void Creature::ReleaseFocus ( Spell const *  focusSpell)
3460{
3461 // focused to something else
3462 if (focusSpell != _focusSpell)
3463 return;
3464
3465 _focusSpell = nullptr;
3466 if (Unit* victim = GetVictim())
3467 SetGuidValue(UNIT_FIELD_TARGET, victim->GetGUID());
3468 else
3470
3471 if (focusSpell->GetSpellInfo()->HasAttribute(SPELL_ATTR5_AI_DOESNT_FACE_TARGET))
3473}
void ClearUnitState(uint32 f)
Definition: Unit.h:1399

References _focusSpell, Unit::ClearUnitState(), ObjectGuid::Empty, Spell::GetSpellInfo(), Unit::GetVictim(), SpellInfo::HasAttribute(), Object::SetGuidValue(), SPELL_ATTR5_AI_DOESNT_FACE_TARGET, UNIT_FIELD_TARGET, and UNIT_STATE_ROTATING.

◆ RemoveCorpse()

void Creature::RemoveCorpse ( bool  setSpawnTime = true,
bool  skipVisibility = false 
)
348{
349 if (getDeathState() != CORPSE)
350 return;
351
355 if (!skipVisibility) // pussywizard
356 DestroyForNearbyPlayers(); // pussywizard: previous UpdateObjectVisibility()
357 loot.clear();
358 uint32 respawnDelay = m_respawnDelay;
359 if (IsAIEnabled)
360 AI()->CorpseRemoved(respawnDelay);
361
362 // Should get removed later, just keep "compatibility" with scripts
363 if (setSpawnTime)
364 {
365 m_respawnTime = GameTime::GetGameTime().count() + respawnDelay;
366 //SaveRespawnTime();
367 }
368
369 float x, y, z, o;
370 GetRespawnPosition(x, y, z, &o);
371 SetHomePosition(x, y, z, o);
372 SetPosition(x, y, z, o);
373
374 // xinef: relocate notifier
375 m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f);
376
377 // pussywizard: if corpse was removed during falling then the falling will continue after respawn, so stop falling is such case
378 if (IsFalling())
379 StopMoving();
380}
@ CORPSE
Definition: Unit.h:318
virtual void CorpseRemoved(uint32 &)
== Triggered Actions Requested ==================
Definition: CreatureAI.h:188
void GetRespawnPosition(float &x, float &y, float &z, float *ori=nullptr, float *dist=nullptr) const
Definition: Creature.cpp:2844
void SetPosition(float x, float y, float z, float o)
Definition: Creature.cpp:3055
DeathState getDeathState()
Definition: Unit.h:1811
void StopMoving()
Definition: Unit.cpp:16824
Position m_last_notify_position
Definition: Unit.h:2409
void RemoveAllAuras()
Definition: Unit.cpp:5239
bool IsFalling() const
Definition: Unit.cpp:20121
void clear()
Definition: LootMgr.h:343

References AI(), Loot::clear(), CORPSE, CreatureAI::CorpseRemoved(), DEAD, WorldObject::DestroyForNearbyPlayers(), Unit::getDeathState(), GameTime::GetGameTime(), GetRespawnPosition(), Unit::IsAIEnabled, Unit::IsFalling(), loot, m_corpseRemoveTime, Unit::m_last_notify_position, m_respawnDelay, m_respawnTime, Position::Relocate(), Unit::RemoveAllAuras(), setDeathState(), SetHomePosition(), SetPosition(), and Unit::StopMoving().

Referenced by OPvPCapturePoint::DelCreature(), DisappearAndDie(), RespawnEvent::Execute(), ForcedDespawn(), AuraEffect::HandleAuraControlVehicle(), boss_skeram::JustDied(), npc_qiraj_war_spawn::npc_qiraj_war_spawnAI::JustDied(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), npc_illidari_spawn::npc_illidari_spawnAI::JustDied(), npc_nether_drake::npc_nether_drakeAI::MovementInform(), npc_enslaved_netherwing_drake::npc_enslaved_netherwing_drakeAI::MovementInform(), ValithriaDespawner::operator()(), Respawn(), npc_simone::npc_simoneAI::RespawnPet(), Update(), npc_towering_infernal::npc_towering_infernalAI::UpdateAI(), npc_lesser_doomguard::npc_lesser_doomguardAI::UpdateAI(), npc_abomination::npc_abominationAI::WaypointReached(), and npc_ghoul::npc_ghoulAI::WaypointReached().

◆ RemoveFromWorld()

void Creature::RemoveFromWorld ( )
overridevirtual

Reimplemented from Object.

Reimplemented in TempSummon, Minion, Puppet, and Pet.

294{
295 if (IsInWorld())
296 {
297 sScriptMgr->OnCreatureRemoveWorld(this);
298
299 if (GetZoneScript())
301
302 if (m_formation)
303 sFormationMgr->RemoveCreatureFromGroup(m_formation, this);
304
305 if (Transport* transport = GetTransport())
306 transport->RemovePassenger(this, true);
307
309
310 if (m_spawnId)
311 Acore::Containers::MultimapErasePair(GetMap()->GetCreatureBySpawnIdStore(), m_spawnId, this);
312
314 }
315}
#define sFormationMgr
Definition: CreatureGroups.h:126
void MultimapErasePair(M< K, V, Rest... > &multimap, K const &key, V const &value)
Definition: Containers.h:228
bool Remove(KEY_TYPE const &handle)
Definition: TypeContainer.h:141
Definition: Transport.h:29
void RemoveFromWorld() override
Definition: Unit.cpp:15588
virtual void OnCreatureRemove(Creature *)
Definition: ZoneScript.h:36

References Object::GetGUID(), WorldObject::GetMap(), Map::GetObjectsStore(), WorldObject::GetTransport(), WorldObject::GetZoneScript(), Object::IsInWorld(), m_formation, m_spawnId, Acore::Containers::MultimapErasePair(), ZoneScript::OnCreatureRemove(), TypeUnorderedMapContainer< OBJECT_TYPES, KEY_TYPE >::Remove(), Unit::RemoveFromWorld(), sFormationMgr, and sScriptMgr.

Referenced by TempSummon::RemoveFromWorld().

◆ RemoveLootMode()

void Creature::RemoveLootMode ( uint16  lootMode)
inline
236{ m_LootMode &= ~lootMode; }

References m_LootMode.

Referenced by boss_yoggsaron::boss_yoggsaronAI::boss_yoggsaronAI().

◆ ResetLootMode()

◆ ResetPickPocketLootTime()

void Creature::ResetPickPocketLootTime ( )
inline

References lootPickPocketRestoreTime.

Referenced by Respawn().

◆ ResetPlayerDamageReq()

◆ Respawn()

void Creature::Respawn ( bool  force = false)
2006{
2007 //DestroyForNearbyPlayers(); // pussywizard: not needed
2008
2009 if (force)
2010 {
2011 if (IsAlive())
2013 else if (getDeathState() != CORPSE)
2015 }
2016
2017 RemoveCorpse(false, false);
2018
2019 if (getDeathState() == DEAD)
2020 {
2021 if (m_spawnId)
2022 {
2024 CreatureData const* data = sObjectMgr->GetCreatureData(m_spawnId);
2025 // Respawn check if spawn has 2 entries
2026 if (data->id2)
2027 {
2028 uint32 entry = GetRandomId(data->id1, data->id2, data->id3);
2029 UpdateEntry(entry, data, true); // Select Random Entry
2030 m_defaultMovementType = MovementGeneratorType(data->movementType); // Reload Movement Type
2031 LoadEquipment(data->equipmentId); // Reload Equipment
2032 AIM_Initialize(); // Reload AI
2033 }
2034 else
2035 {
2036 if (m_originalEntry != GetEntry())
2038 }
2039 }
2040
2041 LOG_DEBUG("entities.unit", "Respawning creature {} (SpawnId: {}, {})", GetName(), GetSpawnId(), GetGUID().ToString());
2042 m_respawnTime = 0;
2044 loot.clear();
2045 SelectLevel();
2046
2048
2049 // MDic - Acidmanifesto
2050 // Do not override transform auras
2052 {
2053 uint32 displayID = GetNativeDisplayId();
2054 if (sObjectMgr->GetCreatureModelRandomGender(&displayID)) // Cancel load if no model defined
2055 {
2056 SetDisplayId(displayID);
2057 SetNativeDisplayId(displayID);
2058 }
2059 }
2060
2062
2063 //Call AI respawn virtual function
2064 if (IsAIEnabled)
2065 {
2066 //reset the AI to be sure no dirty or uninitialized values will be used till next tick
2067 AI()->Reset();
2068 TriggerJustRespawned = true;//delay event to next tick so all creatures are created on the map before processing
2069 }
2070
2071 uint32 poolid = m_spawnId ? sPoolMgr->IsPartOfAPool<Creature>(m_spawnId) : 0;
2072 if (poolid)
2073 sPoolMgr->UpdatePool<Creature>(poolid, m_spawnId);
2074
2075 //Re-initialize reactstate that could be altered by movementgenerators
2077
2079 }
2081 // xinef: relocate notifier, fixes npc appearing in corpse position after forced respawn (instead of spawn)
2082 m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f);
2084}
@ JUST_RESPAWNED
Definition: Unit.h:320
#define sPoolMgr
Definition: PoolMgr.h:163
@ SPELL_AURA_TRANSFORM
Definition: SpellAuraDefines.h:119
virtual void Reset()
Definition: UnitAI.h:195
void SelectLevel(bool changelevel=true)
Definition: Creature.cpp:1482
void InitializeReactState()
Definition: Creature.cpp:2136
void ResetPickPocketLootTime()
Definition: Creature.h:227
void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false) override
Definition: Unit.cpp:19298
void InitDefault()
Definition: MotionMaster.cpp:86

References AI(), AIM_Initialize(), Loot::clear(), CORPSE, DEAD, CreatureData::equipmentId, Unit::GetAuraEffectsByType(), Unit::getDeathState(), Object::GetEntry(), GameTime::GetGameTime(), Object::GetGUID(), WorldObject::GetMap(), Unit::GetMotionMaster(), WorldObject::GetName(), Unit::GetNativeDisplayId(), GetRandomId(), GetSpawnId(), CreatureData::id1, CreatureData::id2, CreatureData::id3, MotionMaster::InitDefault(), InitializeReactState(), Unit::IsAIEnabled, Unit::IsAlive(), JUST_DIED, JUST_RESPAWNED, LoadEquipment(), LOG_DEBUG, loot, m_defaultMovementType, Unit::m_last_notify_position, m_originalEntry, m_respawnedTime, m_respawnTime, m_spawnId, CreatureData::movementType, Position::Relocate(), RemoveCorpse(), Map::RemoveCreatureRespawnTime(), UnitAI::Reset(), ResetPickPocketLootTime(), SelectLevel(), setDeathState(), SetDisplayId(), Unit::SetNativeDisplayId(), sObjectMgr, SPELL_AURA_TRANSFORM, sPoolMgr, Position::ToString(), TriggerJustRespawned, UpdateEntry(), and Unit::UpdateObjectVisibility().

Referenced by BattlegroundAV::AddAVCreature(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), RespawnEvent::Execute(), npc_commandscript::HandleNpcMoveCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetWanderDistanceCommand(), misc_commandscript::HandleRespawnCommand(), hyjalAI::JustDied(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::JustDied(), npc_simone::npc_simoneAI::JustRespawned(), CreatureGroup::MemberEvaded(), instance_karazhan::instance_karazhan_InstanceMapScript::OnCreatureCreate(), instance_uldaman::instance_uldaman_InstanceMapScript::OnCreatureCreate(), instance_temple_of_ahnqiraj::instance_temple_of_ahnqiraj_InstanceMapScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), at_blackrock_stadium::OnTrigger(), Acore::RespawnDo::operator()(), instance_blood_furnace::instance_blood_furnace_InstanceMapScript::ResetPrisoner(), instance_molten_core::instance_molten_core_InstanceMapScript::SetBossState(), instance_naxxramas::instance_naxxramas_InstanceMapScript::SetBossState(), Battlefield::ShowNpc(), Update(), npc_escortAI::UpdateAI(), and InstanceScript::UpdateMinionState().

◆ ResumeChasingVictim()

void Creature::ResumeChasingVictim ( )
inline

Helper to resume chasing current victim.

void MoveChase(Unit *target, std::optional< ChaseRange > dist={}, std::optional< ChaseAngle > angle={})
Definition: MotionMaster.cpp:299

References Unit::GetMotionMaster(), Unit::GetVictim(), and MotionMaster::MoveChase().

Referenced by boss_laj::JustEngagedWith().

◆ SaveRespawnTime()

◆ SaveToDB() [1/2]

void Creature::SaveToDB ( )
1366{
1367 // this should only be used when the creature has already been loaded
1368 // preferably after adding to map, because mapid may not be valid otherwise
1369 CreatureData const* data = sObjectMgr->GetCreatureData(m_spawnId);
1370 if (!data)
1371 {
1372 LOG_ERROR("entities.unit", "Creature::SaveToDB failed, cannot get creature data!");
1373 return;
1374 }
1375
1377 SaveToDB(mapId, data->spawnMask, GetPhaseMask());
1378}
void SaveToDB()
Definition: Creature.cpp:1365
uint8 spawnMask
Definition: CreatureData.h:378
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:138
MotionTransport * ToMotionTransport()
Definition: GameObject.h:331
uint32 mapID
Definition: GameObjectData.h:223
struct GameObjectTemplate::@215::@230 moTransport
uint32 GetMapId() const
Definition: Position.h:276

References GameObject::GetGOInfo(), WorldLocation::GetMapId(), WorldObject::GetPhaseMask(), WorldObject::GetTransport(), LOG_ERROR, m_spawnId, GameObjectTemplate::mapID, GameObjectTemplate::moTransport, SaveToDB(), sObjectMgr, CreatureData::spawnMask, and GameObject::ToMotionTransport().

Referenced by npc_commandscript::HandleNpcAddCommand(), npc_commandscript::HandleNpcSetLevelCommand(), npc_commandscript::HandleNpcSetModelCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetPhaseCommand(), wp_commandscript::HandleWpModifyCommand(), wp_commandscript::HandleWpShowCommand(), and SaveToDB().

◆ SaveToDB() [2/2]

void Creature::SaveToDB ( uint32  mapid,
uint8  spawnMask,
uint32  phaseMask 
)
virtual

Reimplemented in TempSummon, and Pet.

1381{
1382 // update in loaded data
1383 if (!m_spawnId)
1384 m_spawnId = sObjectMgr->GenerateCreatureSpawnId();
1385
1386 CreatureData& data = sObjectMgr->NewOrExistCreatureData(m_spawnId);
1387
1388 uint32 displayId = GetNativeDisplayId();
1389 uint32 npcflag = GetNpcFlags();
1390 uint32 unit_flags = GetUnitFlags();
1391 uint32 dynamicflags = GetDynamicFlags();
1392
1393 // check if it's a custom model and if not, use 0 for displayId
1394 CreatureTemplate const* cinfo = GetCreatureTemplate();
1395 if (cinfo)
1396 {
1397 if (displayId == cinfo->Modelid1 || displayId == cinfo->Modelid2 ||
1398 displayId == cinfo->Modelid3 || displayId == cinfo->Modelid4)
1399 displayId = 0;
1400
1401 if (npcflag == cinfo->npcflag)
1402 npcflag = 0;
1403
1404 if (unit_flags == cinfo->unit_flags)
1405 unit_flags = 0;
1406
1407 if (dynamicflags == cinfo->dynamicflags)
1408 dynamicflags = 0;
1409 }
1410
1411 data.id1 = GetEntry();
1412 data.mapid = mapid;
1413 data.phaseMask = phaseMask;
1414 data.displayid = displayId;
1416 if (!GetTransport())
1417 {
1418 data.posX = GetPositionX();
1419 data.posY = GetPositionY();
1420 data.posZ = GetPositionZ();
1421 data.orientation = GetOrientation();
1422 }
1423 else
1424 {
1425 data.posX = GetTransOffsetX();
1426 data.posY = GetTransOffsetY();
1427 data.posZ = GetTransOffsetZ();
1429 }
1430
1432 // prevent add data integrity problems
1434 data.currentwaypoint = 0;
1435 data.curhealth = GetHealth();
1436 data.curmana = GetPower(POWER_MANA);
1437 // prevent add data integrity problems
1440 data.spawnMask = spawnMask;
1441 data.npcflag = npcflag;
1442 data.unit_flags = unit_flags;
1443 data.dynamicflags = dynamicflags;
1444
1445 // update in DB
1446 WorldDatabaseTransaction trans = WorldDatabase.BeginTransaction();
1447
1449 stmt->SetData(0, m_spawnId);
1450 trans->Append(stmt);
1451
1452 uint8 index = 0;
1453
1454 stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_CREATURE);
1455 stmt->SetData(index++, m_spawnId);
1456 stmt->SetData(index++, GetEntry());
1457 stmt->SetData(index++, 0);
1458 stmt->SetData(index++, 0);
1459 stmt->SetData(index++, uint16(mapid));
1460 stmt->SetData(index++, spawnMask);
1461 stmt->SetData(index++, GetPhaseMask());
1462 stmt->SetData(index++, int32(GetCurrentEquipmentId()));
1463 stmt->SetData(index++, GetPositionX());
1464 stmt->SetData(index++, GetPositionY());
1465 stmt->SetData(index++, GetPositionZ());
1466 stmt->SetData(index++, GetOrientation());
1467 stmt->SetData(index++, m_respawnDelay);
1468 stmt->SetData(index++, m_wanderDistance);
1469 stmt->SetData(index++, 0);
1470 stmt->SetData(index++, GetHealth());
1471 stmt->SetData(index++, GetPower(POWER_MANA));
1472 stmt->SetData(index++, uint8(GetDefaultMovementType()));
1473 stmt->SetData(index++, npcflag);
1474 stmt->SetData(index++, unit_flags);
1475 stmt->SetData(index++, dynamicflags);
1476 trans->Append(stmt);
1477
1478 WorldDatabase.CommitTransaction(trans);
1479 sScriptMgr->OnCreatureSaveToDB(this);
1480}
@ WORLD_INS_CREATURE
Definition: WorldDatabase.h:92
uint8 GetCurrentEquipmentId()
Definition: Creature.h:186
MovementGeneratorType GetDefaultMovementType() const override
-------—End of Pet responses methods-------—
Definition: Creature.h:86
uint32 unit_flags
Definition: CreatureData.h:207
uint32 Modelid4
Definition: CreatureData.h:183
uint32 Modelid1
Definition: CreatureData.h:180
uint32 Modelid2
Definition: CreatureData.h:181
uint32 npcflag
Definition: CreatureData.h:192
uint32 Modelid3
Definition: CreatureData.h:182
uint32 dynamicflags
Definition: CreatureData.h:209
uint32 dynamicflags
Definition: CreatureData.h:381
uint32 displayid
Definition: CreatureData.h:366
uint32 unit_flags
Definition: CreatureData.h:380
uint32 currentwaypoint
Definition: CreatureData.h:374
uint16 mapid
Definition: CreatureData.h:364
float GetTransOffsetX() const
Definition: Object.h:586
float GetTransOffsetY() const
Definition: Object.h:587
float GetTransOffsetZ() const
Definition: Object.h:588
float GetTransOffsetO() const
Definition: Object.h:589
NPCFlags GetNpcFlags() const
Definition: Unit.h:1645
UnitFlags GetUnitFlags() const
Definition: Unit.h:1479
uint32 GetDynamicFlags() const override
Definition: Unit.h:1325

References CreatureData::curhealth, CreatureData::curmana, CreatureData::currentwaypoint, CreatureData::displayid, CreatureTemplate::dynamicflags, CreatureData::dynamicflags, CreatureData::equipmentId, GetCreatureTemplate(), GetCurrentEquipmentId(), GetDefaultMovementType(), Unit::GetDynamicFlags(), Object::GetEntry(), Unit::GetHealth(), Unit::GetNativeDisplayId(), Unit::GetNpcFlags(), Position::GetOrientation(), WorldObject::GetPhaseMask(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Unit::GetPower(), WorldObject::GetTransOffsetO(), WorldObject::GetTransOffsetX(), WorldObject::GetTransOffsetY(), WorldObject::GetTransOffsetZ(), WorldObject::GetTransport(), Unit::GetUnitFlags(), CreatureData::id1, IDLE_MOTION_TYPE, m_respawnDelay, m_spawnId, m_wanderDistance, CreatureData::mapid, CreatureTemplate::Modelid1, CreatureTemplate::Modelid2, CreatureTemplate::Modelid3, CreatureTemplate::Modelid4, CreatureData::movementType, CreatureTemplate::npcflag, CreatureData::npcflag, CreatureData::orientation, CreatureData::phaseMask, CreatureData::posX, CreatureData::posY, CreatureData::posZ, POWER_MANA, RANDOM_MOTION_TYPE, PreparedStatementBase::SetData(), sObjectMgr, CreatureData::spawnMask, CreatureData::spawntimesecs, sScriptMgr, CreatureTemplate::unit_flags, CreatureData::unit_flags, CreatureData::wander_distance, WORLD_DEL_CREATURE, WORLD_INS_CREATURE, and WorldDatabase.

◆ SearchFormation()

void Creature::SearchFormation ( )
328{
329 if (IsSummon())
330 {
331 return;
332 }
333
335 if (!spawnId)
336 {
337 return;
338 }
339
340 CreatureGroupInfoType::const_iterator frmdata = sFormationMgr->CreatureGroupMap.find(spawnId);
341 if (frmdata != sFormationMgr->CreatureGroupMap.end())
342 {
343 sFormationMgr->AddCreatureToGroup(frmdata->second.leaderGUID, this);
344 }
345}
uint32 LowType
Definition: ObjectGuid.h:124

References GetSpawnId(), Unit::IsSummon(), and sFormationMgr.

Referenced by AddToWorld(), and npc_commandscript::HandleNpcAddFormationCommand().

◆ SelectLevel()

void Creature::SelectLevel ( bool  changelevel = true)
Todo:
: set UNIT_FIELD_POWER*, for some creature class case (energy, etc)
1483{
1484 CreatureTemplate const* cInfo = GetCreatureTemplate();
1485
1486 uint32 rank = IsPet() ? 0 : cInfo->rank;
1487
1488 // level
1489 uint8 minlevel = std::min(cInfo->maxlevel, cInfo->minlevel);
1490 uint8 maxlevel = std::max(cInfo->maxlevel, cInfo->minlevel);
1491 uint8 level = minlevel == maxlevel ? minlevel : urand(minlevel, maxlevel);
1492 if (changelevel)
1493 SetLevel(level);
1494
1495 CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(level, cInfo->unit_class);
1496
1497 // health
1498 float healthmod = _GetHealthMod(rank);
1499
1500 uint32 basehp = std::max<uint32>(1, stats->GenerateHealth(cInfo));
1501 uint32 health = uint32(basehp * healthmod);
1502
1503 SetCreateHealth(health);
1504 SetMaxHealth(health);
1505 SetHealth(health);
1507
1508 // mana
1509 uint32 mana = stats->GenerateMana(cInfo);
1510
1511 SetCreateMana(mana);
1512 SetMaxPower(POWER_MANA, mana); //MAX Mana
1513 SetPower(POWER_MANA, mana);
1514
1516
1519
1520 // damage
1521
1522 float basedamage = stats->GenerateBaseDamage(cInfo);
1523
1524 float weaponBaseMinDamage = basedamage;
1525 float weaponBaseMaxDamage = basedamage * 1.5;
1526
1527 SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, weaponBaseMinDamage);
1528 SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, weaponBaseMaxDamage);
1529
1530 SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, weaponBaseMinDamage);
1531 SetBaseWeaponDamage(OFF_ATTACK, MAXDAMAGE, weaponBaseMaxDamage);
1532
1533 SetBaseWeaponDamage(RANGED_ATTACK, MINDAMAGE, weaponBaseMinDamage);
1534 SetBaseWeaponDamage(RANGED_ATTACK, MAXDAMAGE, weaponBaseMaxDamage);
1535
1538
1539 sScriptMgr->Creature_SelectLevel(cInfo, this);
1540}
@ UNIT_MOD_ATTACK_POWER
Definition: Unit.h:282
@ UNIT_MOD_HEALTH
Definition: Unit.h:267
@ UNIT_MOD_MANA
Definition: Unit.h:268
@ UNIT_MOD_ATTACK_POWER_RANGED
Definition: Unit.h:283
void ResetPlayerDamageReq()
Definition: Creature.cpp:3700
uint8 minlevel
Definition: CreatureData.h:188
uint8 maxlevel
Definition: CreatureData.h:189
Definition: CreatureData.h:292
uint32 RangedAttackPower
Definition: CreatureData.h:297
uint32 AttackPower
Definition: CreatureData.h:296
float GenerateBaseDamage(CreatureTemplate const *info) const
Definition: CreatureData.h:321
uint32 GenerateMana(CreatureTemplate const *info) const
Definition: CreatureData.h:307
uint32 GenerateHealth(CreatureTemplate const *info) const
Definition: CreatureData.h:302
void SetCreateHealth(uint32 val)
Definition: Unit.h:2038
void SetBaseWeaponDamage(WeaponAttackType attType, WeaponDamageRange damageRange, float value, uint8 damageIndex=0)
Definition: Unit.h:2118
void SetMaxPower(Powers power, uint32 val)
Definition: Unit.cpp:15523
void SetCreateMana(uint32 val)
Definition: Unit.h:2040
void SetLevel(uint8 lvl, bool showLevelChange=true)
Definition: Unit.cpp:15352
void SetModifierValue(UnitMods unitMod, UnitModifierType modifierType, float value)
Definition: Unit.h:2098
void SetMaxHealth(uint32 val)
Definition: Unit.cpp:15420

References _GetHealthMod(), CreatureBaseStats::AttackPower, BASE_ATTACK, BASE_VALUE, CreatureBaseStats::GenerateBaseDamage(), CreatureBaseStats::GenerateHealth(), CreatureBaseStats::GenerateMana(), GetCreatureTemplate(), Unit::IsPet(), MAXDAMAGE, CreatureTemplate::maxlevel, MINDAMAGE, CreatureTemplate::minlevel, OFF_ATTACK, POWER_MANA, RANGED_ATTACK, CreatureBaseStats::RangedAttackPower, CreatureTemplate::rank, ResetPlayerDamageReq(), Unit::SetBaseWeaponDamage(), Unit::SetCreateHealth(), Unit::SetCreateMana(), Unit::SetHealth(), Unit::SetLevel(), Unit::SetMaxHealth(), Unit::SetMaxPower(), Unit::SetModifierValue(), Unit::SetPower(), sObjectMgr, sScriptMgr, CreatureTemplate::unit_class, UNIT_MOD_ATTACK_POWER, UNIT_MOD_ATTACK_POWER_RANGED, UNIT_MOD_HEALTH, UNIT_MOD_MANA, and urand().

Referenced by Spell::EffectSummonType(), npc_target_dummy::npc_target_dummyAI::Reset(), Respawn(), and UpdateEntry().

◆ SelectNearestTarget()

Unit * Creature::SelectNearestTarget ( float  dist = 0,
bool  playerOnly = false 
) const
2315{
2316 if (dist == 0.0f)
2317 {
2319 }
2320
2321 Unit* target = nullptr;
2322
2323 Acore::NearestHostileUnitCheck u_check(this, dist, playerOnly);
2324 Acore::UnitLastSearcher<Acore::NearestHostileUnitCheck> searcher(this, target, u_check);
2325 Cell::VisitAllObjects(this, searcher, dist);
2326 return target;
2327}
#define MAX_VISIBILITY_DISTANCE
Definition: ObjectDefines.h:31
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:207
Definition: GridNotifiers.h:403
Definition: GridNotifiers.h:1188

References MAX_VISIBILITY_DISTANCE, and Cell::VisitAllObjects().

Referenced by boss_twinemperorsAI::DoAction(), SmartScript::GetTargets(), npc_toc_warlock::npc_toc_warlockAI::JustSummoned(), npc_toc_hunter::npc_toc_hunterAI::JustSummoned(), npc_toc_boomkin::npc_toc_boomkinAI::JustSummoned(), boss_onyxia::JustSummoned(), boss_black_knight::boss_black_knightAI::JustSummoned(), boss_gothik::boss_gothikAI::JustSummoned(), boss_grand_champion::boss_grand_championAI::MovementInform(), npc_swarm_scarab::npc_swarm_scarabAI::Reset(), npc_nerubian_burrower::npc_nerubian_burrowerAI::Reset(), npc_fel_infernal::npc_fel_infernalAI::Reset(), npc_mistress_of_pain::npc_mistress_of_painAI::Reset(), boss_skarvald_the_constructor::boss_skarvald_the_constructorAI::Reset(), boss_dalronn_the_controller::boss_dalronn_the_controllerAI::Reset(), npc_heated_battle::npc_heated_battleAI::Reset(), npc_pet_hunter_snake_trap::Reset(), npc_pet_pri_shadowfiend::Reset(), npc_memory::npc_memoryAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_freya_ward::npc_freya_wardAI::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), and npc_pet_gen_target_following_bomb::UpdateAI().

◆ SelectNearestTargetInAttackDistance()

Unit * Creature::SelectNearestTargetInAttackDistance ( float  dist) const
2331{
2332 if (dist < ATTACK_DISTANCE)
2333 dist = ATTACK_DISTANCE;
2334 if (dist > MAX_SEARCHER_DISTANCE)
2335 dist = MAX_SEARCHER_DISTANCE;
2336
2337 Unit* target = nullptr;
2340 Cell::VisitAllObjects(this, searcher, std::max(dist, ATTACK_DISTANCE));
2341
2342 return target;
2343}
#define MAX_SEARCHER_DISTANCE
Definition: ObjectDefines.h:33
Definition: GridNotifiers.h:1217

References ATTACK_DISTANCE, MAX_SEARCHER_DISTANCE, and Cell::VisitAllObjects().

Referenced by PetAI::SelectNextTarget(), and SimpleCharmedAI::UpdateAI().

◆ SelectVictim()

Unit * Creature::SelectVictim ( )
14626{
14627 // function provides main threat functionality
14628 // next-victim-selection algorithm and evade mode are called
14629 // threat list sorting etc.
14630
14631 Unit* target = nullptr;
14632
14633 // First checking if we have some taunt on us
14635 if (!tauntAuras.empty())
14636 for (Unit::AuraEffectList::const_reverse_iterator itr = tauntAuras.rbegin(); itr != tauntAuras.rend(); ++itr)
14637 if (Unit* caster = (*itr)->GetCaster())
14638 if (CanCreatureAttack(caster) && !caster->HasAuraTypeWithCaster(SPELL_AURA_IGNORED, GetGUID()))
14639 {
14640 target = caster;
14641 break;
14642 }
14643
14644 if (CanHaveThreatList())
14645 {
14646 if (!target && !m_ThreatMgr.isThreatListEmpty())
14647 target = m_ThreatMgr.getHostileTarget();
14648 }
14649 else if (!HasReactState(REACT_PASSIVE))
14650 {
14651 // we have player pet probably
14652 target = getAttackerForHelper();
14653 if (!target && IsSummon())
14654 if (Unit* owner = ToTempSummon()->GetOwner())
14655 {
14656 if (owner->IsInCombat())
14657 target = owner->getAttackerForHelper();
14658 if (!target)
14659 for (ControlSet::const_iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr)
14660 if ((*itr)->IsInCombat())
14661 {
14662 target = (*itr)->getAttackerForHelper();
14663 if (target)
14664 break;
14665 }
14666 }
14667 }
14668 else
14669 return nullptr;
14670
14671 if (target && CanCreatureAttack(target))
14672 {
14673 SetInFront(target);
14674 return target;
14675 }
14676
14677 // last case when creature must not go to evade mode:
14678 // it in combat but attacker not make any damage and not enter to aggro radius to have record in threat list
14679 // Note: creature does not have targeted movement generator but has attacker in this case
14680 for (AttackerSet::const_iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr)
14681 if ((*itr) && CanCreatureAttack(*itr) && (*itr)->GetTypeId() != TYPEID_PLAYER && !(*itr)->ToCreature()->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
14682 return nullptr;
14683
14684 if (GetVehicle())
14685 return nullptr;
14686
14687 // pussywizard: not sure why it's here
14688 // pussywizard: can't evade when having invisibility aura with duration? o_O
14690 if (!iAuras.empty())
14691 {
14692 for (Unit::AuraEffectList::const_iterator itr = iAuras.begin(); itr != iAuras.end(); ++itr)
14693 if ((*itr)->GetBase()->IsPermanent())
14694 {
14696 break;
14697 }
14698 return nullptr;
14699 }
14700
14701 // Last chance: creature group
14702 if (CreatureGroup* group = GetFormation())
14703 {
14704 if (Unit* groupTarget = group->GetNewTargetForMember(this))
14705 {
14706 SetInFront(groupTarget);
14707 return groupTarget;
14708 }
14709 }
14710
14711 // enter in evade mode in other case
14712 AI()->EnterEvadeMode();
14713
14714 return nullptr;
14715}
@ UNIT_MASK_CONTROLABLE_GUARDIAN
Definition: Unit.h:683
@ SPELL_AURA_MOD_INVISIBILITY
Definition: SpellAuraDefines.h:81
@ SPELL_AURA_IGNORED
Definition: SpellAuraDefines.h:284
@ EVADE_REASON_NO_HOSTILES
Definition: CreatureAI.h:88
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Definition: CreatureAI.cpp:197
Unit * getHostileTarget()
Definition: ThreatMgr.cpp:516
bool isThreatListEmpty() const
Definition: ThreatMgr.h:225
CreatureGroup const * GetFormation() const
Definition: Creature.h:345
Definition: CreatureGroups.h:89
Vehicle * GetVehicle() const
Definition: Unit.h:2354
ThreatMgr m_ThreatMgr
Definition: Unit.h:2530
AttackerSet m_attackers
Definition: Unit.h:2487

References AI(), CanCreatureAttack(), Unit::CanHaveThreatList(), CreatureAI::EnterEvadeMode(), CreatureAI::EVADE_REASON_NO_HOSTILES, Unit::getAttackerForHelper(), Unit::GetAuraEffectsByType(), GetFormation(), Object::GetGUID(), ThreatMgr::getHostileTarget(), Unit::GetOwner(), Unit::GetVehicle(), HasReactState(), Unit::IsSummon(), ThreatMgr::isThreatListEmpty(), Unit::m_attackers, Unit::m_ThreatMgr, REACT_PASSIVE, Unit::SetInFront(), SPELL_AURA_IGNORED, SPELL_AURA_MOD_INVISIBILITY, SPELL_AURA_MOD_TAUNT, Unit::ToTempSummon(), TYPEID_PLAYER, and UNIT_MASK_CONTROLABLE_GUARDIAN.

Referenced by StartMovementEvent::Execute(), boss_urom::boss_uromAI::JustSummoned(), boss_gyth::boss_gythAI::JustSummoned(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_rimefang::npc_rimefangAI::MovementInform(), Unit::TauntFadeOut(), Update(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_pet_gen_gnomish_flame_turret::UpdateAI(), CreatureAI::UpdateVictim(), and CreatureAI::UpdateVictimWithGaze().

◆ SendAIReaction()

void Creature::SendAIReaction ( AiReaction  reactionType)
2346{
2347 WorldPacket data(SMSG_AI_REACTION, 12);
2348
2349 data << GetGUID();
2350 data << uint32(reactionType);
2351
2352 ((WorldObject*)this)->SendMessageToSet(&data, true);
2353
2354 LOG_DEBUG("network", "WORLD: Sent SMSG_AI_REACTION, type {}.", reactionType);
2355}
@ SMSG_AI_REACTION
Definition: Opcodes.h:346
Definition: Object.h:393

References Object::GetGUID(), LOG_DEBUG, and SMSG_AI_REACTION.

Referenced by Unit::Attack(), and CreatureAI::TriggerAlert().

◆ SendZoneUnderAttackMessage()

void Creature::SendZoneUnderAttackMessage ( Player attacker)

Send a message to LocalDefense channel for players opposition team in the zone.

2717{
2719 data << (uint32)GetAreaId();
2720 sWorld->SendGlobalMessage(&data, nullptr, (attacker->GetTeamId() == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE));
2721}
@ TEAM_ALLIANCE
Definition: SharedDefines.h:732
@ TEAM_HORDE
Definition: SharedDefines.h:733
@ SMSG_ZONE_UNDER_ATTACK
Definition: Opcodes.h:626
uint32 GetAreaId() const
Definition: Object.cpp:3083
TeamId GetTeamId(bool original=false) const
Definition: Player.h:2059

References WorldObject::GetAreaId(), Player::GetTeamId(), SMSG_ZONE_UNDER_ATTACK, sWorld, TEAM_ALLIANCE, and TEAM_HORDE.

Referenced by GuardAI::JustDied().

◆ SetAssistanceTimer()

void Creature::SetAssistanceTimer ( uint32  value)
inline
391{ m_assistanceTimer = value; }

References m_assistanceTimer.

Referenced by Unit::Attack().

◆ SetCanDualWield()

void Creature::SetCanDualWield ( bool  value)
overridevirtual

◆ SetCanFly()

bool Creature::SetCanFly ( bool  enable,
bool  packetOnly = false 
)
overridevirtual

movement counter

Reimplemented from Unit.

3178{
3179 if (!Unit::SetCanFly(enable))
3180 return false;
3181
3182 if (m_movedByPlayer)
3183 {
3184 sScriptMgr->AnticheatSetCanFlybyServer(m_movedByPlayer->ToPlayer(), enable);
3185
3186 if (!enable)
3188
3190 data << GetPackGUID();
3191 data << uint32(0);
3193
3194 data.Initialize(MSG_MOVE_UPDATE_CAN_FLY, 64);
3195 data << GetPackGUID();
3196 BuildMovementPacket(&data);
3197 m_movedByPlayer->ToPlayer()->SendMessageToSet(&data, false);
3198 return true;
3199 }
3200
3202 data << GetPackGUID();
3203 SendMessageToSet(&data, false);
3204 return true;
3205}
@ MSG_MOVE_UPDATE_CAN_FLY
Definition: Opcodes.h:971
@ SMSG_SPLINE_MOVE_SET_FLYING
Definition: Opcodes.h:1088
@ SMSG_MOVE_SET_CAN_FLY
Definition: Opcodes.h:865
@ SMSG_SPLINE_MOVE_UNSET_FLYING
Definition: Opcodes.h:1089
@ SMSG_MOVE_UNSET_CAN_FLY
Definition: Opcodes.h:866
PackedGuid const & GetPackGUID() const
Definition: Object.h:108
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition: Object.h:482
void SetFallInformation(uint32 time, float z)
Definition: Player.h:2285
void SendMessageToSet(WorldPacket const *data, bool self) const override
Definition: Player.h:1976
virtual bool SetCanFly(bool enable, bool packetOnly=false)
Definition: Unit.cpp:20856
SafeUnitPointer m_movedByPlayer
Definition: Unit.h:1888
void BuildMovementPacket(ByteBuffer *data) const
Definition: Unit.cpp:20069

References Unit::BuildMovementPacket(), GameTime::GetGameTime(), Object::GetPackGUID(), Position::GetPositionZ(), WorldPacket::Initialize(), Unit::m_movedByPlayer, MSG_MOVE_UPDATE_CAN_FLY, Player::SendDirectMessage(), WorldObject::SendMessageToSet(), Player::SendMessageToSet(), Unit::SetCanFly(), Player::SetFallInformation(), SMSG_MOVE_SET_CAN_FLY, SMSG_MOVE_UNSET_CAN_FLY, SMSG_SPLINE_MOVE_SET_FLYING, SMSG_SPLINE_MOVE_UNSET_FLYING, sScriptMgr, and Object::ToPlayer().

Referenced by boss_twin_valkyrAI::boss_twin_valkyrAI(), boss_ayamiss::DamageTaken(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), npc_kalecgos_kj::npc_kalecgos_kjAI::DoAction(), boss_urom::boss_uromAI::EnterEvadeMode(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::FlyAway(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), boss_sartharion_tenebron::boss_sartharion_tenebronAI::HandleExtraEvent(), boss_sartharion_shadron::boss_sartharion_shadronAI::HandleExtraEvent(), boss_sartharion_vesperon::boss_sartharion_vesperonAI::HandleExtraEvent(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::InitializeAI(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy(), boss_urom::boss_uromAI::JustDied(), boss_sartharion_dragonAI::JustEngagedWith(), boss_ayamiss::JustEngagedWith(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::JustReachedHome(), brann_bronzebeard::brann_bronzebeardAI::JustSummoned(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::JustSummoned(), boss_kiljaeden::boss_kiljaedenAI::JustSummoned(), boss_onyxia::MovementInform(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::MovementInform(), boss_sister_svalna::boss_sister_svalnaAI::MovementInform(), npc_icc_spire_frostwyrm::npc_icc_spire_frostwyrmAI::MovementInform(), npc_enslaved_proto_drake::npc_enslaved_proto_drakeAI::MovementInform(), boss_nazan::boss_nazanAI::MovementInform(), npc_hallows_end_soh::MovementInform(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::MovementInform(), npc_alexstrasza::npc_alexstraszaAI::npc_alexstraszaAI(), npc_concentrated_ball::npc_concentrated_ballAI::npc_concentrated_ballAI(), npc_icc_spire_frostwyrm::npc_icc_spire_frostwyrmAI::npc_icc_spire_frostwyrmAI(), npc_pet_gen_moth::npc_pet_gen_moth(), npc_hover_disk::npc_hover_diskAI::PassengerBoarded(), boss_nefarian::PathEndReached(), boss_nefarian::Reset(), npc_image_of_medivh::npc_image_of_medivhAI::Reset(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::Reset(), npc_hallows_end_soh::Reset(), boss_onyxia::Reset(), boss_sartharion_dragonAI::Reset(), boss_sister_svalna::boss_sister_svalnaAI::Reset(), npc_ulduar_mimiron_rocket::npc_ulduar_mimiron_rocketAI::Reset(), boss_nazan::boss_nazanAI::Reset(), npc_enslaved_proto_drake::npc_enslaved_proto_drakeAI::SetData(), SmartAI::SetFly(), npc_simon_bunny::npc_simon_bunnyAI::SetGUID(), boss_urom::boss_uromAI::SpellHit(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), boss_onyxia::UpdateAI(), npc_frost_sphere::npc_frost_sphereAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), npc_conversing_with_the_depths_trigger::npc_conversing_with_the_depths_triggerAI::UpdateAI(), npc_pet_gen_wind_rider_cub::UpdateAI(), and UpdateMovementFlags().

◆ SetCannotReachTarget()

void Creature::SetCannotReachTarget ( ObjectGuid const &  target = ObjectGuid::Empty)
3540{
3541 if (cannotReach == m_cannotReachTarget)
3542 {
3543 return;
3544 }
3545
3546 m_cannotReachTarget = cannotReach;
3548
3549 if (cannotReach)
3550 {
3551 LOG_DEBUG("entities.unit", "Creature::SetCannotReachTarget() called with true. Details: {}", GetDebugInfo());
3552 }
3553}
std::string GetDebugInfo() const override
Definition: Creature.cpp:3711

References GetDebugInfo(), LOG_DEBUG, m_cannotReachTarget, and m_cannotReachTimer.

Referenced by CreatureAI::_EnterEvadeMode(), ChaseMovementGenerator< T >::DoUpdate(), setDeathState(), and Update().

◆ SetCombatPulseDelay()

void Creature::SetCombatPulseDelay ( uint32  delay)
inline
288 {
289 m_combatPulseDelay = delay;
290 if (m_combatPulseTime == 0 || m_combatPulseTime > delay)
291 m_combatPulseTime = delay;
292 }

References m_combatPulseDelay, and m_combatPulseTime.

Referenced by BossAI::_JustEngagedWith(), and BossAI::_Reset().

◆ SetCorpseDelay()

void Creature::SetCorpseDelay ( uint32  delay)
inline

◆ SetCorpseRemoveTime()

void Creature::SetCorpseRemoveTime ( uint32  delay)

◆ SetCurrentEquipmentId()

void Creature::SetCurrentEquipmentId ( uint8  id)
inline

◆ setDeathState()

void Creature::setDeathState ( DeathState  s,
bool  despawn = false 
)
overridevirtual

Reimplemented from Unit.

Reimplemented in Minion, and Pet.

1935{
1936 Unit::setDeathState(s, despawn);
1937
1938 if (s == JUST_DIED)
1939 {
1940 _lastDamagedTime.reset();
1941
1944
1945 // always save boss respawn time at death to prevent crash cheating
1946 if (GetMap()->IsDungeon() || isWorldBoss() || GetCreatureTemplate()->rank >= CREATURE_ELITE_ELITE)
1948
1949 SetTarget(); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState)
1951
1952 Dismount(); // if creature is mounted on a virtual mount, remove it at death
1953
1954 setActive(false);
1955
1957 {
1958 SetNoSearchAssistance(false);
1959 }
1960
1961 //Dismiss group if is leader
1962 if (m_formation && m_formation->GetLeader() == this)
1963 m_formation->FormationReset(true, false);
1964
1965 bool needsFalling = !despawn && (IsFlying() || IsHovering()) && !IsUnderWater();
1966 SetHover(false, false, false);
1967 SetDisableGravity(false, false, false);
1968
1969 if (needsFalling)
1970 GetMotionMaster()->MoveFall(0, true);
1971
1972 Unit::setDeathState(CORPSE, despawn);
1973 }
1974 else if (s == JUST_RESPAWNED)
1975 {
1976 //if (IsPet())
1977 // setActive(true);
1978 SetFullHealth();
1979 SetLootRecipient(nullptr);
1982 CreatureTemplate const* cinfo = GetCreatureTemplate();
1983 // Xinef: npc run by default
1984 //SetWalk(true);
1985
1986 // pussywizard:
1989
1991
1995
1996 Unit::setDeathState(ALIVE, despawn);
1997
1999 LoadCreaturesAddon(true);
2000 if (GetCreatureData() && GetPhaseMask() != GetCreatureData()->phaseMask)
2001 SetPhaseMask(GetCreatureData()->phaseMask, false);
2002 }
2003}
@ MOVEMENTFLAG_FALLING
Definition: Unit.h:564
NPCFlags
Non Player Character flags.
Definition: Unit.h:514
@ UNIT_NPC_FLAG_NONE
Definition: Unit.h:515
@ UNIT_STATE_ALL_STATE
Definition: Unit.h:373
@ UNIT_STATE_NO_ENVIRONMENT_UPD
Definition: Unit.h:353
SpellSchools
Definition: SharedDefines.h:254
void SaveRespawnTime() override
Definition: Creature.cpp:2541
bool HasSearchedAssistance()
Definition: Creature.h:261
void SetLootRecipient(Unit *unit, bool withGroup=true)
Definition: Creature.cpp:1292
bool SetDisableGravity(bool disable, bool packetOnly=false, bool updateAnimationTier=true) override
Definition: Creature.cpp:3092
void SetCannotReachTarget(ObjectGuid const &target=ObjectGuid::Empty)
Definition: Creature.cpp:3539
bool SetHover(bool enable, bool packetOnly=false, bool updateAnimationTier=true) override
Definition: Creature.cpp:3257
void SetTarget(ObjectGuid guid=ObjectGuid::Empty) override
Definition: Creature.cpp:3424
void SetMeleeDamageSchool(SpellSchools school)
Definition: Creature.h:160
uint32 dmgschool
Definition: CreatureData.h:200
virtual void setDeathState(DeathState s, bool despawn=false)
Definition: Unit.cpp:14447
void SetFullHealth()
Definition: Unit.h:1455
void Dismount()
Definition: Unit.cpp:13435
bool HasUnitMovementFlag(uint32 f) const
Definition: Unit.h:2274
virtual bool IsUnderWater() const
Definition: Unit.cpp:4284
void RemoveUnitMovementFlag(uint32 f)
Definition: Unit.h:2273
void ReplaceAllNpcFlags(NPCFlags flags)
Definition: Unit.h:1649
void MoveFall(uint32 id=0, bool addFlagForNPC=false)
Definition: MotionMaster.cpp:545

References _lastDamagedTime, ALIVE, Unit::ClearUnitState(), CORPSE, CREATURE_ELITE_ELITE, Unit::Dismount(), CreatureTemplate::dmgschool, CreatureGroup::FormationReset(), GetCreatureData(), GetCreatureTemplate(), GameTime::GetGameTime(), CreatureGroup::GetLeader(), WorldObject::GetMap(), Unit::GetMotionMaster(), WorldObject::GetPhaseMask(), HasSearchedAssistance(), Unit::HasUnitMovementFlag(), Unit::IsFlying(), Unit::IsHovering(), Unit::IsUnderWater(), isWorldBoss(), JUST_DIED, JUST_RESPAWNED, LoadCreaturesAddon(), m_corpseDelay, m_corpseRemoveTime, m_formation, m_respawnDelay, m_respawnTime, Motion_Initialize(), MotionMaster::MoveFall(), MOVEMENTFLAG_FALLING, CreatureTemplate::npcflag, Unit::RemoveUnitMovementFlag(), Unit::ReplaceAllNpcFlags(), ResetPlayerDamageReq(), SaveRespawnTime(), WorldObject::setActive(), SetCannotReachTarget(), Unit::setDeathState(), SetDisableGravity(), Unit::SetFullHealth(), SetHover(), SetLootRecipient(), SetMeleeDamageSchool(), SetNoSearchAssistance(), Unit::SetPhaseMask(), SetTarget(), UNIT_NPC_FLAG_NONE, UNIT_STATE_ALL_STATE, UNIT_STATE_IGNORE_PATHFINDING, UNIT_STATE_NO_ENVIRONMENT_UPD, and UpdateMovementFlags().

Referenced by BattlegroundAV::AddAVCreature(), DisappearAndDie(), npc_auriaya_feral_defender::npc_auriaya_feral_defenderAI::DoAction(), boss_freya_summons::boss_freya_summonsAI::DoAction(), ForcedDespawn(), npc_commandscript::HandleNpcMoveCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetWanderDistanceCommand(), npc_echo_of_medivh::HandlePieceJustDied(), npc_nether_drake::npc_nether_drakeAI::MovementInform(), instance_ulduar::instance_ulduar_InstanceMapScript::OnCreatureCreate(), RemoveCorpse(), Respawn(), npc_simone::npc_simoneAI::RespawnPet(), Minion::setDeathState(), Pet::setDeathState(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::SpawnAdds(), npc_argent_captainAI::SpellHit(), npc_drakuru_shackles::npc_drakuru_shacklesAI::SpellHit(), npc_escortAI::UpdateAI(), npc_a_special_surprise::npc_a_special_surpriseAI::UpdateAI(), npc_towering_infernal::npc_towering_infernalAI::UpdateAI(), npc_lesser_doomguard::npc_lesser_doomguardAI::UpdateAI(), npc_clintar_spirit::npc_clintar_spiritAI::UpdateAI(), npc_injured_patient::npc_injured_patientAI::UpdateAI(), npc_abomination::npc_abominationAI::WaypointReached(), and npc_ghoul::npc_ghoulAI::WaypointReached().

◆ SetDefaultMovementType()

◆ SetDetectionDistance()

void Creature::SetDetectionDistance ( float  dist)
inline
199{ m_detectionDistance = dist; }

References m_detectionDistance.

Referenced by UpdateEntry().

◆ SetDisableGravity()

bool Creature::SetDisableGravity ( bool  disable,
bool  packetOnly = false,
bool  updateAnimationTier = true 
)
overridevirtual

It's possible only a packet is sent but moveflags are not updated Need more research on this

movement counter

Reimplemented from Unit.

3093{
3096 if (!packetOnly && !Unit::SetDisableGravity(disable))
3097 return false;
3098
3099 if (m_movedByPlayer)
3100 {
3102 data << GetPackGUID();
3103 data << uint32(0);
3105
3106 data.Initialize(MSG_MOVE_GRAVITY_CHNG, 64);
3107 data << GetPackGUID();
3108 BuildMovementPacket(&data);
3109 m_movedByPlayer->ToPlayer()->SendMessageToSet(&data, false);
3110 return true;
3111 }
3112
3113 if (updateAnimationTier && IsAlive() && !HasUnitState(UNIT_STATE_ROOT) && !GetMovementTemplate().IsRooted())
3114 {
3115 if (IsLevitating())
3117 else if (IsHovering())
3119 else
3121 }
3122
3124 data << GetPackGUID();
3125 SendMessageToSet(&data, false);
3126 return true;
3127}
@ UNIT_BYTE1_FLAG_FLY
Definition: Unit.h:82
@ UNIT_BYTE1_FLAG_GROUND
Definition: Unit.h:79
@ UNIT_BYTE1_FLAG_HOVER
Definition: Unit.h:81
@ UNIT_STATE_ROOT
Definition: Unit.h:335
@ SMSG_SPLINE_MOVE_GRAVITY_DISABLE
Definition: Opcodes.h:1265
@ SMSG_MOVE_GRAVITY_DISABLE
Definition: Opcodes.h:1260
@ SMSG_MOVE_GRAVITY_ENABLE
Definition: Opcodes.h:1262
@ SMSG_SPLINE_MOVE_GRAVITY_ENABLE
Definition: Opcodes.h:1266
@ MSG_MOVE_GRAVITY_CHNG
Definition: Opcodes.h:1264
bool IsLevitating() const
Definition: Unit.h:2378
virtual bool SetDisableGravity(bool disable, bool packetOnly=false, bool updateAnimationTier=true)
Definition: Unit.cpp:20819

References Unit::BuildMovementPacket(), GetMovementTemplate(), Object::GetPackGUID(), Unit::HasUnitState(), WorldPacket::Initialize(), Unit::IsAlive(), Unit::IsHovering(), Unit::IsLevitating(), Unit::m_movedByPlayer, MSG_MOVE_GRAVITY_CHNG, Player::SendDirectMessage(), WorldObject::SendMessageToSet(), Player::SendMessageToSet(), Object::SetByteValue(), Unit::SetDisableGravity(), SMSG_MOVE_GRAVITY_DISABLE, SMSG_MOVE_GRAVITY_ENABLE, SMSG_SPLINE_MOVE_GRAVITY_DISABLE, SMSG_SPLINE_MOVE_GRAVITY_ENABLE, Object::ToPlayer(), UNIT_BYTE1_FLAG_FLY, UNIT_BYTE1_FLAG_GROUND, UNIT_BYTE1_FLAG_HOVER, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_FIELD_BYTES_1, and UNIT_STATE_ROOT.

Referenced by boss_twin_valkyrAI::boss_twin_valkyrAI(), boss_yoggsaron_brain::boss_yoggsaron_brainAI::boss_yoggsaron_brainAI(), boss_ayamiss::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::DoAction(), boss_taldaram::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), npc_madrigosa::npc_madrigosaAI::DoAction(), npc_kalecgos_kj::npc_kalecgos_kjAI::DoAction(), boss_malygos::boss_malygosAI::EnterEvadeMode(), boss_urom::boss_uromAI::EnterEvadeMode(), boss_razorscale::boss_razorscaleAI::EnterEvadeMode(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::FlyAway(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), boss_taldaram::InitializeAI(), boss_malygos::boss_malygosAI::InitializeAI(), boss_razorscale::boss_razorscaleAI::InitializeAI(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::InitializeAI(), boss_urom::boss_uromAI::JustDied(), boss_jeklik::JustEngagedWith(), boss_ayamiss::JustEngagedWith(), boss_saviana_ragefire::boss_saviana_ragefireAI::JustReachedHome(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::JustReachedHome(), boss_sindragosa::boss_sindragosaAI::JustReachedHome(), npc_spinestalker::npc_spinestalkerAI::JustReachedHome(), npc_rimefang::npc_rimefangAI::JustReachedHome(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::JustReachedHome(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::JustSummoned(), boss_kiljaeden::boss_kiljaedenAI::JustSummoned(), npc_icc_gauntlet_controller::npc_icc_gauntlet_controllerAI::JustSummoned(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::JustSummoned(), boss_algalon_the_observer::boss_algalon_the_observerAI::MovementInform(), boss_onyxia::MovementInform(), boss_ayamiss::MovementInform(), boss_taldaram::MovementInform(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::MovementInform(), boss_sister_svalna::boss_sister_svalnaAI::MovementInform(), npc_icc_spire_frostwyrm::npc_icc_spire_frostwyrmAI::MovementInform(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::MovementInform(), boss_malygos::boss_malygosAI::MovementInform(), npc_oculus_drake::npc_oculus_drakeAI::MovementInform(), boss_razorscale::boss_razorscaleAI::MovementInform(), npc_enslaved_proto_drake::npc_enslaved_proto_drakeAI::MovementInform(), boss_nazan::boss_nazanAI::MovementInform(), npc_enslaved_netherwing_drake::npc_enslaved_netherwing_drakeAI::MovementInform(), boss_felmyst::boss_felmystAI::MovementInform(), npc_hallows_end_soh::MovementInform(), boss_saviana_ragefire::boss_saviana_ragefireAI::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_spinestalker::npc_spinestalkerAI::MovementInform(), npc_rimefang::npc_rimefangAI::MovementInform(), boss_kaelthas::boss_kaelthasAI::MovementInform(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), npc_alexstrasza::npc_alexstraszaAI::npc_alexstraszaAI(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::npc_attracted_reef_bullAI(), npc_concentrated_ball::npc_concentrated_ballAI::npc_concentrated_ballAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::npc_icc_nerubar_broodkeeperAI(), npc_icc_spire_frostwyrm::npc_icc_spire_frostwyrmAI::npc_icc_spire_frostwyrmAI(), npc_pet_gen_moth::npc_pet_gen_moth(), npc_pet_gen_valkyr_guardian::npc_pet_gen_valkyr_guardian(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::npc_ulduar_aerial_command_unitAI(), instance_ulduar::instance_ulduar_InstanceMapScript::OnCreatureCreate(), npc_eoe_wyrmrest_skytalon::npc_eoe_wyrmrest_skytalonAI::PassengerBoarded(), npc_oculus_drake::npc_oculus_drakeAI::PassengerBoarded(), boss_nefarian::PathEndReached(), boss_jeklik::PathEndReached(), SmartScript::ProcessAction(), boss_nefarian::Reset(), boss_nightbane::boss_nightbaneAI::Reset(), boss_felmyst::boss_felmystAI::Reset(), boss_kalecgos::boss_kalecgosAI::Reset(), boss_kalec::boss_kalecAI::Reset(), npc_akilzon_eagle::npc_akilzon_eagleAI::Reset(), npc_janalai_hatchling::npc_janalai_hatchlingAI::Reset(), boss_jeklik::Reset(), npc_batrider::Reset(), npc_soh_fire_trigger::Reset(), npc_hallows_end_soh::Reset(), boss_headless_horseman::Reset(), npc_frost_wyrm::npc_frost_wyrmAI::Reset(), npc_gargoyle::npc_gargoyleAI::Reset(), boss_onyxia::Reset(), boss_jedoga_shadowseeker::Reset(), npc_blood_queen_lana_thel::npc_blood_queen_lana_thelAI::Reset(), boss_sindragosa::boss_sindragosaAI::Reset(), npc_spinestalker::npc_spinestalkerAI::Reset(), npc_rimefang::npc_rimefangAI::Reset(), boss_sister_svalna::boss_sister_svalnaAI::Reset(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::Reset(), boss_kologarn::boss_kologarnAI::Reset(), boss_thorim_pillar::boss_thorim_pillarAI::Reset(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::Reset(), boss_illidan_stormrage::boss_illidan_stormrageAI::Reset(), boss_nazan::boss_nazanAI::Reset(), boss_kaelthas::boss_kaelthasAI::Reset(), npc_enslaved_netherwing_drake::npc_enslaved_netherwing_drakeAI::Reset(), npc_dancing_flames::npc_dancing_flamesAI::Reset(), npc_enslaved_proto_drake::npc_enslaved_proto_drakeAI::SetData(), setDeathState(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::SpellHit(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::SpellHit(), npc_saurfang_event::npc_saurfang_eventAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), boss_nightbane::boss_nightbaneAI::TakeOff(), boss_nightbane::boss_nightbaneAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), npc_highborne_lamenter::npc_highborne_lamenterAI::UpdateAI(), npc_giant_infernal::npc_giant_infernalAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_jedoga_shadowseeker::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), npc_oculus_drake::npc_oculus_drakeAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), npc_wintergarde_gryphon::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_kaelthas::boss_kaelthasAI::UpdateAI(), npc_enslaved_netherwing_drake::npc_enslaved_netherwing_drakeAI::UpdateAI(), npc_pet_gen_wind_rider_cub::UpdateAI(), and UpdateMovementFlags().

◆ SetDisableReputationGain()

void Creature::SetDisableReputationGain ( bool  disable)
inline
351{ DisableReputationGain = disable; }

References DisableReputationGain.

Referenced by hyjalAI::SummonCreature().

◆ SetDisplayId()

void Creature::SetDisplayId ( uint32  modelId)
overridevirtual

Reimplemented from Unit.

Reimplemented in Pet.

3406{
3407 Unit::SetDisplayId(modelId);
3408
3409 float combatReach = DEFAULT_WORLD_OBJECT_SIZE;
3410
3411 if (CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelInfo(modelId))
3412 {
3413 SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, (IsPet() ? 1.0f : minfo->bounding_radius) * GetObjectScale());
3414 if (minfo->combat_reach > 0)
3415 combatReach = minfo->combat_reach;
3416 }
3417
3418 if (IsPet())
3419 combatReach = DEFAULT_COMBAT_REACH;
3420
3422}
#define DEFAULT_WORLD_OBJECT_SIZE
Definition: ObjectDefines.h:45
#define DEFAULT_COMBAT_REACH
Definition: ObjectDefines.h:46
@ UNIT_FIELD_COMBATREACH
Definition: UpdateFields.h:123
@ UNIT_FIELD_BOUNDINGRADIUS
Definition: UpdateFields.h:122
Definition: CreatureData.h:388
float GetObjectScale() const
Definition: Object.h:112
virtual void SetDisplayId(uint32 modelId)
Definition: Unit.cpp:16936

References DEFAULT_COMBAT_REACH, DEFAULT_WORLD_OBJECT_SIZE, Object::GetObjectScale(), Unit::IsPet(), Unit::SetDisplayId(), Object::SetFloatValue(), sObjectMgr, UNIT_FIELD_BOUNDINGRADIUS, and UNIT_FIELD_COMBATREACH.

Referenced by npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::Activate(), Create(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::Deactivate(), npc_icc_severed_essence::npc_icc_severed_essenceAI::DoAction(), boss_ichoron::boss_ichoronAI::DoExplodeCompleted(), SACDeactivateEvent::Execute(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), npc_commandscript::HandleNpcSetModelCommand(), wp_commandscript::HandleWpShowCommand(), InitEntry(), npc_troll_volunteer::npc_troll_volunteerAI::InitializeAI(), Totem::InitStats(), Guardian::InitStatsForLevel(), npc_eoe_wyrmrest_skytalon::npc_eoe_wyrmrest_skytalonAI::JustDied(), boss_ichoron::boss_ichoronAI::JustDied(), boss_tharon_ja::boss_tharon_jaAI::JustDied(), boss_laj::JustEngagedWith(), npc_scholomance_occultist::npc_scholomance_occultistAI::JustReachedHome(), npc_fairbanks::npc_fairbanksAI::MoveInLineOfSight(), npc_cw_area_trigger::npc_cw_area_triggerAI::npc_cw_area_triggerAI(), npc_eye_of_acherus::npc_eye_of_acherus(), npc_giant_infernal::npc_giant_infernalAI::npc_giant_infernalAI(), npc_grizzlemaw_cw_trigger::npc_grizzlemaw_cw_triggerAI::npc_grizzlemaw_cw_triggerAI(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::npc_scarlet_miner_cartAI(), npc_the_biggest_tree::npc_the_biggest_tree(), npc_eoe_wyrmrest_skytalon::npc_eoe_wyrmrest_skytalonAI::PassengerBoarded(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::ReorderInstance(), boss_kalec::boss_kalecAI::Reset(), boss_black_knight::boss_black_knightAI::Reset(), boss_tharon_ja::boss_tharon_jaAI::Reset(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::Reset(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::Reset(), boss_ichoron::boss_ichoronAI::Reset(), boss_laj::Reset(), npc_infernal_attacker::npc_infernal_attackerAI::Reset(), Respawn(), Pet::SetDisplayId(), npc_netherspite_infernal::SpellHit(), npc_harrison_jones::npc_harrison_jonesAI::SpellHit(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::SpellHit(), npc_infernal_attacker::npc_infernal_attackerAI::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::SummonNextWave(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), npc_harrison_jones::npc_harrison_jonesAI::UpdateAI(), npc_giant_infernal::npc_giant_infernalAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_frost_sphere::npc_frost_sphereAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), npc_pos_collapsing_icicle::npc_pos_collapsing_icicleAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), npc_blistering_zombie::npc_blistering_zombieAI::UpdateAI(), npc_ulduar_icicle::npc_ulduar_icicleAI::UpdateAI(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::UpdateAI(), npc_azure_saboteur::npc_azure_saboteurAI::UpdateAI(), and boss_ichoron::boss_ichoronAI::UpdateAI().

◆ SetFeatherFall()

bool Creature::SetFeatherFall ( bool  enable,
bool  packetOnly = false 
)
overridevirtual

movement counter

Reimplemented from Unit.

3233{
3234 if (!packetOnly && !Unit::SetFeatherFall(enable))
3235 return false;
3236
3237 if (m_movedByPlayer)
3238 {
3240 data << GetPackGUID();
3241 data << uint32(0);
3243
3244 data.Initialize(MSG_MOVE_FEATHER_FALL, 64);
3245 data << GetPackGUID();
3246 BuildMovementPacket(&data);
3247 m_movedByPlayer->ToPlayer()->SendMessageToSet(&data, false);
3248 return true;
3249 }
3250
3252 data << GetPackGUID();
3253 SendMessageToSet(&data, true);
3254 return true;
3255}
@ SMSG_MOVE_FEATHER_FALL
Definition: Opcodes.h:272
@ SMSG_MOVE_NORMAL_FALL
Definition: Opcodes.h:273
@ MSG_MOVE_FEATHER_FALL
Definition: Opcodes.h:718
@ SMSG_SPLINE_MOVE_NORMAL_FALL
Definition: Opcodes.h:804
@ SMSG_SPLINE_MOVE_FEATHER_FALL
Definition: Opcodes.h:803
virtual bool SetFeatherFall(bool enable, bool packetOnly=false)
Definition: Unit.cpp:20896

References Unit::BuildMovementPacket(), Object::GetPackGUID(), WorldPacket::Initialize(), Unit::m_movedByPlayer, MSG_MOVE_FEATHER_FALL, Player::SendDirectMessage(), WorldObject::SendMessageToSet(), Player::SendMessageToSet(), Unit::SetFeatherFall(), SMSG_MOVE_FEATHER_FALL, SMSG_MOVE_NORMAL_FALL, SMSG_SPLINE_MOVE_FEATHER_FALL, SMSG_SPLINE_MOVE_NORMAL_FALL, and Object::ToPlayer().

◆ SetFormation()

void Creature::SetFormation ( CreatureGroup formation)
inline
347{ m_formation = formation; }

References m_formation.

Referenced by CreatureGroup::AddMember(), and CreatureGroup::RemoveMember().

◆ SetHomePosition() [1/2]

void Creature::SetHomePosition ( const Position pos)
inline

◆ SetHomePosition() [2/2]

void Creature::SetHomePosition ( float  x,
float  y,
float  z,
float  o 
)
inline
328{ m_homePosition.Relocate(x, y, z, o); }

References m_homePosition, and Position::Relocate().

Referenced by Battleground::AddCreature(), boss_loatheb::boss_loathebAI::boss_loathebAI(), MotionTransport::CreateNPCPassenger(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::DestroyDoor(), npc_icc_spire_frostwyrm::npc_icc_spire_frostwyrmAI::DoAction(), boss_taldaram::DoAction(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), hyjalAI::DoOverrun(), boss_jeklik::EnterEvadeMode(), boss_ayamiss::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::GoSiphon(), WorldSession::HandleBattlemasterHelloOpcode(), WorldSession::HandleGossipHelloOpcode(), spell_item_toxic_wasteling::HandleJump(), WorldSession::HandleQuestgiverHelloOpcode(), boss_eck::boss_eckAI::InitializeAI(), boss_flame_leviathan::boss_flame_leviathanAI::InitializeAI(), boss_aeonus::IsSummonedBy(), npc_simone::npc_simoneAI::JustDied(), boss_mandokir::boss_mandokirAI::JustEngagedWith(), boss_urom::boss_uromAI::JustEngagedWith(), boss_flame_leviathan::boss_flame_leviathanAI::JustEngagedWith(), npc_shay_leafrunner::npc_shay_leafrunnerAI::JustRespawned(), boss_kelthuzad::boss_kelthuzadAI::JustSummoned(), npc_daphne_stilwell::npc_daphne_stilwellAI::JustSummoned(), npc_hor_lich_king::npc_hor_lich_kingAI::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustSummoned(), CreatureGroup::LeaderMoveTo(), LoadCreatureFromDB(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::MoveInLineOfSight(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::MoveInLineOfSight(), boss_nightbane::boss_nightbaneAI::MovementInform(), boss_mandokir::boss_mandokirAI::MovementInform(), npc_enslaved_proto_drake::npc_enslaved_proto_drakeAI::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_spinestalker::npc_spinestalkerAI::MovementInform(), npc_rimefang::npc_rimefangAI::MovementInform(), npc_omen::npc_omenAI::MovementInform(), npc_gunship_boarding_addAI::MovementInform(), boss_ghazan::MovementInform(), npc_zelfrax::npc_zelfraxAI::MovementInform(), npc_escortAI::MovementInform(), SmartAI::MovepointReached(), npc_akama_illidan::npc_akama_illidanAI::npc_akama_illidanAI(), RemoveCorpse(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::Reposition(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::Reposition(), boss_nightbane::boss_nightbaneAI::Reset(), boss_arlokk::boss_arlokkAI::Reset(), npc_simone::npc_simoneAI::RespawnPet(), WorldSession::SendListInventory(), gunship_npc_AI::SetData(), NPCStaveQuestAI::SetHomePosition(), Battlefield::SpawnCreature(), boss_urom::boss_uromAI::SpellHit(), boss_majordomo::boss_majordomoAI::SpellHit(), boss_ionar::boss_ionarAI::Split(), WaypointMovementGenerator< Creature >::StartMove(), Map::SummonCreature(), npc_drakonid_spawner::SummonedCreatureDies(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), hyjal_trashAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_shay_leafrunner::npc_shay_leafrunnerAI::UpdateAI(), npc_twilight_volunteer::UpdateAI(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), violet_hold_trashAI::UpdateAI(), npc_azure_saboteur::npc_azure_saboteurAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), boss_wrath_scryer_soccothrates::boss_wrath_scryer_soccothratesAI::UpdateAI(), and MotionTransport::UpdatePassengerPositions().

◆ SetHover()

bool Creature::SetHover ( bool  enable,
bool  packetOnly = false,
bool  updateAnimationTier = true 
)
overridevirtual

Reimplemented from Unit.

3258{
3259 if (!packetOnly && !Unit::SetHover(enable))
3260 return false;
3261
3262 if (updateAnimationTier && IsAlive() && !HasUnitState(UNIT_STATE_ROOT) && !GetMovementTemplate().IsRooted())
3263 {
3264 if (IsLevitating())
3266 else if (IsHovering())
3268 else
3270 }
3271
3273 data << GetPackGUID();
3274 SendMessageToSet(&data, false);
3275 return true;
3276}
@ SMSG_SPLINE_MOVE_SET_HOVER
Definition: Opcodes.h:805
@ SMSG_SPLINE_MOVE_UNSET_HOVER
Definition: Opcodes.h:806
virtual bool SetHover(bool enable, bool packetOnly=false, bool updateAnimationTier=true)
Definition: Unit.cpp:20918

References GetMovementTemplate(), Object::GetPackGUID(), Unit::HasUnitState(), Unit::IsAlive(), Unit::IsHovering(), Unit::IsLevitating(), WorldObject::SendMessageToSet(), Object::SetByteValue(), Unit::SetHover(), SMSG_SPLINE_MOVE_SET_HOVER, SMSG_SPLINE_MOVE_UNSET_HOVER, UNIT_BYTE1_FLAG_FLY, UNIT_BYTE1_FLAG_GROUND, UNIT_BYTE1_FLAG_HOVER, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_FIELD_BYTES_1, and UNIT_STATE_ROOT.

Referenced by boss_taldaram::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), boss_taldaram::InitializeAI(), boss_jeklik::JustEngagedWith(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::JustEngagedWith(), boss_saviana_ragefire::boss_saviana_ragefireAI::JustReachedHome(), boss_taldaram::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), boss_jeklik::PathEndReached(), boss_jeklik::Reset(), npc_batrider::Reset(), npc_depth_charge::npc_depth_chargeAI::Reset(), boss_jedoga_shadowseeker::Reset(), npc_dark_nucleus::npc_dark_nucleusAI::Reset(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::Reset(), boss_svala::boss_svalaAI::Reset(), setDeathState(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), boss_jedoga_shadowseeker::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), npc_wintergarde_gryphon::UpdateAI(), and UpdateMovementFlags().

◆ SetInCombatWithZone()

void Creature::SetInCombatWithZone ( )
2724{
2725 if (IsAIEnabled)
2726 AI()->DoZoneInCombat();
2727}
void DoZoneInCombat(Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
Definition: CreatureAI.cpp:95

References AI(), CreatureAI::DoZoneInCombat(), and Unit::IsAIEnabled.

Referenced by npc_mograine::npc_mograineAI::DamageTaken(), npc_ghostly_priest::npc_ghostly_priestAI::DoAction(), npc_phantom_mage::npc_phantom_mageAI::DoAction(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::DoAction(), npc_spectral_footman::npc_spectral_footmanAI::DoAction(), npc_tortured_rifleman::npc_tortured_riflemanAI::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::DoAction(), npc_risen_archmage::npc_risen_archmageAI::DoAction(), npc_living_constellation::npc_living_constellationAI::DoAction(), boss_broggok::DoAction(), boss_drakkari_colossus::boss_drakkari_colossusAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), boss_palehoof::boss_palehoofAI::DoAction(), npc_massive_jormungar::npc_massive_jormungarAI::DoAction(), npc_ferocious_rhino::npc_ferocious_rhinoAI::DoAction(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::DoAction(), npc_frenzied_worgen::npc_frenzied_worgenAI::DoAction(), boss_skadi::boss_skadiAI::DoAction(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DoAction(), boss_essence_of_desire::boss_essence_of_desireAI::DoAction(), boss_essence_of_anger::boss_essence_of_angerAI::DoAction(), boss_the_lurker_below::boss_the_lurker_belowAI::DoAction(), boss_kelidan_the_breaker::boss_kelidan_the_breakerAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::EnterEvadeMode(), npc_little_ooze::npc_little_oozeAI::EnterEvadeMode(), npc_big_ooze::npc_big_oozeAI::EnterEvadeMode(), RestoreFight::Execute(), spell_teron_gorefiend_shadowy_construct::spell_teron_gorefiend_shadowy_construct_AuraScript::HandleEffectApply(), spell_mutate_explode_bug::HandleOnHit(), spell_the_lich_king_vile_spirit_move_target_search::spell_the_lich_king_vile_spirit_move_target_search_SpellScript::HandleScript(), spell_putricide_mutated_transformation::spell_putricide_mutated_transformation_SpellScript::HandleSummon(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::InitFight(), boss_glob_of_viscidus::InitializeAI(), brann_bronzebeard::brann_bronzebeardAI::InitializeEvent(), npc_corrupted_totem::IsSummonedBy(), npc_living_inferno::npc_living_infernoAI::IsSummonedBy(), boss_felblood_kaelthas::boss_felblood_kaelthasAI::JustEngagedWith(), boss_headless_horseman::JustEngagedWith(), boss_volazj::JustEngagedWith(), boss_twilight_halion::boss_twilight_halionAI::JustEngagedWith(), boss_faction_championsAI::JustEngagedWith(), npc_risen_archmage::npc_risen_archmageAI::JustEngagedWith(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::JustEngagedWith(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::JustEngagedWith(), boss_drakos::boss_drakosAI::JustEngagedWith(), boss_eregos::boss_eregosAI::JustEngagedWith(), boss_urom::boss_uromAI::JustEngagedWith(), boss_varos::boss_varosAI::JustEngagedWith(), boss_bjarngrim::boss_bjarngrimAI::JustEngagedWith(), boss_ionar::boss_ionarAI::JustEngagedWith(), boss_loken::boss_lokenAI::JustEngagedWith(), boss_volkhan::boss_volkhanAI::JustEngagedWith(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustEngagedWith(), boss_flame_leviathan::boss_flame_leviathanAI::JustEngagedWith(), boss_freya::boss_freyaAI::JustEngagedWith(), boss_vezax::boss_vezaxAI::JustEngagedWith(), boss_razorscale::boss_razorscaleAI::JustEngagedWith(), boss_xt002::boss_xt002AI::JustEngagedWith(), boss_skadi::boss_skadiAI::JustEngagedWith(), boss_skadi_grauf::boss_skadi_graufAI::JustEngagedWith(), boss_svala::boss_svalaAI::JustEngagedWith(), npc_frozen_orb::npc_frozen_orbAI::JustEngagedWith(), boss_nexusprince_shaffar::boss_nexusprince_shaffarAI::JustEngagedWith(), boss_pandemonius::boss_pandemoniusAI::JustEngagedWith(), boss_olm_the_summoner::JustEngagedWith(), boss_kiggler_the_crazed::JustEngagedWith(), boss_blindeye_the_seer::JustEngagedWith(), boss_krosh_firehand::JustEngagedWith(), boss_harbinger_skyriss::boss_harbinger_skyrissAI::JustEngagedWith(), boss_thaddius_summon::boss_thaddius_summonAI::JustEngagedWith(), boss_the_lich_king::boss_the_lich_kingAI::JustEngagedWith(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::JustEngagedWith(), boss_trollgore::boss_trollgoreAI::JustEngagedWith(), boss_sindragosa::boss_sindragosaAI::JustEngagedWith(), boss_gluth::boss_gluthAI::JustEngagedWith(), boss_gothik::boss_gothikAI::JustEngagedWith(), boss_grobbulus::boss_grobbulusAI::JustEngagedWith(), boss_heigan::boss_heiganAI::JustEngagedWith(), boss_loatheb::boss_loathebAI::JustEngagedWith(), boss_maexxna::boss_maexxnaAI::JustEngagedWith(), boss_patchwerk::boss_patchwerkAI::JustEngagedWith(), boss_thaddius::boss_thaddiusAI::JustEngagedWith(), boss_steelbreaker::boss_steelbreakerAI::JustEngagedWith(), boss_runemaster_molgeim::boss_runemaster_molgeimAI::JustEngagedWith(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::JustEngagedWith(), boss_anubrekhan::boss_anubrekhanAI::JustSummoned(), boss_grobbulus::boss_grobbulusAI::JustSummoned(), boss_loatheb::boss_loathebAI::JustSummoned(), boss_maexxna::boss_maexxnaAI::JustSummoned(), boss_auriaya::boss_auriayaAI::JustSummoned(), npc_ouro_spawner::JustSummoned(), npc_dirt_mound::JustSummoned(), boss_dalronn_the_controller::boss_dalronn_the_controllerAI::JustSummoned(), boss_urom::boss_uromAI::JustSummoned(), npc_hor_lich_king::npc_hor_lich_kingAI::JustSummoned(), boss_curator::boss_curatorAI::JustSummoned(), npc_demonic_vapor_trail::npc_demonic_vapor_trailAI::JustSummoned(), npc_kiljaeden_controller::npc_kiljaeden_controllerAI::JustSummoned(), boss_muru::boss_muruAI::JustSummoned(), boss_hazzarah::JustSummoned(), npc_hive_zara_larva::JustSummoned(), boss_anub_arak::boss_anub_arakAI::JustSummoned(), boss_novos::boss_novosAI::JustSummoned(), boss_slad_ran::boss_slad_ranAI::JustSummoned(), boss_professor_putricide::boss_professor_putricideAI::JustSummoned(), boss_noth::boss_nothAI::JustSummoned(), boss_magus_telestra::boss_magus_telestraAI::JustSummoned(), npc_creature_generator_akama::npc_creature_generator_akamaAI::JustSummoned(), boss_hydross_the_unstable::boss_hydross_the_unstableAI::JustSummoned(), boss_the_lurker_below::boss_the_lurker_belowAI::JustSummoned(), boss_morogrim_tidewalker::boss_morogrim_tidewalkerAI::JustSummoned(), boss_ahune::boss_ahuneAI::JustSummoned(), boss_omor_the_unscarred::boss_omor_the_unscarredAI::JustSummoned(), boss_vazruden_the_herald::boss_vazruden_the_heraldAI::JustSummoned(), boss_harbinger_skyriss::boss_harbinger_skyrissAI::JustSummoned(), boss_high_astromancer_solarian::boss_high_astromancer_solarianAI::JustSummoned(), boss_nethermancer_sepethrea::boss_nethermancer_sepethreaAI::JustSummoned(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::MoveInLineOfSight(), boss_grand_warlock_nethekurse::boss_grand_warlock_nethekurseAI::MoveInLineOfSight(), boss_kaelthas::boss_kaelthasAI::MoveInLineOfSight(), boss_captain_skarloc::boss_captain_skarlocAI::MovementInform(), boss_four_horsemen::boss_four_horsemenAI::MovementInform(), boss_headless_horseman::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), boss_sartharion_dragonAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), npc_gunship_mage::npc_gunship_mageAI::MovementInform(), npc_ulduar_saronite_animus::npc_ulduar_saronite_animusAI::npc_ulduar_saronite_animusAI(), boss_headless_horseman_head::Reset(), npc_twilight_summon::npc_twilight_summonAI::Reset(), boss_twilight_halion::boss_twilight_halionAI::Reset(), boss_yoggsaron_guardian_of_ys::boss_yoggsaron_guardian_of_ysAI::Reset(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::Reset(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::Reset(), instance_naxxramas::instance_naxxramas_InstanceMapScript::SetBossState(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::SetData(), npc_argent_captainAI::SpellHit(), spell_putricide_ooze_channel::spell_putricide_ooze_channel_SpellScript::StartAttack(), brann_bronzebeard::brann_bronzebeardAI::SummonCreatures(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::SummonedCreatureDies(), Update(), boss_shade_of_aran::boss_aranAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), boss_entropius::boss_entropiusAI::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), boss_krik_thir::boss_krik_thirAI::UpdateAI(), boss_falric::boss_falricAI::UpdateAI(), boss_marwyn::boss_marwynAI::UpdateAI(), npc_phantom_hallucination::npc_phantom_hallucinationAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_vengeful_shade::npc_vengeful_shadeAI::UpdateAI(), npc_little_ooze::npc_little_oozeAI::UpdateAI(), npc_big_ooze::npc_big_oozeAI::UpdateAI(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_flame_leviathan::boss_flame_leviathanAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_ahune::boss_ahuneAI::UpdateAI(), and npc_onyx_flamecaller::npc_onyx_flamecallerAI::WaypointReached().

◆ SetLastDamagedTime()

void Creature::SetLastDamagedTime ( time_t  val)
3584{
3585 if (val > 0)
3586 {
3587 if (_lastDamagedTime)
3588 *_lastDamagedTime = val;
3589 else
3590 _lastDamagedTime = std::make_shared<time_t>(val);
3591 }
3592 else
3593 _lastDamagedTime.reset();
3594}

References _lastDamagedTime.

Referenced by CreatureAI::_EnterEvadeMode(), Unit::DealDamage(), npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode(), npc_pet_hunter_snake_trap::EnterEvadeMode(), and AssistDelayEvent::Execute().

◆ SetLastDamagedTimePtr()

void Creature::SetLastDamagedTimePtr ( std::shared_ptr< time_t > const &  val)
3597{
3598 _lastDamagedTime = val;
3599}

References _lastDamagedTime.

Referenced by AssistDelayEvent::Execute().

◆ SetLootMode()

◆ SetLootRecipient()

void Creature::SetLootRecipient ( Unit unit,
bool  withGroup = true 
)
1293{
1294 // set the player whose group should receive the right
1295 // to loot the creature after it dies
1296 // should be set to nullptr after the loot disappears
1297
1298 if (!unit)
1299 {
1304 return;
1305 }
1306
1308 if (!player) // normal creature, no player involved
1309 return;
1310
1311 m_lootRecipient = player->GetGUID();
1312
1313 Map* map = GetMap();
1314 if (map && map->IsDungeon() && (isWorldBoss() || IsDungeonBoss()))
1315 {
1317 }
1318
1319 if (withGroup)
1320 {
1321 if (Group* group = player->GetGroup())
1322 {
1323 m_lootRecipientGroup = group->GetGUID().GetCounter();
1324
1325 if (map && map->IsDungeon() && (isWorldBoss() || IsDungeonBoss()))
1326 {
1327 Map::PlayerList const& PlayerList = map->GetPlayers();
1328 for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
1329 {
1330 if (Player* groupMember = i->GetSource())
1331 {
1332 if (groupMember->IsGameMaster() || groupMember->IsSpectator())
1333 {
1334 continue;
1335 }
1336
1337 if (groupMember->GetGroup() == group)
1338 {
1339 AddAllowedLooter(groupMember->GetGUID());
1340 }
1341 }
1342 }
1343 }
1344 }
1345 }
1346 else
1348
1350}
@ UNIT_DYNFLAG_TAPPED
Definition: SharedDefines.h:3095
@ UNIT_DYNFLAG_LOOTABLE
Definition: SharedDefines.h:3093
Definition: LinkedList.h:139
bool IsDungeonBoss() const
Definition: Creature.cpp:3063
virtual void RemoveDynamicFlag(uint32 flag)
Definition: Object.h:118
virtual void SetDynamicFlag(uint32 flag)
Definition: Object.h:117
void ResetAllowedLooters()
Definition: Object.cpp:3126
void AddAllowedLooter(ObjectGuid guid)
Definition: Object.cpp:3116
void Clear()
Definition: ObjectGuid.h:140
Group * GetGroup()
Definition: Player.h:2418
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition: Unit.cpp:10576
Definition: Map.h:312
bool IsDungeon() const
Definition: Map.h:447
PlayerList const & GetPlayers() const
Definition: Map.h:484
Definition: MapRefMgr.h:26
iterator begin()
Definition: MapRefMgr.h:36
iterator end()
Definition: MapRefMgr.h:37

References WorldObject::AddAllowedLooter(), MapRefMgr::begin(), ObjectGuid::Clear(), MapRefMgr::end(), Unit::GetCharmerOrOwnerPlayerOrPlayerItself(), Player::GetGroup(), Object::GetGUID(), WorldObject::GetMap(), Map::GetPlayers(), Map::IsDungeon(), IsDungeonBoss(), isWorldBoss(), m_lootRecipient, m_lootRecipientGroup, Object::RemoveDynamicFlag(), WorldObject::ResetAllowedLooters(), Object::SetDynamicFlag(), UNIT_DYNFLAG_LOOTABLE, and UNIT_DYNFLAG_TAPPED.

Referenced by CreatureAI::_EnterEvadeMode(), npc_heated_battle::npc_heated_battleAI::DamageTaken(), Unit::DealDamage(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::EnterEvadeMode(), npc_varian_wrynn::npc_varian_wrynnAI::EnterEvadeMode(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode(), npc_pet_hunter_snake_trap::EnterEvadeMode(), npc_escortAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), hyjalAI::EnterEvadeMode(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::HealReceived(), boss_razorgore::boss_razorgoreAI::JustDied(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustEngagedWith(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustEngagedWith(), Unit::Kill(), boss_urom::boss_uromAI::LeaveCombat(), npc_target_dummy::npc_target_dummyAI::Reset(), Player::SendLoot(), setDeathState(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), and npc_target_dummy::npc_target_dummyAI::UpdateAI().

◆ SetMeleeDamageSchool()

void Creature::SetMeleeDamageSchool ( SpellSchools  school)
inline

◆ SetNoCallAssistance()

◆ SetNoSearchAssistance()

void Creature::SetNoSearchAssistance ( bool  val)
inline

◆ SetObjectScale()

void Creature::SetObjectScale ( float  scale)
overridevirtual

Reimplemented from Object.

3387{
3388 Unit::SetObjectScale(scale);
3389
3390 float combatReach = DEFAULT_WORLD_OBJECT_SIZE;
3391
3392 if (CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelInfo(GetDisplayId()))
3393 {
3394 SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, (IsPet() ? 1.0f : minfo->bounding_radius) * scale);
3395 if (minfo->combat_reach > 0)
3396 combatReach = minfo->combat_reach;
3397 }
3398
3399 if (IsPet())
3400 combatReach = DEFAULT_COMBAT_REACH;
3401
3402 SetFloatValue(UNIT_FIELD_COMBATREACH, combatReach * scale);
3403}
virtual void SetObjectScale(float scale)
Definition: Object.h:113
uint32 GetDisplayId() const
Definition: Unit.h:2168

References DEFAULT_COMBAT_REACH, DEFAULT_WORLD_OBJECT_SIZE, Unit::GetDisplayId(), Unit::IsPet(), Object::SetFloatValue(), Object::SetObjectScale(), sObjectMgr, UNIT_FIELD_BOUNDINGRADIUS, and UNIT_FIELD_COMBATREACH.

Referenced by wp_commandscript::HandleWpShowCommand(), InitEntry(), Guardian::InitStatsForLevel(), npc_memory::npc_memoryAI::npc_memoryAI(), boss_freya_nature_bomb::boss_freya_nature_bombAI::Reset(), boss_sartharion::boss_sartharionAI::SendLavaWaves(), npc_soh_fire_trigger::SpellHit(), npc_simon_bunny::npc_simon_bunnyAI::StartGame(), npc_memory::npc_memoryAI::UpdateAI(), and npc_frost_sphere::npc_frost_sphereAI::UpdateAI().

◆ SetOriginalEntry()

void Creature::SetOriginalEntry ( uint32  entry)
inline
359{ m_originalEntry = entry; }

References m_originalEntry.

Referenced by CreateFromProto().

◆ SetPickPocketLootTime()

void Creature::SetPickPocketLootTime ( )
3649{
3651}
constexpr auto MINUTE
Definition: Common.h:56
time_t const & GetRespawnTime() const
Definition: Creature.h:277
uint32 GetCorpseDelay() const
Definition: Creature.h:74

References GetCorpseDelay(), GameTime::GetGameTime(), GetRespawnTime(), lootPickPocketRestoreTime, and MINUTE.

Referenced by Player::SendLoot().

◆ SetPosition() [1/2]

void Creature::SetPosition ( const Position pos)
inline

◆ SetPosition() [2/2]

void Creature::SetPosition ( float  x,
float  y,
float  z,
float  o 
)
3056{
3057 if (!Acore::IsValidMapCoord(x, y, z, o))
3058 return;
3059
3060 GetMap()->CreatureRelocation(this, x, y, z, o);
3061}
void CreatureRelocation(Creature *creature, float x, float y, float z, float o)
Definition: Map.cpp:1025

References Map::CreatureRelocation(), WorldObject::GetMap(), and Acore::IsValidMapCoord().

Referenced by npc_power_spark::npc_power_sparkAI::DamageTaken(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::DoAction(), CastArmageddon::Execute(), npc_commandscript::HandleNpcMoveCommand(), npc_frost_wyrm::npc_frost_wyrmAI::JustDied(), npc_gargoyle::npc_gargoyleAI::JustDied(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::JustSummoned(), boss_kiljaeden::boss_kiljaedenAI::JustSummoned(), npc_escortAI::MovementInform(), SmartAI::MovepointReached(), npc_vortex_ride::npc_vortex_rideAI::npc_vortex_rideAI(), instance_pit_of_saron::instance_pit_of_saron_InstanceScript::OnCreatureCreate(), instance_ulduar::instance_ulduar_InstanceMapScript::OnCreatureCreate(), FrostwingGauntletRespawner::operator()(), ValithriaDespawner::operator()(), RemoveCorpse(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::Reset(), boss_four_horsemen::boss_four_horsemenAI::Reset(), boss_thaddius::boss_thaddiusAI::Reset(), npc_simone::npc_simoneAI::RespawnPet(), instance_naxxramas::instance_naxxramas_InstanceMapScript::SetBossState(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::SpawnAdds(), npc_highborne_lamenter::npc_highborne_lamenterAI::UpdateAI(), npc_oculus_drakegiver::npc_oculus_drakegiverAI::UpdateAI(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::UpdateAI(), npc_battle_at_valhalas::npc_battle_at_valhalasAI::UpdateAI(), boss_alar::boss_alarAI::UpdateAI(), boss_high_astromancer_solarian::boss_high_astromancer_solarianAI::UpdateAI(), and Unit::UpdateSplinePosition().

◆ SetReactState()

void Creature::SetReactState ( ReactStates  st)
inline
89{ m_reactState = st; }

References m_reactState.

Referenced by boss_halion::boss_halionAI::AttackStart(), boss_faction_championsAI::boss_faction_championsAI(), boss_felmyst::boss_felmystAI::boss_felmystAI(), boss_glob_of_viscidus::boss_glob_of_viscidus(), boss_gormok::boss_gormokAI::boss_gormokAI(), boss_grand_champion::boss_grand_championAI::boss_grand_championAI(), boss_icehowl::boss_icehowlAI::boss_icehowlAI(), boss_jaraxxus::boss_jaraxxusAI::boss_jaraxxusAI(), boss_jarien::boss_jarien(), boss_jormungarAI::boss_jormungarAI(), boss_kiljaeden::boss_kiljaedenAI::boss_kiljaedenAI(), boss_sothos::boss_sothos(), boss_the_lich_king::boss_the_lich_kingAI::boss_the_lich_kingAI(), boss_twin_valkyrAI::boss_twin_valkyrAI(), boss_tyrannus::boss_tyrannusAI::boss_tyrannusAI(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::boss_valithria_dreamwalkerAI(), CharmInfo::CharmInfo(), boss_thekal::boss_thekalAI::CheckPhaseTransition(), boss_garfrost::boss_garfrostAI::DamageTaken(), boss_professor_putricide::boss_professor_putricideAI::DamageTaken(), boss_felblood_kaelthas::boss_felblood_kaelthasAI::DamageTaken(), boss_kiljaeden::boss_kiljaedenAI::DamageTaken(), boss_thekal::boss_thekalAI::DamageTaken(), boss_ayamiss::DamageTaken(), boss_jedoga_shadowseeker::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), npc_crystalline_frayer::npc_crystalline_frayerAI::DamageTaken(), boss_algalon_the_observer::boss_algalon_the_observerAI::DamageTaken(), boss_freya::boss_freyaAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), boss_alar::boss_alarAI::DamageTaken(), boss_taerar::boss_taerarAI::DamageTaken(), boss_viscidus::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_bug_trio::DamageTaken(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::Deactivate(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::DoAction(), boss_thekal::boss_thekalAI::DoAction(), boss_bug_trio::DoAction(), boss_twinemperorsAI::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), npc_living_constellation::npc_living_constellationAI::DoAction(), boss_broggok::DoAction(), npc_living_mojo::npc_living_mojoAI::DoAction(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DoAction(), boss_essence_of_desire::boss_essence_of_desireAI::DoAction(), boss_essence_of_anger::boss_essence_of_angerAI::DoAction(), boss_the_lurker_below::boss_the_lurker_belowAI::DoAction(), boss_kelidan_the_breaker::boss_kelidan_the_breakerAI::DoAction(), boss_nazan::boss_nazanAI::DoAction(), boss_skeram::DoTeleport(), Spell::EffectSummonPet(), Spell::EffectSummonType(), boss_ouro::Emerge(), boss_the_lich_king::boss_the_lich_kingAI::EnterEvadeMode(), RestoreAttack::Execute(), OrcMoveEvent::Execute(), RestoreFight::Execute(), UtherBatteredHiltEvent::Execute(), StartMovementEvent::Execute(), VileSpiritActivateEvent::Execute(), SACActivateEvent::Execute(), SACDeactivateEvent::Execute(), AssistanceDistractMovementGenerator::Finalize(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::FlyAway(), boss_volkhan::boss_volkhanAI::GoToAnvil(), spell_mc_play_dead::spell_mc_play_dead_AuraScript::HandleEffectApply(), spell_uldaman_stoned::spell_uldaman_stoned_AuraScript::HandleEffectApply(), spell_gen_creature_permanent_feign_death::HandleEffectApply(), spell_mc_play_dead::spell_mc_play_dead_AuraScript::HandleEffectRemove(), spell_uldaman_stoned::spell_uldaman_stoned_AuraScript::HandleEffectRemove(), spell_gen_creature_permanent_feign_death::HandleEffectRemove(), boss_ragnaros::boss_ragnarosAI::HandleEmerge(), spell_mutate_explode_bug::HandleOnHit(), WorldSession::HandlePetActionHelper(), spell_item_draenic_pale_ale::HandleSummon(), Battlefield::HideNpc(), npc_wounded_skirmisher::Initialize(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::InitializeAI(), npc_general_andorov::InitializeAI(), boss_eck::boss_eckAI::InitializeAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::InitializeAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::InitializeAI(), boss_prince_valanar_icc::boss_prince_valanarAI::InitializeAI(), boss_sapphiron::boss_sapphironAI::InitializeAI(), npc_lord_arete::npc_lord_areteAI::InitializeAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), InitializeReactState(), Minion::InitStats(), Guardian::InitStats(), Puppet::InitStats(), Guardian::InitStatsForLevel(), Totem::InitSummon(), boss_jarien::IsSummonedBy(), boss_sothos::IsSummonedBy(), boss_aeonus::IsSummonedBy(), npc_lk_wicked_spirit::npc_lk_wicked_spiritAI::JustDied(), boss_venoxis::boss_venoxisAI::JustEngagedWith(), boss_sister_svalna::boss_sister_svalnaAI::JustEngagedWith(), boss_laj::JustEngagedWith(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustEngagedWith(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustEngagedWith(), boss_four_horsemen::boss_four_horsemenAI::JustEngagedWith(), boss_kelthuzad::boss_kelthuzadAI::JustEngagedWith(), boss_the_lich_king::boss_the_lich_kingAI::JustReachedHome(), npc_lk_wicked_spirit::npc_lk_wicked_spiritAI::JustRespawned(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), boss_skeram::JustSummoned(), boss_majordomo::boss_majordomoAI::JustSummoned(), boss_selin_fireheart::boss_selin_fireheartAI::JustSummoned(), boss_hazzarah::JustSummoned(), boss_jindo::JustSummoned(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustSummoned(), boss_novos::boss_novosAI::JustSummoned(), boss_bronjahm::boss_bronjahmAI::JustSummoned(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustSummoned(), boss_prince_valanar_icc::boss_prince_valanarAI::JustSummoned(), boss_professor_putricide::boss_professor_putricideAI::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), boss_illidan_stormrage::boss_illidan_stormrageAI::JustSummoned(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::JustSummoned(), npc_creature_generator_akama::npc_creature_generator_akamaAI::JustSummoned(), boss_grand_warlock_nethekurse::boss_grand_warlock_nethekurseAI::JustSummoned(), boss_ick::boss_ickAI::KilledUnit(), Pet::LoadPetFromDB(), boss_ayamiss::MovementInform(), boss_bug_trio::MovementInform(), boss_grand_champion::boss_grand_championAI::MovementInform(), boss_eck::boss_eckAI::MovementInform(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::MovementInform(), boss_sister_svalna::boss_sister_svalnaAI::MovementInform(), boss_four_horsemen::boss_four_horsemenAI::MovementInform(), boss_volkhan::boss_volkhanAI::MovementInform(), boss_nazan::boss_nazanAI::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_rimefang::npc_rimefangAI::MovementInform(), boss_kaelthas::boss_kaelthasAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), gunship_npc_AI::MovementInform(), npc_gunship_boarding_addAI::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), boss_icehowl::boss_icehowlAI::MovementInform(), MotionMaster::MoveSeekAssistance(), npc_anubarak_spike::npc_anubarak_spikeAI::npc_anubarak_spikeAI(), npc_arcanite_dragonling::npc_arcanite_dragonling(), npc_argent_soldier::npc_argent_soldierAI::npc_argent_soldierAI(), npc_buru_egg::npc_buru_egg(), npc_chess_move_trigger::npc_chess_move_trigger(), npc_concentrated_ball::npc_concentrated_ballAI::npc_concentrated_ballAI(), npc_dark_iron_guzzler::npc_dark_iron_guzzler(), npc_eye_of_acherus::npc_eye_of_acherus(), npc_frost_freeze_trap::npc_frost_freeze_trapAI::npc_frost_freeze_trapAI(), npc_grand_magister_rommath::npc_grand_magister_rommathAI::npc_grand_magister_rommathAI(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::npc_icc_ice_sphereAI(), npc_ice_tomb::npc_ice_tombAI::npc_ice_tombAI(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::npc_koltira_deathweaverAI(), npc_living_constellation::npc_living_constellationAI::npc_living_constellationAI(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::npc_lk_spirit_bombAI(), npc_memory::npc_memoryAI::npc_memoryAI(), npc_nexus_lord::npc_nexus_lordAI::npc_nexus_lordAI(), npc_pet_gen_valkyr_guardian::npc_pet_gen_valkyr_guardian(), npc_pilgrims_bounty_chair::npc_pilgrims_bounty_chair(), npc_putricide_oozeAI::npc_putricide_oozeAI(), npc_q24545_vegard::npc_q24545_vegardAI::npc_q24545_vegardAI(), npc_saurfang_event::npc_saurfang_eventAI::npc_saurfang_eventAI(), npc_scarlet_miner::npc_scarlet_minerAI::npc_scarlet_minerAI(), npc_scion_of_eternity::npc_scion_of_eternityAI::npc_scion_of_eternityAI(), npc_snobold_vassal::npc_snobold_vassalAI::npc_snobold_vassalAI(), npc_suppresser::npc_suppresserAI::npc_suppresserAI(), npc_taldaram_flamesphere::npc_taldaram_flamesphere(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::npc_the_lich_king_controllerAI(), npc_toxic_slime::npc_toxic_slime(), npc_ulduar_expedition_commander::npc_ulduar_expedition_commanderAI::npc_ulduar_expedition_commanderAI(), npc_ulduar_hodir_druid::npc_ulduar_hodir_druidAI::npc_ulduar_hodir_druidAI(), npc_ulduar_hodir_mage::npc_ulduar_hodir_mageAI::npc_ulduar_hodir_mageAI(), npc_ulduar_hodir_priest::npc_ulduar_hodir_priestAI::npc_ulduar_hodir_priestAI(), npc_ulduar_hodir_shaman::npc_ulduar_hodir_shamanAI::npc_ulduar_hodir_shamanAI(), npc_unworthy_initiate::npc_unworthy_initiateAI::npc_unworthy_initiateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::npc_valkyr_shadowguardAI(), npc_zafod_boombox::npc_zafod_boomboxAI::npc_zafod_boomboxAI(), NullCreatureAI::NullCreatureAI(), spell_halion_twilight_phasing::spell_halion_twilight_phasing_AuraScript::OnApply(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::OnCreatureCreate(), instance_zulfarrak::instance_zulfarrak_InstanceMapScript::OnCreatureCreate(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), spell_halion_twilight_phasing::spell_halion_twilight_phasing_AuraScript::OnRemove(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::PassengerBoarded(), PassiveAI::PassiveAI(), boss_nefarian::PathEndReached(), boss_jeklik::PathEndReached(), PossessedAI::PossessedAI(), npc_dark_iron_attack_generator::PrepareEvent(), SmartScript::ProcessAction(), boss_lord_valthalak::boss_lord_valthalakAI::Reset(), boss_nefarian::Reset(), boss_vaelastrasz::boss_vaelAI::Reset(), boss_ragnaros::boss_ragnarosAI::Reset(), boss_mr_smite::boss_mr_smiteAI::Reset(), npc_chesspiece::Reset(), boss_midnight::boss_midnightAI::Reset(), boss_servant_quarters::Reset(), npc_crusade_persuaded::npc_crusade_persuadedAI::Reset(), boss_felmyst::boss_felmystAI::Reset(), boss_kalecgos::boss_kalecgosAI::Reset(), boss_muru::boss_muruAI::Reset(), boss_entropius::boss_entropiusAI::Reset(), boss_jeklik::Reset(), boss_renataki::boss_renatakiAI::Reset(), boss_thekal::boss_thekalAI::Reset(), boss_venoxis::boss_venoxisAI::Reset(), npc_brew_bubble::Reset(), npc_hallows_end_soh::Reset(), npc_love_in_air_snivel::Reset(), boss_onyxia::Reset(), npc_belnistrasz::npc_belnistraszAI::Reset(), boss_ayamiss::Reset(), boss_eye_of_cthun::Reset(), boss_sartura::Reset(), npc_sartura_royal_guard::Reset(), boss_skeram::Reset(), npc_death_ravager::npc_death_ravagerAI::Reset(), npc_murkdeep::npc_murkdeepAI::Reset(), npc_troll_volunteer::npc_troll_volunteerAI::Reset(), npc_enraged_panther::npc_enraged_pantherAI::Reset(), npc_amanitar_mushrooms::Reset(), boss_jedoga_shadowseeker::Reset(), boss_halion::boss_halionAI::Reset(), boss_twilight_halion::boss_twilight_halionAI::Reset(), boss_saviana_ragefire::boss_saviana_ragefireAI::Reset(), boss_eadric::boss_eadricAI::Reset(), boss_paletress::boss_paletressAI::Reset(), boss_black_knight::boss_black_knightAI::Reset(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::Reset(), boss_grand_champion::boss_grand_championAI::Reset(), boss_devourer_of_souls::boss_devourer_of_soulsAI::Reset(), boss_garfrost::boss_garfrostAI::Reset(), boss_ick::boss_ickAI::Reset(), boss_prince_keleseth_icc::boss_prince_kelesethAI::Reset(), boss_prince_taldaram_icc::boss_prince_taldaramAI::Reset(), boss_prince_valanar_icc::boss_prince_valanarAI::Reset(), npc_dark_nucleus::npc_dark_nucleusAI::Reset(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::Reset(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::Reset(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::Reset(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::Reset(), boss_lord_marrowgar::Reset(), boss_professor_putricide::boss_professor_putricideAI::Reset(), boss_sindragosa::boss_sindragosaAI::Reset(), npc_spinestalker::npc_spinestalkerAI::Reset(), npc_rimefang::npc_rimefangAI::Reset(), npc_tirion_fordring_tft::npc_tirion_fordringAI::Reset(), npc_lk_wicked_spirit::npc_lk_wicked_spiritAI::Reset(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::Reset(), npc_crok_scourgebane::npc_crok_scourgebaneAI::Reset(), boss_sister_svalna::boss_sister_svalnaAI::Reset(), npc_impaling_spear::npc_impaling_spearAI::Reset(), boss_four_horsemen::boss_four_horsemenAI::Reset(), boss_gluth::boss_gluthAI::Reset(), boss_gothik::boss_gothikAI::Reset(), npc_boss_gothik_minion::npc_boss_gothik_minionAI::Reset(), boss_kelthuzad::boss_kelthuzadAI::Reset(), boss_noth::boss_nothAI::Reset(), boss_sapphiron::boss_sapphironAI::Reset(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::Reset(), boss_volkhan::boss_volkhanAI::Reset(), brann_bronzebeard::brann_bronzebeardAI::Reset(), boss_algalon_the_observer::boss_algalon_the_observerAI::Reset(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::Reset(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::Reset(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::Reset(), boss_thorim_sif::boss_thorim_sifAI::Reset(), npc_beryl_sorcerer::npc_beryl_sorcererAI::Reset(), npc_imprisoned_beryl_sorcerer::npc_imprisoned_beryl_sorcererAI::Reset(), npc_venture_co_straggler::npc_venture_co_stragglerAI::Reset(), npc_akama_illidan::npc_akama_illidanAI::Reset(), boss_shade_of_akama::boss_shade_of_akamaAI::Reset(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::Reset(), boss_the_lurker_below::boss_the_lurker_belowAI::Reset(), boss_broggok::Reset(), boss_kelidan_the_breaker::boss_kelidan_the_breakerAI::Reset(), boss_vazruden_the_herald::boss_vazruden_the_heraldAI::Reset(), boss_magtheridon::boss_magtheridonAI::Reset(), boss_alar::boss_alarAI::Reset(), npc_ancestral_wolf::npc_ancestral_wolfAI::Reset(), npc_bessy::npc_bessyAI::Reset(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::Reset(), emerald_dragonAI::Reset(), Unit::SetCharmedBy(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::SetData(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::SetData(), gunship_npc_AI::SetData(), npc_gunship_boarding_addAI::SetData(), CreatureAI::SetGazeOn(), BfGraveyard::SetSpirit(), npc_akama_illidan::npc_akama_illidanAI::sGossipSelect(), Battlefield::ShowNpc(), boss_viscidus::SoftReset(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::SpellHit(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::SpellHit(), npc_ulduar_vx001::npc_ulduar_vx001AI::SpellHit(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::SpellHit(), boss_attumen::boss_attumenAI::SpellHit(), npc_crusade_persuaded::npc_crusade_persuadedAI::SpellHit(), npc_venture_co_straggler::npc_venture_co_stragglerAI::SpellHit(), boss_garfrost::boss_garfrostAI::SpellHitTarget(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), boss_ick::boss_ickAI::SpellHitTarget(), boss_noth::boss_nothAI::StartBalconyPhase(), instance_violet_hold::instance_violet_hold_InstanceMapScript::StartBossEncounter(), boss_lord_valthalak::boss_lord_valthalakAI::StartFighting(), boss_heigan::boss_heiganAI::StartFightPhase(), boss_noth::boss_nothAI::StartGroundPhase(), boss_lord_valthalak::boss_lord_valthalakAI::StartTalking(), boss_ouro::Submerge(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::SummonedCreatureDies(), boss_jedoga_shadowseeker::SummonedCreatureDies(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), boss_servant_quarters::UpdateAI(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), boss_entropius::boss_entropiusAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_grilek::boss_grilekAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), npc_hallows_end_soh::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_onyxia::UpdateAI(), npc_belnistrasz::npc_belnistraszAI::UpdateAI(), boss_sartura::UpdateAI(), npc_sartura_royal_guard::UpdateAI(), boss_skeram::UpdateAI(), npc_murkdeep::npc_murkdeepAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), npc_memory::npc_memoryAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_pos_tyrannus_events::npc_pos_tyrannus_eventsAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), npc_crystalline_frayer::npc_crystalline_frayerAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_lurgglbr::npc_lurgglbrAI::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), boss_shade_of_akama::boss_shade_of_akamaAI::UpdateAI(), boss_lady_vashj::boss_lady_vashjAI::UpdateAI(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::UpdateAI(), boss_the_lurker_below::boss_the_lurker_belowAI::UpdateAI(), boss_magtheridon::boss_magtheridonAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), boss_alar::boss_alarAI::UpdateAI(), boss_kaelthas::boss_kaelthasAI::UpdateAI(), boss_taerar::boss_taerarAI::UpdateAI(), CreatureAI::UpdateVictimWithGaze(), npc_akama_illidan::npc_akama_illidanAI::WaypointReached(), npc_arthas::npc_arthasAI::WaypointReached(), npc_general_andorov::WaypointReached(), and npc_apothecary_hanes::npc_Apothecary_HanesAI::WaypointReached().

◆ SetRegeneratingHealth()

void Creature::SetRegeneratingHealth ( bool  c)
inline
310{ m_regenHealth = c; }

References m_regenHealth.

Referenced by boss_yoggsaron_brain::boss_yoggsaron_brainAI::boss_yoggsaron_brainAI(), boss_felblood_kaelthas::boss_felblood_kaelthasAI::DamageTaken(), boss_kiljaeden::boss_kiljaedenAI::DamageTaken(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_crystalline_frayer::npc_crystalline_frayerAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_yoggsaron_brain::boss_yoggsaron_brainAI::DamageTaken(), npc_twilight_volunteer::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), gunship_npc_AI::gunship_npc_AI(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustSummoned(), boss_grand_warlock_nethekurse::boss_grand_warlock_nethekurseAI::JustSummoned(), boss_grand_champion::boss_grand_championAI::MovementInform(), npc_wild_wyrm::npc_wild_wyrmAI::MovementInform(), npc_amanitar_mushrooms::npc_amanitar_mushrooms(), npc_gunship_boarding_addAI::npc_gunship_boarding_addAI(), npc_gunship::npc_gunshipAI::npc_gunshipAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::npc_high_overlord_saurfang_igbAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::npc_muradin_bronzebeard_igbAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::Reset(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::Reset(), npc_ulduar_vx001::npc_ulduar_vx001AI::Reset(), npc_blessed_banner::npc_blessed_bannerAI::Reset(), npc_wild_wyrm::npc_wild_wyrmAI::Reset(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::SetData(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), npc_crystalline_frayer::npc_crystalline_frayerAI::UpdateAI(), and boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI().

◆ SetRegeneratingPower()

void Creature::SetRegeneratingPower ( bool  c)
inline
311{ m_regenPower = c; }

References m_regenPower.

Referenced by boss_moam::Reset().

◆ SetRespawnDelay()

◆ SetRespawnTime()

◆ SetSwim()

bool Creature::SetSwim ( bool  enable)
overridevirtual

Reimplemented from Unit.

3130{
3131 if (!Unit::SetSwim(enable))
3132 return false;
3133
3135 data << GetPackGUID();
3136 SendMessageToSet(&data, true);
3137 return true;
3138}
@ SMSG_SPLINE_MOVE_STOP_SWIM
Definition: Opcodes.h:810
@ SMSG_SPLINE_MOVE_START_SWIM
Definition: Opcodes.h:809
virtual bool SetSwim(bool enable)
Definition: Unit.cpp:20837

References Object::GetPackGUID(), WorldObject::SendMessageToSet(), Unit::SetSwim(), SMSG_SPLINE_MOVE_START_SWIM, and SMSG_SPLINE_MOVE_STOP_SWIM.

Referenced by npc_depth_charge::npc_depth_chargeAI::Reset(), SmartAI::SetSwim(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), and UpdateMovementFlags().

◆ SetTarget()

void Creature::SetTarget ( ObjectGuid  guid = ObjectGuid::Empty)
overridevirtual

Implements Unit.

3425{
3426 if (!_focusSpell)
3428}

References _focusSpell, Object::SetGuidValue(), and UNIT_FIELD_TARGET.

Referenced by boss_malygos::boss_malygosAI::AttackStart(), boss_garfrost::boss_garfrostAI::DamageTaken(), boss_kiljaeden::boss_kiljaedenAI::DamageTaken(), ConfusedMovementGenerator< T >::DoFinalize(), boss_ouro::Emerge(), RestoreAttack::Execute(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), boss_kelthuzad::boss_kelthuzadAI::JustEngagedWith(), boss_illidan_stormrage::boss_illidan_stormrageAI::JustSummoned(), boss_bug_trio::MovementInform(), boss_essence_of_suffering::boss_essence_of_sufferingAI::MovementInform(), boss_essence_of_desire::boss_essence_of_desireAI::MovementInform(), boss_mr_smite::boss_mr_smiteAI::MovementInform(), boss_felmyst::boss_felmystAI::MovementInform(), boss_kaelthas::boss_kaelthasAI::MovementInform(), npc_arthas::OnGossipSelect(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::Reset(), setDeathState(), npc_harrison_jones::npc_harrison_jonesAI::SpellHit(), boss_razorscale::boss_razorscaleAI::SpellHit(), boss_garfrost::boss_garfrostAI::SpellHitTarget(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), boss_cthun::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_the_lurker_below::boss_the_lurker_belowAI::UpdateAI(), and boss_kaelthas::boss_kaelthasAI::UpdateAI().

◆ SetTransportHomePosition() [1/2]

void Creature::SetTransportHomePosition ( const Position pos)
inline

◆ SetTransportHomePosition() [2/2]

void Creature::SetTransportHomePosition ( float  x,
float  y,
float  z,
float  o 
)
inline

◆ SetWalk()

bool Creature::SetWalk ( bool  enable)
overridevirtual

Reimplemented from Unit.

3082{
3083 if (!Unit::SetWalk(enable))
3084 return false;
3085
3087 data << GetPackGUID();
3088 SendMessageToSet(&data, false);
3089 return true;
3090}
@ SMSG_SPLINE_MOVE_SET_RUN_MODE
Definition: Opcodes.h:811
@ SMSG_SPLINE_MOVE_SET_WALK_MODE
Definition: Opcodes.h:812
virtual bool SetWalk(bool enable)
Definition: Unit.cpp:20805

References Object::GetPackGUID(), WorldObject::SendMessageToSet(), Unit::SetWalk(), SMSG_SPLINE_MOVE_SET_RUN_MODE, and SMSG_SPLINE_MOVE_SET_WALK_MODE.

Referenced by boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::DestroyDoor(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), npc_saurfang_event::npc_saurfang_eventAI::DoAction(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::DoAction(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::DoAction(), npc_brann_bronzebeard_algalon::npc_brann_bronzebeard_algalonAI::DoAction(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::DoAction(), WaypointMovementGenerator< Creature >::DoFinalize(), RandomMovementGenerator< T >::DoFinalize(), ChaseMovementGenerator< T >::DoInitialize(), UtherBatteredHiltEvent::Execute(), npc_lord_arete::npc_lord_areteAI::InitializeAI(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::IsSummonedBy(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::IsSummonedBy(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::JustReachedHome(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustRespawned(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), npc_kalecgos_kj::npc_kalecgos_kjAI::JustSummoned(), npc_icc_gauntlet_controller::npc_icc_gauntlet_controllerAI::JustSummoned(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::JustSummoned(), npc_akama_shade::npc_akamaAI::JustSummoned(), boss_fathomlord_karathress::boss_fathomlord_karathressAI::JustSummoned(), boss_lady_vashj::boss_lady_vashjAI::JustSummoned(), npc_rinji::npc_rinjiAI::JustSummoned(), npc_maghar_captive::npc_maghar_captiveAI::JustSummoned(), npc_brann_bronzebeard_algalon::npc_brann_bronzebeard_algalonAI::MovementInform(), boss_mandokir::boss_mandokirAI::MovementInform(), boss_captain_skarloc::boss_captain_skarlocAI::MovementInform(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::MovementInform(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::MovementInform(), npc_thassarian2::npc_thassarian2AI::MovementInform(), boss_kaelthas::boss_kaelthasAI::MovementInform(), npc_escortAI::MovementInform(), npc_cameron::MoveTheChildren(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::npc_marzon_silent_bladeAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::npc_valkyr_shadowguardAI(), SmartAI::OnCharmed(), npc_chesspiece::OnCharmed(), npc_chesspiece::Reset(), boss_nightbane::boss_nightbaneAI::Reset(), npc_janalai_hatcher::npc_janalai_hatcherAI::Reset(), boss_nalorakk::boss_nalorakkAI::Reset(), boss_arlokk::boss_arlokkAI::Reset(), npc_dark_iron_guzzler::Reset(), npc_kinetic_bomb::npc_kinetic_bombAI::Reset(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::Reset(), npc_xt002_scrapbot::npc_xt002_scrapbotAI::Reset(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), npc_plaguehound_tracker::npc_plaguehound_trackerAI::Reset(), boss_shade_of_akama::boss_shade_of_akamaAI::Reset(), boss_kaelthas::boss_kaelthasAI::Reset(), SmartAI::ReturnToLastOOCPos(), npc_escortAI::ReturnToLastPoint(), npc_dream_fog::npc_dream_fogAI::ScheduleEvents(), npc_escortAI::SetRun(), SmartAI::SetRun(), npc_tirion_fordring_tft::npc_tirion_fordringAI::sGossipSelect(), npc_injured_patient::npc_injured_patientAI::SpellHit(), npc_escortAI::Start(), hyjalAI::SummonCreature(), boss_majordomo::boss_majordomoAI::UpdateAI(), npc_scarlet_courier::npc_scarlet_courierAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_grand_magister_rommath::npc_grand_magister_rommathAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), npc_twilight_volunteer::UpdateAI(), npc_xerestrasza::npc_xerestraszaAI::UpdateAI(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::UpdateAI(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_oculus_drakegiver::npc_oculus_drakegiverAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_shandy_dalaran::npc_shandy_dalaranAI::UpdateAI(), npc_commander_eligor_dawnbringer::npc_commander_eligor_dawnbringerAI::UpdateAI(), npc_crusade_recruit::npc_crusade_recruitAI::UpdateAI(), boss_shade_of_akama::boss_shade_of_akamaAI::UpdateAI(), npc_akama_shade::npc_akamaAI::UpdateAI(), boss_kaelthas::boss_kaelthasAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_ranger_lilatha::WaypointReached(), npc_corporal_keeshan::npc_corporal_keeshanAI::WaypointReached(), npc_emily::npc_emilyAI::WaypointReached(), and npc_isla_starmane::npc_isla_starmaneAI::WaypointReached().

◆ SetWanderDistance()

void Creature::SetWanderDistance ( float  dist)
inline

◆ SetWaterWalking()

bool Creature::SetWaterWalking ( bool  enable,
bool  packetOnly = false 
)
overridevirtual

movement counter

Reimplemented from Unit.

3208{
3209 if (!packetOnly && !Unit::SetWaterWalking(enable))
3210 return false;
3211
3212 if (m_movedByPlayer)
3213 {
3215 data << GetPackGUID();
3216 data << uint32(0);
3218
3219 data.Initialize(MSG_MOVE_WATER_WALK, 64);
3220 data << GetPackGUID();
3221 BuildMovementPacket(&data);
3222 m_movedByPlayer->ToPlayer()->SendMessageToSet(&data, false);
3223 return true;
3224 }
3225
3227 data << GetPackGUID();
3228 SendMessageToSet(&data, true);
3229 return true;
3230}
@ SMSG_MOVE_LAND_WALK
Definition: Opcodes.h:253
@ SMSG_SPLINE_MOVE_LAND_WALK
Definition: Opcodes.h:808
@ SMSG_MOVE_WATER_WALK
Definition: Opcodes.h:252
@ MSG_MOVE_WATER_WALK
Definition: Opcodes.h:719
@ SMSG_SPLINE_MOVE_WATER_WALK
Definition: Opcodes.h:807
virtual bool SetWaterWalking(bool enable, bool packetOnly=false)
Definition: Unit.cpp:20874

References Unit::BuildMovementPacket(), Object::GetPackGUID(), WorldPacket::Initialize(), Unit::m_movedByPlayer, MSG_MOVE_WATER_WALK, Player::SendDirectMessage(), WorldObject::SendMessageToSet(), Player::SendMessageToSet(), Unit::SetWaterWalking(), SMSG_MOVE_LAND_WALK, SMSG_MOVE_WATER_WALK, SMSG_SPLINE_MOVE_LAND_WALK, SMSG_SPLINE_MOVE_WATER_WALK, and Object::ToPlayer().

◆ Update()

void Creature::Update ( uint32  time)
overridevirtual

Reimplemented from WorldObject.

Reimplemented in Pet, TempSummon, Puppet, and Totem.

602{
604 {
605 TriggerJustRespawned = false;
606 AI()->JustRespawned();
607 if (m_vehicleKit)
609 }
610
611 switch (m_deathState)
612 {
613 case JUST_RESPAWNED:
614 // Must not be called, see Creature::setDeathState JUST_RESPAWNED -> ALIVE promoting.
615 LOG_ERROR("entities.unit", "Creature ({}) in wrong state: JUST_RESPAWNED (4)", GetGUID().ToString());
616 break;
617 case JUST_DIED:
618 // Must not be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting.
619 LOG_ERROR("entities.unit", "Creature ({}) in wrong state: JUST_DEAD (1)", GetGUID().ToString());
620 break;
621 case DEAD:
622 {
623 time_t now = GameTime::GetGameTime().count();
624 if (m_respawnTime <= now)
625 {
626
627 ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_RESPAWN, GetEntry());
628
629 if (!sConditionMgr->IsObjectMeetToConditions(this, conditions))
630 {
631 // Creature should not respawn, reset respawn timer. Conditions will be checked again the next time it tries to respawn.
633 break;
634 }
635
636 bool allowed = !IsAIEnabled || AI()->CanRespawn(); // First check if there are any scripts that prevent us respawning
637 if (!allowed) // Will be rechecked on next Update call
638 break;
639
640 ObjectGuid dbtableHighGuid = ObjectGuid::Create<HighGuid::Unit>(m_creatureData ? m_creatureData->id1 : GetEntry(), m_spawnId);
641 time_t linkedRespawntime = GetMap()->GetLinkedRespawnTime(dbtableHighGuid);
642
643 CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(GetEntry());
644
645 if (!linkedRespawntime || (cInfo && cInfo->HasFlagsExtra(CREATURE_FLAG_EXTRA_HARD_RESET))) // Can respawn
646 Respawn();
647 else // the master is dead
648 {
649 ObjectGuid targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid);
650 if (targetGuid == dbtableHighGuid) // if linking self, never respawn (check delayed to next day)
651 {
653 }
654 else
655 {
656 m_respawnTime = (now > linkedRespawntime ? now : linkedRespawntime) + urand(5, MINUTE); // else copy time from master and add a little
657 }
658 SaveRespawnTime(); // also save to DB immediately
659 }
660 }
661 break;
662 }
663 case CORPSE:
664 {
665 Unit::Update(diff);
666 // deathstate changed on spells update, prevent problems
667 if (m_deathState != CORPSE)
668 break;
669
671 {
672 if (m_groupLootTimer <= diff)
673 {
674 Group* group = sGroupMgr->GetGroupByGUID(lootingGroupLowGUID);
675 if (group)
676 group->EndRoll(&loot, GetMap());
679 }
680 else
681 {
682 m_groupLootTimer -= diff;
683 }
684 }
685 else if (m_corpseRemoveTime <= GameTime::GetGameTime().count())
686 {
687 RemoveCorpse(false);
688 LOG_DEBUG("entities.unit", "Removing corpse... {} ", GetUInt32Value(OBJECT_FIELD_ENTRY));
689 }
690 break;
691 }
692 case ALIVE:
693 {
694 Unit::Update(diff);
695
696 // creature can be dead after Unit::Update call
697 // CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly)
698 if (!IsAlive())
699 break;
700
701 // if creature is charmed, switch to charmed AI
702 if (NeedChangeAI)
703 {
705 NeedChangeAI = false;
706 IsAIEnabled = true;
707
708 // xinef: update combat state, if npc is not in combat - return to spawn correctly by calling EnterEvadeMode
709 SelectVictim();
710 }
711
712 // if periodic combat pulse is enabled and we are both in combat and in a dungeon, do this now
713 if (m_combatPulseDelay > 0 && IsInCombat() && GetMap()->IsDungeon())
714 {
715 if (diff > m_combatPulseTime)
717 else
718 m_combatPulseTime -= diff;
719
720 if (m_combatPulseTime == 0)
721 {
722 if (AI())
723 AI()->DoZoneInCombat();
724 else
727 }
728 }
729
730 // periodic check to see if the creature has passed an evade boundary
731 if (IsAIEnabled && !IsInEvadeMode() && IsEngaged())
732 {
733 if (diff >= m_boundaryCheckTime)
734 {
735 AI()->CheckInRoom();
736 m_boundaryCheckTime = 2500;
737 }
738 else
739 m_boundaryCheckTime -= diff;
740 }
741
742 Unit* owner = GetCharmerOrOwner();
743 if (IsCharmed() && !IsWithinDistInMap(owner, GetMap()->GetVisibilityRange(), true, false))
744 {
746 }
747
748 if (Unit* victim = GetVictim())
749 {
750 // If we are closer than 50% of the combat reach we are going to reposition the victim
751 if (diff >= m_moveBackwardsMovementTime)
752 {
753 float MaxRange = GetCollisionRadius() + GetVictim()->GetCollisionRadius();
754
755 if (IsInDist(victim, MaxRange))
757
759 }
760 else
761 {
763 }
764
765 // Circling the target
766 if (diff >= m_moveCircleMovementTime)
767 {
768 AI()->MoveCircleChecks();
770 }
771 else
772 {
774 }
775 }
776
777 // Call for assistance if not disabled
779 {
780 if (m_assistanceTimer <= diff)
781 {
783 {
784 SetNoCallAssistance(false);
786 }
788 }
789 else
790 {
791 m_assistanceTimer -= diff;
792 }
793 }
794
795 if (!IsInEvadeMode() && IsAIEnabled)
796 {
797 // do not allow the AI to be changed during update
798 m_AI_locked = true;
799 i_AI->UpdateAI(diff);
800 m_AI_locked = false;
801 }
802
803 // creature can be dead after UpdateAI call
804 // CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly)
805 if (!IsAlive())
806 break;
807
808 m_regenTimer -= diff;
809 if (m_regenTimer <= 0)
810 {
811 if (!IsInEvadeMode())
812 {
813 // regenerate health if not in combat or if polymorphed)
814 if (!IsInCombat() || IsPolymorphed())
817 {
818 // regenerate health if cannot reach the target and the setting is set to do so.
819 // this allows to disable the health regen of raid bosses if pathfinding has issues for whatever reason
820 if (sWorld->getBoolConfig(CONFIG_REGEN_HP_CANNOT_REACH_TARGET_IN_RAID) || !GetMap()->IsRaid())
821 {
823 LOG_DEBUG("entities.unit", "RegenerateHealth() enabled because Creature cannot reach the target. Detail: {}", GetDebugInfo());
824 }
825 else
826 LOG_DEBUG("entities.unit", "RegenerateHealth() disabled even if the Creature cannot reach the target. Detail: {}", GetDebugInfo());
827 }
828 }
829
830 if (getPowerType() == POWER_ENERGY)
832 else
834
836 }
837
839 {
840 m_cannotReachTimer += diff;
842 {
843 Player* cannotReachPlayer = ObjectAccessor::GetPlayer(*this, m_cannotReachTarget);
844 if (cannotReachPlayer && IsEngagedBy(cannotReachPlayer) && IsAIEnabled && AI()->OnTeleportUnreacheablePlayer(cannotReachPlayer))
845 {
847 }
848 else if (!GetMap()->IsRaid())
849 {
850 auto EnterEvade = [&]()
851 {
852 if (CreatureAI* ai = AI())
853 {
855 }
856 };
857
858 if (GetThreatMgr().GetThreatListSize() <= 1)
859 {
860 EnterEvade();
861 }
862 else
863 {
864 if (HostileReference* ref = GetThreatMgr().GetOnlineContainer().getReferenceByTarget(m_cannotReachTarget))
865 {
866 ref->removeReference();
868 }
869 else
870 {
871 EnterEvade();
872 }
873 }
874 }
875 }
876 }
877 break;
878 }
879 default:
880 break;
881 }
882
884 {
885 // pussywizard:
886 if (GetOwnerGUID().IsPlayer())
887 {
888 if (m_transportCheckTimer <= diff)
889 {
892 if (newTransport != GetTransport())
893 {
894 if (GetTransport())
895 GetTransport()->RemovePassenger(this, true);
896 if (newTransport)
897 newTransport->AddPassenger(this, true);
899 //SendMovementFlagUpdate();
900 }
901 }
902 else
903 m_transportCheckTimer -= diff;
904 }
905
906 sScriptMgr->OnCreatureUpdate(this, diff);
907 }
908}
constexpr auto DAY
Definition: Common.h:58
#define sConditionMgr
Definition: ConditionMgr.h:289
@ CONDITION_SOURCE_TYPE_CREATURE_RESPAWN
Definition: ConditionMgr.h:151
std::list< Condition * > ConditionList
Definition: ConditionMgr.h:236
@ CREATURE_FLAG_EXTRA_HARD_RESET
Definition: CreatureData.h:80
@ OBJECT_FIELD_ENTRY
Definition: UpdateFields.h:27
@ CONFIG_NPC_EVADE_IF_NOT_REACHABLE
Definition: IWorld.h:407
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_PERIOD
Definition: IWorld.h:282
@ CONFIG_REGEN_HP_CANNOT_REACH_TARGET_IN_RAID
Definition: IWorld.h:169
Player * GetPlayer(Map const *, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:225
virtual void UpdateAI(uint32)=0
virtual bool CanRespawn()
Definition: CreatureAI.h:114
void MoveCircleChecks()
Definition: CreatureAI.cpp:328
@ EVADE_REASON_NO_PATH
Definition: CreatureAI.h:91
virtual void JustRespawned()
Definition: CreatureAI.h:149
virtual bool CheckInRoom()
Definition: CreatureAI.cpp:382
void MoveBackwardsChecks()
Definition: CreatureAI.cpp:345
Definition: ThreatMgr.h:49
float GetThreatListSize() const
Definition: ThreatMgr.h:222
void SetInCombatWithZone()
Definition: Creature.cpp:2723
void Respawn(bool force=false)
Definition: Creature.cpp:2005
void RegenerateHealth()
Definition: Creature.cpp:993
void CallAssistance(Unit *target=nullptr)
Definition: Creature.cpp:2357
static constexpr uint32 MOVE_BACKWARDS_CHECK_INTERVAL
Definition: Creature.h:381
void SetRespawnTime(uint32 respawn)
Definition: Creature.cpp:3658
bool CanPeriodicallyCallForAssistance() const
Definition: Creature.cpp:3601
uint32 m_moveCircleMovementTime
Definition: Creature.h:382
uint32 m_moveBackwardsMovementTime
Definition: Creature.h:383
static constexpr uint32 MOVE_CIRCLE_CHECK_INTERVAL
Definition: Creature.h:380
Unit * SelectVictim()
Definition: Unit.cpp:14625
bool IsNotReachableAndNeedRegen() const
Definition: Creature.cpp:3560
void Regenerate(Powers power)
Definition: Creature.cpp:924
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:305
Definition: ObjectGuid.h:120
bool IsInDist(float x, float y, float z, float dist) const
Definition: Position.h:217
virtual void RemovePassenger(WorldObject *passenger, bool withAll=false)=0
virtual void AddPassenger(WorldObject *passenger, bool withAll=false)=0
bool NeedChangeAI
Definition: Unit.h:2350
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 t...
Definition: Unit.cpp:21267
bool IsDuringRemoveFromWorld() const
Definition: Unit.h:2396
void UpdateCharmAI()
Definition: Unit.cpp:15677
Vehicle * m_vehicleKit
Definition: Unit.h:2535
void StopMovingOnCurrentPos()
Definition: Unit.cpp:16863
void Update(uint32 time) override
Definition: Unit.cpp:403
Powers getPowerType() const
Definition: Unit.h:1459
void RemoveCharmAuras()
Definition: Unit.cpp:11152
void EndRoll(Loot *loot, Map *allowedMap)
Definition: Group.cpp:1379
Transport * GetTransportForPos(uint32 phase, float x, float y, float z, WorldObject *worldobject=nullptr)
Definition: Map.cpp:2016
time_t GetLinkedRespawnTime(ObjectGuid guid) const
Definition: Map.cpp:3560

References Transport::AddPassenger(), AI(), ALIVE, CallAssistance(), CanNotReachTarget(), CanPeriodicallyCallForAssistance(), CreatureAI::CanRespawn(), CreatureAI::CheckInRoom(), CONDITION_SOURCE_TYPE_CREATURE_RESPAWN, CONFIG_CREATURE_FAMILY_ASSISTANCE_PERIOD, CONFIG_NPC_EVADE_IF_NOT_REACHABLE, CONFIG_REGEN_HP_CANNOT_REACH_TARGET_IN_RAID, CORPSE, CREATURE_FLAG_EXTRA_HARD_RESET, CREATURE_REGEN_INTERVAL, DAY, DEAD, CreatureAI::DoZoneInCombat(), Group::EndRoll(), CreatureAI::EVADE_REASON_NO_PATH, Unit::GetCharmerOrOwner(), Unit::GetCollisionRadius(), GetDebugInfo(), Object::GetEntry(), GameTime::GetGameTime(), Object::GetGUID(), Map::GetLinkedRespawnTime(), WorldObject::GetMap(), Unit::GetOwnerGUID(), WorldObject::GetPhaseMask(), ObjectAccessor::GetPlayer(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Unit::getPowerType(), ThreatMgr::GetThreatListSize(), Unit::GetThreatMgr(), WorldObject::GetTransport(), Map::GetTransportForPos(), Object::GetUInt32Value(), Unit::GetVictim(), WorldObject::GetVisibilityRange(), CreatureTemplate::HasFlagsExtra(), Unit::i_AI, CreatureData::id1, IN_MILLISECONDS, Unit::IsAIEnabled, Unit::IsAlive(), Unit::IsCharmed(), Unit::IsDuringRemoveFromWorld(), Unit::IsEngaged(), Unit::IsEngagedBy(), Unit::IsInCombat(), Position::IsInDist(), IsInEvadeMode(), Object::IsInWorld(), IsNotReachableAndNeedRegen(), Object::IsPlayer(), Unit::IsPolymorphed(), WorldObject::IsWithinDistInMap(), JUST_DIED, JUST_RESPAWNED, CreatureAI::JustRespawned(), LOG_DEBUG, LOG_ERROR, loot, lootingGroupLowGUID, m_AI_locked, m_assistanceTimer, m_boundaryCheckTime, m_cannotReachTarget, m_cannotReachTimer, m_combatPulseDelay, m_combatPulseTime, m_corpseRemoveTime, m_creatureData, Unit::m_deathState, m_groupLootTimer, m_moveBackwardsMovementTime, m_moveCircleMovementTime, Unit::m_regenTimer, m_respawnDelay, m_respawnTime, m_spawnId, m_transportCheckTimer, Unit::m_vehicleKit, MINUTE, MOVE_BACKWARDS_CHECK_INTERVAL, MOVE_CIRCLE_CHECK_INTERVAL, CreatureAI::MoveBackwardsChecks(), CreatureAI::MoveCircleChecks(), Unit::NeedChangeAI, OBJECT_FIELD_ENTRY, POWER_ENERGY, POWER_MANA, Regenerate(), RegenerateHealth(), Unit::RemoveCharmAuras(), RemoveCorpse(), Transport::RemovePassenger(), Vehicle::Reset(), Respawn(), SaveRespawnTime(), sConditionMgr, SelectVictim(), SetCannotReachTarget(), SetInCombatWithZone(), SetNoCallAssistance(), SetRespawnTime(), sGroupMgr, sObjectMgr, sScriptMgr, Unit::StopMovingOnCurrentPos(), sWorld, Position::ToString(), TriggerJustRespawned, Unit::Update(), UnitAI::UpdateAI(), Unit::UpdateCharmAI(), and urand().

Referenced by Pet::Update(), TempSummon::Update(), Puppet::Update(), and Totem::Update().

◆ UpdateAllStats()

bool Creature::UpdateAllStats ( )
overridevirtual

Implements Unit.

Reimplemented in Guardian, and Totem.

1022{
1026
1027 for (uint8 i = POWER_MANA; i < MAX_POWERS; ++i)
1029
1031
1032 return true;
1033}
@ MAX_POWERS
Definition: SharedDefines.h:248
void UpdateAttackPowerAndDamage(bool ranged=false) override
Definition: StatSystem.cpp:1066
void UpdateMaxPower(Powers power) override
Definition: StatSystem.cpp:1058
void UpdateMaxHealth() override
Definition: StatSystem.cpp:1052
virtual void UpdateAllResistances()
Definition: StatSystem.cpp:54

References MAX_POWERS, POWER_MANA, Unit::UpdateAllResistances(), UpdateAttackPowerAndDamage(), UpdateMaxHealth(), and UpdateMaxPower().

Referenced by UpdateEntry().

◆ UpdateArmor()

void Creature::UpdateArmor ( )
overridevirtual

Implements Unit.

Reimplemented in Guardian, and Totem.

1047{
1048 float value = GetTotalAuraModValue(UNIT_MOD_ARMOR);
1049 SetArmor(int32(value));
1050}
@ UNIT_MOD_ARMOR
Definition: Unit.h:275
float GetTotalAuraModValue(UnitMods unitMod) const
Definition: Unit.cpp:15210
void SetArmor(int32 val)
Definition: Unit.h:1433

References Unit::GetTotalAuraModValue(), Unit::SetArmor(), and UNIT_MOD_ARMOR.

Referenced by UpdateResistances().

◆ UpdateAttackPowerAndDamage()

void Creature::UpdateAttackPowerAndDamage ( bool  ranged = false)
overridevirtual

Implements Unit.

Reimplemented in Guardian, and Totem.

1067{
1069
1073
1074 if (ranged)
1075 {
1079 }
1080
1081 float baseAttackPower = GetModifierValue(unitMod, BASE_VALUE) * GetModifierValue(unitMod, BASE_PCT);
1082 float attackPowerMod = GetModifierValue(unitMod, TOTAL_VALUE);
1083 float attackPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f;
1084
1085 SetInt32Value(index, uint32(baseAttackPower)); // UNIT_FIELD_(RANGED)_ATTACK_POWER
1086 SetInt32Value(indexMod, uint32(attackPowerMod)); // UNIT_FIELD_(RANGED)_ATTACK_POWER_MODS
1087 SetFloatValue(indexMulti, attackPowerMultiplier); // UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER
1088
1089 // automatically update weapon damage after attack power modification
1090 if (ranged)
1092 else
1093 {
1096 }
1097}
@ UNIT_FIELD_ATTACK_POWER_MODS
Definition: UpdateFields.h:163
@ UNIT_FIELD_RANGED_ATTACK_POWER
Definition: UpdateFields.h:165
@ UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER
Definition: UpdateFields.h:167
@ UNIT_FIELD_ATTACK_POWER_MULTIPLIER
Definition: UpdateFields.h:164
@ UNIT_FIELD_ATTACK_POWER
Definition: UpdateFields.h:162
@ UNIT_FIELD_RANGED_ATTACK_POWER_MODS
Definition: UpdateFields.h:166
void SetInt32Value(uint16 index, int32 value)
Definition: Object.cpp:637

References BASE_ATTACK, BASE_PCT, BASE_VALUE, Unit::GetModifierValue(), OFF_ATTACK, RANGED_ATTACK, Object::SetFloatValue(), Object::SetInt32Value(), TOTAL_PCT, TOTAL_VALUE, UNIT_FIELD_ATTACK_POWER, UNIT_FIELD_ATTACK_POWER_MODS, UNIT_FIELD_ATTACK_POWER_MULTIPLIER, UNIT_FIELD_RANGED_ATTACK_POWER, UNIT_FIELD_RANGED_ATTACK_POWER_MODS, UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER, UNIT_MOD_ATTACK_POWER, UNIT_MOD_ATTACK_POWER_RANGED, and Unit::UpdateDamagePhysical().

Referenced by UpdateAllStats().

◆ UpdateEntry() [1/2]

bool Creature::UpdateEntry ( uint32  entry,
bool  updateAI 
)
inline
174{ return UpdateEntry(entry, nullptr, true, updateAI); }

References UpdateEntry().

Referenced by UpdateEntry().

◆ UpdateEntry() [2/2]

bool Creature::UpdateEntry ( uint32  entry,
const CreatureData data = nullptr,
bool  changelevel = true,
bool  updateAI = false 
)
Todo:
: Why is this treated as uint32 when it's a float?
484{
485 if (!InitEntry(Entry, data))
486 return false;
487
488 CreatureTemplate const* cInfo = GetCreatureTemplate();
489
490 m_regenHealth = cInfo->RegenHealth;
491
492 // creatures always have melee weapon ready if any unless specified otherwise
493 if (!GetCreatureAddon())
495
496 SetFaction(cInfo->faction);
497
498 uint32 npcflag, unit_flags, dynamicflags;
499 ObjectMgr::ChooseCreatureFlags(cInfo, npcflag, unit_flags, dynamicflags, data);
500
502 ReplaceAllNpcFlags(NPCFlags(npcflag | sGameEventMgr->GetNPCFlag(this)));
503 else
505
506 // Xinef: NPC is in combat, keep this flag!
507 unit_flags &= ~UNIT_FLAG_IN_COMBAT;
508 if (IsInCombat())
509 unit_flags |= UNIT_FLAG_IN_COMBAT;
510
511 ReplaceAllUnitFlags(UnitFlags(unit_flags));
513
514 ReplaceAllDynamicFlags(dynamicflags);
515
519
520 uint32 previousHealth = GetHealth();
521 uint32 previousMaxHealth = GetMaxHealth();
522 uint32 previousPlayerDamageReq = _playerDamageReq;
523
524 SelectLevel(changelevel);
525 if (previousHealth > 0)
526 {
527 SetHealth(previousHealth);
528
529 if (previousMaxHealth && previousMaxHealth > GetMaxHealth())
530 {
531 _playerDamageReq = (uint32)(previousPlayerDamageReq * GetMaxHealth() / previousMaxHealth);
532 }
533 else
534 {
535 _playerDamageReq = previousPlayerDamageReq;
536 }
537 }
538
540 CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(GetLevel(), cInfo->unit_class);
541 float armor = (float)stats->GenerateArmor(cInfo);
549
550 SetCanModifyStats(true);
552
553 // checked and error show at loading templates
554 if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->faction))
555 {
556 if (factionTemplate->factionFlags & FACTION_TEMPLATE_FLAG_ASSIST_PLAYERS)
557 SetPvP(true);
558 else
559 SetPvP(false);
560 }
561
562 // updates spell bars for vehicles and set player's faction - should be called here, to overwrite faction that is set from the new template
563 if (IsVehicle())
564 {
565 if (Player* owner = Creature::GetCharmerOrOwnerPlayerOrPlayerItself()) // this check comes in case we don't have a player
566 {
567 SetFaction(owner->GetFaction()); // vehicles should have same as owner faction
568 owner->VehicleSpellInitialize();
569 }
570 }
571
572 // trigger creature is always not selectable and can not be attacked
573 if (IsTrigger())
575
577
579 {
582 }
583
584 if (GetMovementTemplate().IsRooted())
585 {
587 }
588
590
592
593 if (updateAI)
594 {
596 }
597
598 return true;
599}
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplateEntryfmt)
@ CREATURE_FLAG_EXTRA_NO_TAUNT
Definition: CreatureData.h:57
@ CREATURE_FLAG_EXTRA_WORLDEVENT
Definition: CreatureData.h:63
UnitFlags2
Definition: Unit.h:486
@ UNIT_MOD_RESISTANCE_SHADOW
Definition: Unit.h:280
@ UNIT_MOD_RESISTANCE_FROST
Definition: Unit.h:279
@ UNIT_MOD_RESISTANCE_HOLY
Definition: Unit.h:276
@ UNIT_MOD_RESISTANCE_ARCANE
Definition: Unit.h:281
@ UNIT_MOD_RESISTANCE_FIRE
Definition: Unit.h:277
@ UNIT_MOD_RESISTANCE_NATURE
Definition: Unit.h:278
@ SHEATH_STATE_MELEE
Definition: Unit.h:127
UnitFlags
Definition: Unit.h:446
@ UNIT_FLAG_IN_COMBAT
Definition: Unit.h:467
#define sGameEventMgr
Definition: GameEventMgr.h:186
@ FACTION_TEMPLATE_FLAG_ASSIST_PLAYERS
Definition: DBCEnums.h:335
@ SPELL_SCHOOL_SHADOW
Definition: SharedDefines.h:260
@ SPELL_SCHOOL_NATURE
Definition: SharedDefines.h:258
@ SPELL_SCHOOL_FROST
Definition: SharedDefines.h:259
@ SPELL_SCHOOL_FIRE
Definition: SharedDefines.h:257
@ SPELL_SCHOOL_HOLY
Definition: SharedDefines.h:256
@ SPELL_EFFECT_ATTACK_ME
Definition: SharedDefines.h:864
@ IMMUNITY_STATE
Definition: SharedDefines.h:1367
@ IMMUNITY_EFFECT
Definition: SharedDefines.h:1366
bool UpdateAllStats() override
Definition: StatSystem.cpp:1021
bool InitEntry(uint32 entry, const CreatureData *data=nullptr)
Definition: Creature.cpp:385
void SetDetectionDistance(float dist)
Definition: Creature.h:199
void LoadSpellTemplateImmunity()
Definition: Creature.cpp:2151
uint32 RangeAttackTime
Definition: CreatureData.h:203
uint32 BaseAttackTime
Definition: CreatureData.h:202
float detection_range
Definition: CreatureData.h:197
int32 resistance[MAX_SPELL_SCHOOL]
Definition: CreatureData.h:220
bool RegenHealth
Definition: CreatureData.h:236
uint32 faction
Definition: CreatureData.h:191
uint32 unit_flags2
Definition: CreatureData.h:208
uint32 GenerateArmor(CreatureTemplate const *info) const
Definition: CreatureData.h:316
void ReplaceAllDynamicFlags(uint32 flag) override
Definition: Unit.h:1326
void SetFaction(uint32 faction)
Definition: Unit.cpp:10029
void SetPvP(bool state)
Definition: Unit.h:1519
void ReplaceAllUnitFlags(UnitFlags flags)
Definition: Unit.h:1483
virtual void SetSheath(SheathState sheathed)
Definition: Unit.h:1492
void SetCanModifyStats(bool modifyStats)
Definition: Unit.h:2106
void ReplaceAllUnitFlags2(UnitFlags2 flags)
Definition: Unit.h:1489
void SetAttackTime(WeaponAttackType att, uint32 val)
Definition: Unit.h:1475
static void ChooseCreatureFlags(CreatureTemplate const *cinfo, uint32 &npcflag, uint32 &unit_flags, uint32 &dynamicflags, CreatureData const *data=nullptr)
Definition: ObjectMgr.cpp:1726
Definition: DBCStructure.h:930

References _playerDamageReq, AIM_Initialize(), Unit::ApplySpellImmune(), BASE_ATTACK, BASE_VALUE, CreatureTemplate::BaseAttackTime, ObjectMgr::ChooseCreatureFlags(), CREATURE_FLAG_EXTRA_NO_TAUNT, CREATURE_FLAG_EXTRA_WORLDEVENT, CreatureTemplate::detection_range, CreatureTemplate::dmgschool, Entry, CreatureTemplate::faction, FACTION_TEMPLATE_FLAG_ASSIST_PLAYERS, CreatureTemplate::flags_extra, CreatureBaseStats::GenerateArmor(), Unit::GetCharmerOrOwnerPlayerOrPlayerItself(), GetCreatureAddon(), GetCreatureTemplate(), Unit::GetHealth(), Unit::GetLevel(), Unit::GetMaxHealth(), GetMovementTemplate(), IMMUNITY_EFFECT, IMMUNITY_STATE, InitEntry(), InitializeReactState(), Unit::IsInCombat(), Unit::IsPet(), IsTrigger(), Unit::IsVehicle(), LoadSpellTemplateImmunity(), m_regenHealth, OFF_ATTACK, CreatureTemplate::RangeAttackTime, RANGED_ATTACK, CreatureTemplate::RegenHealth, Unit::ReplaceAllDynamicFlags(), Unit::ReplaceAllNpcFlags(), Unit::ReplaceAllUnitFlags(), Unit::ReplaceAllUnitFlags2(), CreatureTemplate::resistance, SelectLevel(), Unit::SetAttackTime(), Unit::SetCanModifyStats(), Unit::SetControlled(), SetDetectionDistance(), Unit::SetFaction(), Unit::SetHealth(), SetMeleeDamageSchool(), Unit::SetModifierValue(), Unit::SetPvP(), Unit::SetSheath(), Unit::SetUnitFlag(), sFactionTemplateStore, sGameEventMgr, SHEATH_STATE_MELEE, sObjectMgr, SPELL_AURA_MOD_TAUNT, SPELL_EFFECT_ATTACK_ME, SPELL_SCHOOL_ARCANE, SPELL_SCHOOL_FIRE, SPELL_SCHOOL_FROST, SPELL_SCHOOL_HOLY, SPELL_SCHOOL_NATURE, SPELL_SCHOOL_SHADOW, CreatureTemplate::unit_class, UNIT_FLAG_IN_COMBAT, UNIT_FLAG_NOT_SELECTABLE, CreatureTemplate::unit_flags2, UNIT_MOD_ARMOR, UNIT_MOD_RESISTANCE_ARCANE, UNIT_MOD_RESISTANCE_FIRE, UNIT_MOD_RESISTANCE_FROST, UNIT_MOD_RESISTANCE_HOLY, UNIT_MOD_RESISTANCE_NATURE, UNIT_MOD_RESISTANCE_SHADOW, UNIT_STATE_ROOT, and UpdateAllStats().

Referenced by CreateFromProto(), boss_yoggsaron_influence_tentacle::boss_yoggsaron_influence_tentacleAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), npc_forest_frog::npc_forest_frogAI::DoSpawnRandom(), npc_commandscript::HandleNpcSetEntryCommand(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::JustDied(), npc_scholomance_occultist::npc_scholomance_occultistAI::JustReachedHome(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::JustRespawned(), boss_yoggsaron_brain::boss_yoggsaron_brainAI::JustSummoned(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::OnCreatureCreate(), instance_forge_of_souls::instance_forge_of_souls_InstanceScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_pit_of_saron::instance_pit_of_saron_InstanceScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), instance_nexus::instance_nexus_InstanceMapScript::OnCreatureCreate(), instance_shattered_halls::instance_shattered_halls_InstanceMapScript::OnCreatureCreate(), npc_announcer_toc5::npc_announcer_toc5AI::Reset(), npc_phase_hunter::npc_phase_hunterAI::Reset(), Respawn(), NPCStaveQuestAI::RevealForm(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::RollPath(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), npc_argent_captainAI::SpellHit(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::SpellHit(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::SpellHit(), npc_nether_drake::npc_nether_drakeAI::SpellHit(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), npc_phase_hunter::npc_phase_hunterAI::UpdateAI(), and npc_tyrion_spybot::npc_tyrion_spybotAI::UpdateAI().

◆ UpdateMaxHealth()

void Creature::UpdateMaxHealth ( )
overridevirtual

Implements Unit.

Reimplemented in Guardian, and Totem.

1053{
1055 SetMaxHealth(uint32(value));
1056}

References Unit::GetTotalAuraModValue(), Unit::SetMaxHealth(), and UNIT_MOD_HEALTH.

Referenced by UpdateAllStats().

◆ UpdateMaxPower()

void Creature::UpdateMaxPower ( Powers  power)
overridevirtual

Implements Unit.

Reimplemented in Guardian, and Totem.

1059{
1060 UnitMods unitMod = UnitMods(static_cast<uint16>(UNIT_MOD_POWER_START) + power);
1061
1062 float value = GetTotalAuraModValue(unitMod);
1063 SetMaxPower(power, uint32(value));
1064}
@ UNIT_MOD_POWER_START
Definition: Unit.h:293

References Unit::GetTotalAuraModValue(), Unit::SetMaxPower(), and UNIT_MOD_POWER_START.

Referenced by UpdateAllStats().

◆ UpdateMoveInLineOfSightState()

void Creature::UpdateMoveInLineOfSightState ( )
2513{
2514 // xinef: pets, guardians and units with scripts / smartAI should be skipped
2516 GetScriptId() || GetAIName() == "SmartAI")
2517 {
2520 return;
2521 }
2522
2523 if (IsTrigger() || IsCivilian() || GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET || IsCritter() || GetAIName() == "NullCreatureAI")
2524 {
2527 return;
2528 }
2529
2530 bool nonHostile = true;
2531 if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(GetFaction()))
2532 if (factionTemplate->hostileMask || factionTemplate->enemyFaction[0] || factionTemplate->enemyFaction[1] || factionTemplate->enemyFaction[2] || factionTemplate->enemyFaction[3])
2533 nonHostile = false;
2534
2535 if (nonHostile)
2537 else
2539}
@ UNIT_MASK_SUMMON
Definition: Unit.h:675
@ UNIT_MASK_GUARDIAN
Definition: Unit.h:677
@ UNIT_MASK_MINION
Definition: Unit.h:676
uint32 GetCreatureType() const
Definition: Unit.cpp:15074
uint32 HasUnitTypeMask(uint32 mask) const
Definition: Unit.h:1407

References CREATURE_TYPE_NON_COMBAT_PET, GetAIName(), Unit::GetCreatureType(), Unit::GetFaction(), GetScriptId(), Unit::HasUnitTypeMask(), IsCivilian(), Unit::IsCritter(), Unit::IsPet(), IsTrigger(), m_moveInLineOfSightDisabled, m_moveInLineOfSightStrictlyDisabled, sFactionTemplateStore, UNIT_MASK_CONTROLABLE_GUARDIAN, UNIT_MASK_GUARDIAN, UNIT_MASK_MINION, and UNIT_MASK_SUMMON.

Referenced by Unit::SetFaction().

◆ UpdateMovementFlags()

void Creature::UpdateMovementFlags ( )
3324{
3325 // Do not update movement flags if creature is controlled by a player (charm/vehicle)
3326 if (m_movedByPlayer)
3327 return;
3328
3329 CreatureTemplate const* info = GetCreatureTemplate();
3330 if (!info)
3331 return;
3332
3333 // Creatures with CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE should control MovementFlags in your own scripts
3335 return;
3336
3337 float ground = GetFloorZ();
3338
3339 bool canHover = CanHover();
3340 bool isInAir = (G3D::fuzzyGt(GetPositionZ(), ground + (canHover ? GetFloatValue(UNIT_FIELD_HOVERHEIGHT) : 0.0f) + GROUND_HEIGHT_TOLERANCE) || G3D::fuzzyLt(GetPositionZ(), ground - GROUND_HEIGHT_TOLERANCE)); // Can be underground too, prevent the falling
3341
3342 if (GetMovementTemplate().IsFlightAllowed() && isInAir && !IsFalling())
3343 {
3344 if (GetMovementTemplate().Flight == CreatureFlightMovementType::CanFly)
3345 SetCanFly(true);
3346 else
3347 SetDisableGravity(true);
3348
3350 SetHover(false);
3351 }
3352 else
3353 {
3354 SetCanFly(false);
3355 SetDisableGravity(false);
3357 SetHover(true);
3358 }
3359
3360 if (!isInAir)
3362
3363 bool Swim = false;
3364 LiquidData const& liquidData = GetLiquidData();
3365 switch (liquidData.Status)
3366 {
3369 Swim = GetPositionZ() - liquidData.DepthLevel > GetCollisionHeight() * 0.75f; // Shallow water at ~75% of collision height
3370 break;
3372 Swim = true;
3373 break;
3374 default:
3375 break;
3376 }
3377
3378 SetSwim(CanSwim() && Swim);
3379}
@ CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE
Definition: CreatureData.h:58
@ LIQUID_MAP_UNDER_WATER
Definition: Map.h:147
@ LIQUID_MAP_IN_WATER
Definition: Map.h:146
@ LIQUID_MAP_WATER_WALK
Definition: Map.h:145
@ SPELL_AURA_HOVER
Definition: SpellAuraDefines.h:169
float const GROUND_HEIGHT_TOLERANCE
Definition: SharedDefines.h:25
bool SetCanFly(bool enable, bool packetOnly=false) override
Definition: Creature.cpp:3177
bool SetSwim(bool enable) override
Definition: Creature.cpp:3129
CreatureFlightMovementType Flight
Definition: CreatureData.h:129
float GetFloatValue(uint16 index) const
Definition: Object.cpp:317
LiquidData const & GetLiquidData() const
Definition: Object.cpp:3108
float GetFloorZ() const
Definition: Object.cpp:3064
float GetCollisionHeight() const override
Return collision height sent to client.
Definition: Unit.cpp:21273
Definition: Map.h:170
LiquidStatus Status
Definition: Map.h:177
float DepthLevel
Definition: Map.h:176

References CanHover(), CanSwim(), CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE, LiquidData::DepthLevel, CreatureTemplate::flags_extra, CreatureMovementData::Flight, Unit::GetCollisionHeight(), GetCreatureTemplate(), Object::GetFloatValue(), WorldObject::GetFloorZ(), WorldObject::GetLiquidData(), GetMovementTemplate(), Position::GetPositionZ(), GROUND_HEIGHT_TOLERANCE, Unit::HasAuraType(), Unit::IsAlive(), Unit::IsFalling(), CreatureMovementData::IsFlightAllowed(), LIQUID_MAP_IN_WATER, LIQUID_MAP_UNDER_WATER, LIQUID_MAP_WATER_WALK, Unit::m_movedByPlayer, MOVEMENTFLAG_FALLING, Unit::RemoveUnitMovementFlag(), SetCanFly(), SetDisableGravity(), SetHover(), SetSwim(), SPELL_AURA_HOVER, LiquidData::Status, and UNIT_FIELD_HOVERHEIGHT.

Referenced by Create(), Unit::ProcessTerrainStatusUpdate(), and setDeathState().

◆ UpdateResistances()

void Creature::UpdateResistances ( uint32  school)
overridevirtual

Implements Unit.

Reimplemented in Totem.

1036{
1037 if (school > SPELL_SCHOOL_NORMAL)
1038 {
1040 SetResistance(SpellSchools(school), int32(value));
1041 }
1042 else
1043 UpdateArmor();
1044}
@ UNIT_MOD_RESISTANCE_START
Definition: Unit.h:291
void UpdateArmor() override
Definition: StatSystem.cpp:1046
void SetResistance(SpellSchools school, int32 val)
Definition: Unit.h:1437

References Unit::GetTotalAuraModValue(), Unit::SetResistance(), SPELL_SCHOOL_NORMAL, UNIT_MOD_RESISTANCE_START, and UpdateArmor().

◆ UpdateStats()

bool Creature::UpdateStats ( Stats  stat)
overridevirtual

Implements Unit.

Reimplemented in Guardian, and Totem.

1017{
1018 return true;
1019}

◆ UpdateVendorItemCurrentCount()

uint32 Creature::UpdateVendorItemCurrentCount ( VendorItem const *  vItem,
uint32  used_count 
)
2997{
2998 if (!vItem->maxcount)
2999 return 0;
3000
3001 VendorItemCounts::iterator itr = m_vendorItemCounts.begin();
3002 for (; itr != m_vendorItemCounts.end(); ++itr)
3003 if (itr->itemId == vItem->item)
3004 break;
3005
3006 if (itr == m_vendorItemCounts.end())
3007 {
3008 uint32 new_count = vItem->maxcount > used_count ? vItem->maxcount - used_count : 0;
3009 m_vendorItemCounts.push_back(VendorItemCount(vItem->item, new_count));
3010 return new_count;
3011 }
3012
3013 VendorItemCount* vCount = &*itr;
3014
3015 time_t ptime = GameTime::GetGameTime().count();
3016
3017 if (time_t(vCount->lastIncrementTime + vItem->incrtime) <= ptime)
3018 {
3019 ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(vItem->item);
3020
3021 uint32 diff = uint32((ptime - vCount->lastIncrementTime) / vItem->incrtime);
3022 if ((vCount->count + diff * pProto->BuyCount) < vItem->maxcount)
3023 vCount->count += diff * pProto->BuyCount;
3024 else
3025 vCount->count = vItem->maxcount;
3026 }
3027
3028 vCount->count = vCount->count > used_count ? vCount->count - used_count : 0;
3029 vCount->lastIncrementTime = ptime;
3030 return vCount->count;
3031}

References ItemTemplate::BuyCount, VendorItemCount::count, GameTime::GetGameTime(), VendorItem::incrtime, VendorItem::item, VendorItemCount::lastIncrementTime, m_vendorItemCounts, VendorItem::maxcount, and sObjectMgr.

Referenced by Player::_StoreOrEquipNewItem().

◆ UpdateWaypointID()

void Creature::UpdateWaypointID ( uint32  wpID)
inline

Member Data Documentation

◆ _damagedByPlayer

bool Creature::_damagedByPlayer
private

◆ _focusSpell

Spell const* Creature::_focusSpell
private

◆ _isMissingSwimmingFlagOutOfCombat

bool Creature::_isMissingSwimmingFlagOutOfCombat
private

‍Locks the target during spell cast for proper facing

Referenced by HasSwimmingFlagOutOfCombat(), and RefreshSwimmingFlag().

◆ _lastDamagedTime

std::shared_ptr<time_t> Creature::_lastDamagedTime
mutableprivate

◆ _playerDamageReq

◆ 

struct { ... } Creature::_spellFocusInfo

Referenced by HasSpellFocus().

◆ Delay

uint32 Creature::Delay = 0

◆ DisableReputationGain

bool Creature::DisableReputationGain
protected

◆ loot

◆ lootingGroupLowGUID

uint32 Creature::lootingGroupLowGUID

Referenced by Update().

◆ lootPickPocketRestoreTime

uint32 Creature::lootPickPocketRestoreTime
protected

◆ m_AI_locked

bool Creature::m_AI_locked
protected

Referenced by AIM_Initialize(), and Update().

◆ m_AlreadyCallAssistance

bool Creature::m_AlreadyCallAssistance
protected

◆ m_AlreadySearchedAssistance

bool Creature::m_AlreadySearchedAssistance
protected

◆ m_assistanceTimer

uint32 Creature::m_assistanceTimer
private

Referenced by SetAssistanceTimer(), and Update().

◆ m_boundaryCheckTime

uint32 Creature::m_boundaryCheckTime
protected

Referenced by DoImmediateBoundaryCheck(), and Update().

◆ m_cannotReachTarget

ObjectGuid Creature::m_cannotReachTarget
private

◆ m_cannotReachTimer

uint32 Creature::m_cannotReachTimer
private

◆ m_CombatDistance

◆ m_combatPulseDelay

uint32 Creature::m_combatPulseDelay
protected

◆ m_combatPulseTime

uint32 Creature::m_combatPulseTime
protected

Referenced by SetCombatPulseDelay(), and Update().

◆ m_corpseDelay

uint32 Creature::m_corpseDelay
protected

◆ m_corpseRemoveTime

time_t Creature::m_corpseRemoveTime
protected

◆ m_creatureData

CreatureData const* Creature::m_creatureData
protected

◆ m_creatureInfo

◆ m_CreatureSpellCooldowns

◆ m_defaultMovementType

◆ m_detectionDistance

float Creature::m_detectionDistance
protected

◆ m_equipmentId

uint8 Creature::m_equipmentId
protected

◆ m_formation

◆ m_groupLootTimer

uint32 Creature::m_groupLootTimer

Referenced by Update().

◆ m_homePosition

Position Creature::m_homePosition
protected

◆ m_isTempWorldObject

bool Creature::m_isTempWorldObject

◆ m_LootMode

uint16 Creature::m_LootMode
protected

◆ m_lootRecipient

ObjectGuid Creature::m_lootRecipient
protected

◆ m_lootRecipientGroup

◆ m_meleeDamageSchoolMask

SpellSchoolMask Creature::m_meleeDamageSchoolMask
protected

◆ m_moveBackwardsMovementTime

uint32 Creature::m_moveBackwardsMovementTime = MOVE_BACKWARDS_CHECK_INTERVAL

Referenced by Update().

◆ m_moveCircleMovementTime

uint32 Creature::m_moveCircleMovementTime = MOVE_CIRCLE_CHECK_INTERVAL

Referenced by Update().

◆ m_moveInLineOfSightDisabled

bool Creature::m_moveInLineOfSightDisabled
protected

◆ m_moveInLineOfSightStrictlyDisabled

bool Creature::m_moveInLineOfSightStrictlyDisabled
protected

◆ m_originalEntry

uint32 Creature::m_originalEntry
protected

◆ m_originalEquipmentId

int8 Creature::m_originalEquipmentId
protected

◆ m_path_id

uint32 Creature::m_path_id
private

◆ m_ProhibitSchoolTime

uint32 Creature::m_ProhibitSchoolTime[7]

◆ m_reactState

ReactStates Creature::m_reactState
protected

◆ m_regenHealth

bool Creature::m_regenHealth
protected

◆ m_regenPower

bool Creature::m_regenPower
protected

Referenced by Regenerate(), and SetRegeneratingPower().

◆ m_respawnDelay

◆ m_respawnedTime

time_t Creature::m_respawnedTime
protected

◆ m_respawnTime

◆ m_SightDistance

◆ m_spawnId

◆ m_spells

◆ m_transportCheckTimer

uint16 Creature::m_transportCheckTimer
protected

Referenced by Update().

◆ m_transportHomePosition

Position Creature::m_transportHomePosition
protected

◆ m_vendorItemCounts

VendorItemCounts Creature::m_vendorItemCounts
protected

◆ m_wanderDistance

float Creature::m_wanderDistance
protected

◆ m_waypointID

uint32 Creature::m_waypointID
private

◆ MOVE_BACKWARDS_CHECK_INTERVAL

constexpr uint32 Creature::MOVE_BACKWARDS_CHECK_INTERVAL = 2000
staticconstexpr

Referenced by Update().

◆ MOVE_CIRCLE_CHECK_INTERVAL

constexpr uint32 Creature::MOVE_CIRCLE_CHECK_INTERVAL = 3000
staticconstexpr

Referenced by Update().

◆ Orientation

float Creature::Orientation = 0.0f

◆ Spell

::Spell const* Creature::Spell = nullptr

◆ Target

ObjectGuid Creature::Target

◆ TriggerJustRespawned

bool Creature::TriggerJustRespawned
private

Referenced by Creature(), Respawn(), and Update().