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 UpdatableMapObject WorldObject Object WorldLocation Position TempSummon TestCreature Minion Guardian Puppet Totem Pet

Public Member Functions

 Creature ()
 
 ~Creature () override
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
float GetNativeObjectScale () const override
 
void SetObjectScale (float scale) override
 
void SetDisplayFromModel (uint32 modelIdx)
 
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, CreatureData const *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 HasFlagsExtra (uint32 flag) const
 
bool IsRacialLeader () const
 
bool IsCivilian () const
 
bool IsTrigger () const
 
bool IsGuard () const
 
CreatureMovementData const & GetMovementTemplate () const
 
void PauseMovementForInteraction ()
 
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
 
bool IsRooted () const
 
MovementGeneratorType GetDefaultMovementType () const override
 -------—End of Pet responses methods-------—
 
void SetDefaultMovementType (MovementGeneratorType mgt)
 
void SetReactState (ReactStates state)
 A creature can have 3 ReactStates : Agressive, Passive, Neutral.
 
ReactStates GetReactState () const
 
bool HasReactState (ReactStates state) const
 
void InitializeReactState ()
 Check if the creature has the specified ReactState.
 
bool isCanInteractWithBattleMaster (Player *player, bool msg) const
 
bool CanResetTalents (Player *player) const
 
bool CanCreatureAttack (Unit const *victim, bool skipDistCheck=false) const
 
bool IsImmunedToSpell (SpellInfo const *spellInfo, Spell const *spell=nullptr) override
 
bool HasMechanicTemplateImmunity (uint64 mask) const
 
bool IsImmunedToSpellEffect (SpellInfo const *spellInfo, uint32 index, WorldObject const *caster=nullptr) 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 ()
 
CreatureAI * AI () const
 
bool SetWalk (bool enable) override
 Enable or disable the creature's walk mode by removing: MOVEMENTFLAG_WALKING. Infom also the client.
 
bool SetSwim (bool enable) 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 RemoveSpellCooldown (uint32 spell_id, bool update)
 
void ProhibitSpellSchool (SpellSchoolMask idSchoolMask, uint32 unTimeMs) override
 
bool IsSpellProhibited (SpellSchoolMask idSchoolMask) const
 
void ClearProhibitedSpellTimers ()
 
bool HasSpell (uint32 spellID) const override
 
void UpdateMovementFlags ()
 
uint32 GetRandomId (uint32 id1, uint32 id2, uint32 id3)
 
bool UpdateEntry (uint32 entry, CreatureData const *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 LoadTemplateImmunities (int32 creatureImmunitiesId)
 
void LoadSparringPct ()
 
float GetSparringPct () const
 
bool HasWeapon (WeaponAttackType type) const override
 
bool HasWeaponForAttack (WeaponAttackType type) const 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)
 
CreatureTemplate const * GetCreatureTemplate () const
 
CreatureData const * GetCreatureData () const
 
uint32 GetGossipMenuId () const
 
void SetGossipMenuId (uint32 gossipMenuId)
 
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
 A creature can be in 4 different states: Alive, JustDied, Corpse, and JustRespawned. The cycle follows the next order:
 
bool LoadFromDB (ObjectGuid::LowType guid, Map *map, bool allowDuplicate=false)
 
bool LoadCreatureFromDB (ObjectGuid::LowType guid, Map *map, bool addToMap=true, bool allowDuplicate=false)
 
bool IsRespawnCompatibilityMode () const
 
void SaveToDB ()
 
virtual void SaveToDB (uint32 mapid, uint8 spawnMask, uint32 phaseMask)
 
virtual void DeleteFromDB ()
 
ObjectGuid GetLootRecipientGUID () const
 
Player * GetLootRecipient () const
 
ObjectGuid::LowType GetLootRecipientGroupGUID () const
 
Group * GetLootRecipientGroup () 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, bool force=false) const
 
float GetAggroRange (Unit const *target) const
 
float GetAttackDistance (Unit const *player) const
 
float GetDetectionRange () const
 
void SendAIReaction (AiReaction reactionType)
 
Unit * SelectNearestTarget (float dist=0, bool playerOnly=false) const
 Select nearest hostile unit within the given distance (regardless of threat list).
 
Unit * SelectNearestTargetInAttackDistance (float dist) const
 Select nearest hostile unit within the given attack distance (i.e. distance is ignored if > than ATTACK_DISTANCE), regardless of threat list.
 
void DoFleeToGetAssistance ()
 
void CallForHelp (float fRadius, Unit *target=nullptr)
 
void CallAssistance (Unit *target=nullptr)
 
void SetNoCallForHelp (bool val)
 
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=0ms, Seconds forcedRespawnTimer=0s)
 
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 ()
 Set in combat all units in the dungeon/raid. Affect only units with IsAIEnabled.
 
void AtEngage (Unit *target) override
 
void AtDisengage () override
 
bool IsEngaged () const override
 
bool hasQuest (uint32 quest_id) const override
 
bool hasInvolvedQuest (uint32 quest_id) const override
 
bool isRegeneratingHealth ()
 
void SetRegeneratingHealth (bool enable)
 
void SetRegeneratingPower (bool enable)
 
virtual uint8 GetPetAutoSpellSize () const
 
virtual uint32 GetPetAutoSpellOnPos (uint8 pos) const
 
void SetCannotReachTarget (ObjectGuid const &target=ObjectGuid::Empty)
 
bool CanNotReachTarget () const
 
ObjectGuid const & GetCannotReachTarget () const
 
bool IsNotReachableAndNeedRegen () const
 
void SetPosition (float x, float y, float z, float o)
 
void SetPosition (Position const &pos)
 
void SetHomePosition (float x, float y, float z, float o)
 
void SetHomePosition (Position const &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 (Position const &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)
 
std::pair< uint32, uint32 > GetCurrentWaypointInfo () const
 
void UpdateCurrentWaypointInfo (uint32 nodeId, uint32 pathId)
 
bool IsFormationLeader () const
 
void SignalFormationMovement ()
 
bool IsFormationLeaderMoveAllowed () const
 
void SearchFormation ()
 
CreatureGroup const * GetFormation () const
 
CreatureGroup * GetFormation ()
 
void SetFormation (CreatureGroup *formation)
 
Unit * SelectVictim ()
 
void SetReputationRewardDisabled (bool disable)
 
bool IsReputationRewardDisabled () const
 
void SetLootRewardDisabled (bool disable)
 
bool IsLootRewardDisabled () const
 
bool IsDamageEnoughForLootingAndReward () const
 
void LowerPlayerDamageReq (uint32 unDamage, bool damagedByPlayer=true, uint8 attackerLevel=0)
 
void ResetPlayerDamageReq ()
 
uint32 GetPlayerDamageReq () const
 
uint8 GetHighestPlayerAttackerLevel () const
 
uint32 GetOriginalEntry () const
 
void SetOriginalEntry (uint32 entry)
 
void SetTarget (ObjectGuid guid=ObjectGuid::Empty) override
 
void ClearTarget ()
 
void FocusTarget (Spell const *focusSpell, WorldObject const *target)
 
void ReleaseFocus (Spell const *focusSpell)
 
bool IsMovementPreventedByCasting () const override
 
std::shared_ptr< time_t > const & GetLastLeashExtensionTimePtr () const
 
void SetLastLeashExtensionTimePtr (std::shared_ptr< time_t > const &timer)
 
void ClearLastLeashExtensionTimePtr ()
 
time_t GetLastLeashExtensionTime () const
 
void UpdateLeashExtensionTime ()
 
uint8 GetLeashTimer () const
 
CreatureTextRepeatIds const & GetTextRepeatGroup (uint8 textGroup)
 
void SetTextRepeatId (uint8 textGroup, uint8 id)
 
void ClearTextRepeatGroup (uint8 textGroup)
 
bool IsTextOnCooldown (uint8 textGroup) const
 
void SetTextCooldown (uint8 textGroup, uint32 cooldownMs)
 
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.
 
bool CanCastSpell (uint32 spellID) const
 Returns true if the creature is able to cast the spell.
 
ObjectGuid GetSummonerGUID () const
 Helper to get the creature's summoner GUID, if it is a summon.
 
void SetCombatMovement (bool allowMovement)
 
bool IsCombatMovementAllowed () const
 
std::string GetDebugInfo () const override
 
bool IsUpdateNeeded () override
 
- Public Member Functions inherited from Unit
 ~Unit () override
 
void Update (uint32 time) override
 
UnitAI * GetAI ()
 
void SetAI (UnitAI *newAI)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void CleanupBeforeRemoveFromMap (bool finalCleanup)
 
void CleanupsBeforeDelete (bool finalCleanup=true) override
 
virtual bool isBeingLoaded () const
 
bool IsDuringRemoveFromWorld () const
 
void SetUInt32Value (uint16 index, uint32 value)
 
Unit * GetOwner () const
 
ObjectGuid GetOwnerGUID () const override
 
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
 
ObjectGuid GetTransGUID () const override
 
Pet * ToPet ()
 
Totem * ToTotem ()
 
TempSummon * ToTempSummon ()
 
TempSummon const * ToTempSummon () const
 
void AddUnitState (uint32 f)
 
bool HasUnitState (const uint32 f) const
 
void ClearUnitState (uint32 f)
 
uint32 GetUnitState () const
 
uint32 HasUnitTypeMask (uint32 mask) const
 
void AddUnitTypeMask (uint32 mask)
 
uint32 GetUnitTypeMask () const
 
UnitFlags GetUnitFlags () const
 
bool HasUnitFlag (UnitFlags flags) const
 
void SetUnitFlag (UnitFlags flags)
 UnitFlags available in UnitDefines.h.
 
void RemoveUnitFlag (UnitFlags flags)
 UnitFlags available in UnitDefines.h.
 
void ReplaceAllUnitFlags (UnitFlags flags)
 Remove the Unit flag specify only.
 
UnitFlags2 GetUnitFlags2 () const
 Remove all UnitFlags and set new ones. UnitFlags available in UnitDefines.h.
 
bool HasUnitFlag2 (UnitFlags2 flags) const
 
void SetUnitFlag2 (UnitFlags2 flags)
 
void RemoveUnitFlag2 (UnitFlags2 flags)
 
void ReplaceAllUnitFlags2 (UnitFlags2 flags)
 
void SetEmoteState (Emote emoteState)
 
void ClearEmoteState ()
 Sets emote state (looping emote). Emotes available in SharedDefines.h.
 
NPCFlags GetNpcFlags () const
 Clears emote state (looping emote)
 
bool HasNpcFlag (NPCFlags flags) const
 
void SetNpcFlag (NPCFlags flags)
 
void RemoveNpcFlag (NPCFlags flags)
 
void ReplaceAllNpcFlags (NPCFlags flags)
 
uint32 GetDynamicFlags () const override
 
void ReplaceAllDynamicFlags (uint32 flag) override
 
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)
 
bool IsCrowdControlled () const
 
bool IsImmobilizedState () const
 
void SetAnimTier (AnimTier animTier)
 
bool IsSummon () const
 
bool IsGuardian () const
 
bool IsControllableGuardian () const
 
bool IsPet () const
 
bool IsHunterPet () const
 
bool IsTotem () const
 
bool IsVehicle () const
 
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
 
uint32 GetCreatureType () const
 
uint32 GetCreatureTypeMask () const
 
bool IsCritter () const
 
uint8 getRace (bool original=false) const
 
void setRace (uint8 race)
 
uint32 getRaceMask () const
 
DisplayRace GetDisplayRaceFromModelId (uint32 modelId) const
 
DisplayRace GetDisplayRace () const
 
uint8 getClass () const
 
virtual bool IsClass (Classes unitClass, ClassContext context=CLASS_CONTEXT_NONE) const
 
uint32 getClassMask () const
 
uint8 getGender () const
 
uint32 GetFaction () const override
 
FactionTemplateEntry const * GetFactionTemplateEntry () const
 
void SetFaction (uint32 faction)
 
void RestoreFaction ()
 
uint32 GetOldFactionId () const
 
ObjectGuid GetTarget () 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 IsAreaEffectPvPBlocked (Unit const *target, SpellInfo const *bySpell) const
 
bool IsValidAssistTarget (Unit const *target) const
 
bool _IsValidAssistTarget (Unit const *target, SpellInfo const *bySpell) const
 
bool IsClientControlled (Player const *exactClient=nullptr) const
 
Player const * GetClientControlling () const
 
float GetBoundaryRadius () const
 
float GetCombatReach () const override
 
float GetMeleeReach () const
 
bool IsWithinRange (Unit const *obj, float dist) const
 
bool IsWithinBoundaryRadius (Unit const *obj) 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
 
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 GetRandomContactPoint (Unit const *target, float &x, float &y, float &z, bool force=false) const
 
Unit * getAttackerForHelper () const
 
bool Attack (Unit *victim, bool meleeAttack)
 
void CastStop (uint32 except_spellid=0, bool withInstant=true)
 Interrupt the unit cast for all the current spells.
 
bool AttackStop ()
 Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell, AI assistance, and call SendMeleeAttackStop() to the client.
 
void RemoveAllAttackers ()
 Remove all units in m_attackers list and send them AttackStop()
 
AttackerSet const & getAttackers () const
 
bool GetMeleeAttackPoint (Unit *attacker, Position &pos)
 
bool isAttackingPlayer () const
 
Unit * GetVictim () const
 
void CombatStop (bool includingCast=false, bool mutualPvP=true, bool keepPvPForOthers=false)
 
void CombatStopWithPets (bool includingCast=false)
 
void StopAttackFaction (uint32 faction_id)
 
void StopAttackingInvalidTarget ()
 
Unit * SelectNearbyTarget (Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
 
Unit * SelectNearbyNoTotemTarget (Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
 
void SendMeleeAttackStop (Unit const *victim=nullptr) const
 Send to the client SMSG_ATTACKSTOP but doesn't clear UNIT_STATE_MELEE_ATTACKING on server side or interrupt spells. Unless you know exactly what you're doing, use AttackStop() or RemoveAllAttackers() instead.
 
void SendMeleeAttackStart (Unit *victim, Player *sendTo=nullptr)
 
uint32 GetAttackTime (WeaponAttackType att) const
 
uint32 GetRageWeaponSpeedHitFactor (WeaponAttackType att) const
 
void SetAttackTime (WeaponAttackType att, uint32 val)
 
void ApplyAttackTimePercentMod (WeaponAttackType att, float val, bool apply)
 
void ApplyCastTimePercentMod (float val, bool apply)
 
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 IsEngagedBy (Unit const *who) const
 
void EngageWithTarget (Unit *who)
 
bool IsInCombat () const
 
bool IsInCombatWith (Unit const *who) const
 
bool IsPetInCombat () const
 
void SetInCombatWith (Unit *enemy, bool addSecondUnitSuppressed=false)
 
void ClearInCombat (bool keepPvPForOthers=false)
 
void ClearInPetCombat ()
 
uint32 GetCombatTimer () const
 
void SetCombatTimer (uint32 timer)
 
bool CanHaveThreatList (bool skipAliveCheck=false) const
 
void AddThreat (Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
 
void AtTargetAttacked (Unit *target, bool canInitialAggro)
 
ThreatManager & GetThreatMgr ()
 
ThreatManager const & GetThreatMgr () const
 
CombatManager & GetCombatManager ()
 
CombatManager const & GetCombatManager () const
 
bool IsThreatened () const
 
bool IsThreatenedBy (Unit const *who) const
 
void UpdatePetCombatState ()
 
virtual void AtEnterCombat ()
 
virtual void AtExitCombat ()
 
bool IsCombatDisallowed () const
 
void SetIsCombatDisallowed (bool value)
 
void SetLastDamagedTargetGuid (ObjectGuid const &guid)
 
ObjectGuid const & GetLastDamagedTargetGuid () const
 
void AttackerStateUpdate (Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false, bool ignoreCasting=false)
 
bool haveOffhandWeapon () const
 
bool CanDualWield () const
 
virtual void SetDualWieldMode (DualWieldMode mode)
 
bool HasMainhandWeapon () const
 
bool HasOffhandWeapon () const
 
bool HasRangedWeapon () const
 
bool hasMainhandWeaponForAttack () const
 
bool HasMainhandWeaponForAttack () const
 
bool HasOffhandWeaponForAttack () const
 
bool HasRangedWeaponForAttack () const
 
bool CanUseAttackType (WeaponAttackType attacktype) const
 
void HandleProcExtraAttackFor (Unit *victim, uint32 count)
 
void SetLastExtraAttackSpell (uint32 spellId)
 
uint32 GetLastExtraAttackSpell () const
 
void AddExtraAttacks (uint32 count)
 
uint8 GetComboPoints (Unit const *who=nullptr) const
 
uint8 GetComboPoints (ObjectGuid const &guid) const
 
Unit * GetComboTarget () const
 
ObjectGuid const GetComboTargetGUID () const
 
void AddComboPoints (Unit *target, int8 count)
 
void AddComboPoints (int8 count)
 
void ClearComboPoints ()
 
void AddComboPointHolder (Unit *unit)
 
void RemoveComboPointHolder (Unit *unit)
 
void ClearComboPointHolders ()
 
void SetContestedPvP (Player *attackedPlayer=nullptr, bool lookForNearContestedGuards=true)
 
bool IsContestedGuard () const
 
bool RespondsToCallForHelp () const
 
bool IsInSanctuary () const
 
bool IsPvP () const
 
bool IsFFAPvP () const
 
void SetPvP (bool state)
 
float GetStat (Stats stat) const
 
void SetStat (Stats stat, int32 val)
 
Stats GetStatByAuraGroup (UnitMods unitMod) const
 
float GetCreateStat (Stats stat) const
 
void SetCreateStat (Stats stat, float val)
 
float GetPosStat (Stats stat) const
 
float GetNegStat (Stats stat) const
 
void InitStatBuffMods ()
 
bool HandleStatFlatModifier (UnitMods unitMod, UnitModifierFlatType modifierType, float amount, bool apply)
 
void ApplyStatPctModifier (UnitMods unitMod, UnitModifierPctType modifierType, float amount)
 
void SetStatFlatModifier (UnitMods unitMod, UnitModifierFlatType modifierType, float val)
 
void SetStatPctModifier (UnitMods unitMod, UnitModifierPctType modifierType, float val)
 
float GetFlatModifierValue (UnitMods unitMod, UnitModifierFlatType modifierType) const
 
float GetPctModifierValue (UnitMods unitMod, UnitModifierPctType modifierType) const
 
void UpdateUnitMod (UnitMods unitMod)
 
virtual bool CheckAttackFitToAuraRequirement (WeaponAttackType, AuraEffect const *) const
 
virtual void UpdateDamageDoneMods (WeaponAttackType attackType, int32 skipEnchantSlot=-1)
 
void UpdateAllDamageDoneMods ()
 
void UpdateDamagePctDoneMods (WeaponAttackType attackType)
 
void UpdateAllDamagePctDoneMods ()
 
float GetTotalStatValue (Stats stat, float additionalValue=0.0f) const
 
void SetCanModifyStats (bool modifyStats)
 
bool CanModifyStats () const
 
void UpdateStatBuffMod (Stats stat)
 
uint8 GetLevel () const
 
uint8 getLevelForTarget (WorldObject const *) const override
 
void SetLevel (uint8 lvl, bool showLevelChange=true)
 
uint32 GetHealth () const
 
uint32 GetMaxHealth () const
 
float GetHealthPct () const
 
int32 GetHealthGain (int32 dVal)
 
uint32 GetCreateHealth () 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
 
uint32 CountPctFromMaxHealth (int32 pct) const
 
uint32 CountPctFromCurHealth (int32 pct) const
 
void SetHealth (uint32 val)
 
void SetMaxHealth (uint32 val)
 
void SetFullHealth ()
 
int32 ModifyHealth (int32 val)
 
void SetCreateHealth (uint32 val)
 
Powers getPowerType () const
 
virtual bool HasActivePowerType (Powers power)
 
Powers GetPowerTypeByAuraGroup (UnitMods unitMod) const
 
uint32 GetPower (Powers power) const
 
uint32 GetMaxPower (Powers power) const
 
float GetPowerPct (Powers power) const
 
uint32 GetCreatePowers (Powers power) const
 
void setPowerType (Powers power)
 
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)
 
void RewardRage (uint32 damage, uint32 weaponSpeedHitFactor, bool attacker)
 
uint32 GetCreateMana () const
 
void SetCreateMana (uint32 val)
 
bool CanRestoreMana (SpellInfo const *spellInfo) const
 
void SetLastManaUse (uint32 spellCastTime)
 
bool IsUnderLastManaUseEffect () const
 
float GetAPMultiplier (WeaponAttackType attType, bool normalized)
 
uint32 GetArmor () const
 
void SetArmor (int32 val)
 
float GetUnitDodgeChance () const
 
float GetUnitParryChance () const
 
float GetUnitBlockChance () const
 
float GetUnitMissChance (WeaponAttackType attType) const
 
float GetUnitCriticalChance (WeaponAttackType attackType, Unit const *victim) const
 
float GetCritChanceFromSkillDiff (Unit const *victim) 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
 
bool CanApplyResilience () const
 
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
 
int32 GetMechanicResistChance (SpellInfo const *spell)
 
uint32 GetResistance (SpellSchoolMask mask) const
 
uint32 GetResistance (SpellSchools school) const
 
void SetResistance (SpellSchools school, int32 val)
 
void UpdateResistanceBuffModsMod (SpellSchools school)
 
uint16 GetMaxSkillValueForLevel (Unit const *target=nullptr) const
 
float GetTotalAuraModValue (UnitMods unitMod) const
 
SpellSchools GetSpellSchoolByAuraGroup (UnitMods unitMod) const
 
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 UpdateAllResistances ()
 
virtual void UpdateDamagePhysical (WeaponAttackType attType)
 
void DealMeleeDamage (CalcDamageInfo *damageInfo, bool durabilityLoss)
 
void DealSpellDamage (SpellNonMeleeDamage *damageInfo, bool durabilityLoss, Spell const *spell=nullptr)
 
void DealDamageShieldDamage (Unit *victim)
 
void KillSelf (bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
 
uint32 CalculateDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, uint8 itemDamagesMask=0)
 
void CalculateMeleeDamage (Unit *victim, CalcDamageInfo *damageInfo, WeaponAttackType attackType=BASE_ATTACK, const bool sittingVictim=false)
 
void CalculateSpellDamageTaken (SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=BASE_ATTACK, bool crit=false)
 
float CalculateDefaultCoefficient (SpellInfo const *spellInfo, DamageEffectType damagetype) const
 
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)
 
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 CalculateAOEDamageReduction (int32 damage, uint32 schoolMask, bool npcCaster) const
 
uint32 GetMeleeDamageReduction (uint32 damage) const
 
uint32 GetRangedDamageReduction (uint32 damage) const
 
uint32 GetSpellDamageReduction (uint32 damage) const
 
float GetMeleeCritChanceReduction () const
 
float GetRangedCritChanceReduction () const
 
float GetSpellCritChanceReduction () const
 
uint32 GetMeleeCritDamageReduction (uint32 damage) const
 
uint32 GetRangedCritDamageReduction (uint32 damage) const
 
uint32 GetSpellCritDamageReduction (uint32 damage) const
 
CharmInfo * GetCharmInfo ()
 
CharmInfo * InitCharmInfo ()
 
Unit * GetCharmer () const
 
Unit * GetCharm () const
 
Unit * GetCharmerOrOwner () const
 
Unit * GetCharmerOrOwnerOrSelf () const
 
Player * GetCharmerOrOwnerPlayerOrPlayerItself () const
 
ObjectGuid GetCharmerOrOwnerGUID () const override
 
ObjectGuid GetCharmerOrOwnerOrOwnGUID () const
 
Player * GetAffectingPlayer () const
 
Unit * GetFirstControlled () const
 
bool IsControlledByPlayer () const
 
bool IsCreatedByPlayer () const
 
bool IsCharmedOwnedByPlayerOrPlayer () const
 
bool IsCharmed () const
 
bool isPossessed () const
 
bool isPossessedByPlayer () const
 
bool isPossessing () const
 
bool isPossessing (Unit *u) const
 
void SetCharm (Unit *target, bool apply)
 
bool SetCharmedBy (Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
 
void UpdateCharmAI ()
 
void RemoveCharmedBy (Unit *charmer)
 
void RemoveCharmAuras ()
 
void RemoveAllControlled (bool onDeath=false)
 
void DeleteCharmInfo ()
 
virtual bool HasSpellItemCooldown (uint32, uint32) const
 
void BuildCooldownPacket (WorldPacket &data, uint8 flags, uint32 spellId, uint32 cooldown)
 
void BuildCooldownPacket (WorldPacket &data, uint8 flags, PacketCooldowns const &cooldowns)
 
Aura * AddAura (uint32 spellId, Unit *target)
 
Aura * AddAura (SpellInfo const *spellInfo, uint8 effMask, Unit *target)
 
void SetAuraStack (uint32 spellId, Unit *target, uint32 stack)
 
int32 GetHighestExclusiveSameEffectSpellGroupValue (AuraEffect const *aurEff, AuraType auraType, bool checkMiscValue=false, int32 miscValue=0) const
 
bool IsHighestExclusiveAura (Aura const *aura, bool removeOtherAuraApplications=false)
 
bool IsHighestExclusiveAuraEffect (SpellInfo const *spellInfo, AuraType auraType, int32 effectAmount, uint8 auraEffectMask, bool removeOtherAuraApplications=false)
 
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 owned)
 
bool _IsNoStackAuraDueToAura (Aura *appliedAura, Aura *existingAura) const
 
void _RegisterAuraEffect (AuraEffect *aurEff, bool apply)
 
AuraMap & GetOwnedAuras ()
 
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)
 
Aura * GetOwnedAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, Aura *except=nullptr) const
 
AuraApplicationMap & GetAppliedAuras ()
 
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 RemoveBindSightAuras ()
 
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 (uint64 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
 
AuraList & GetSingleCastAuras ()
 
AuraList const & GetSingleCastAuras () const
 
AuraEffect * GetAuraEffect (uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffect * GetAuraEffectOfRankedSpell (uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffect * GetAuraEffect (AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
 
AuraEffect * GetAuraEffect (AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffect * GetAuraEffectDummy (uint32 spellid) const
 
AuraEffect * GetDummyAuraEffect (SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
 
AuraApplication * GetAuraApplication (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
 
Aura * GetAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
AuraApplication * GetAuraApplicationOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
 
Aura * GetAuraOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
void GetDispellableAuraList (Unit *caster, uint32 dispelMask, DispelChargesList &dispelList, SpellInfo const *dispelSpell)
 
bool HasAuraEffect (uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
 
uint32 GetAuraCount (uint32 spellId) const
 
bool HasAuras (SearchMethod sm, std::vector< uint32 > &spellIds) const
 Check if unit has ANY or ALL specified auras.
 
template<typename... Auras>
bool HasAnyAuras (Auras... spellIds) const
 Checks if the unit has ANY specified auras.
 
template<typename... Auras>
bool HasAllAuras (Auras... spellIds) const
 Checks if the unit has ALL specified auras.
 
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 (uint64 mechanicMask) const
 
bool HasAuraTypeWithFamilyFlags (AuraType auraType, uint32 familyName, uint32 familyFlags) const
 
bool HasBreakableByDamageAuraType (AuraType type, uint32 excludeAura=0) const
 
bool HasBreakableByDamageCrowdControlAura (Unit *excludeCasterChannel=nullptr) const
 
AuraEffect * IsScriptOverriden (SpellInfo const *spell, int32 script) const
 
uint32 GetDiseasesByCaster (ObjectGuid casterGUID, uint8 mode=0)
 
uint32 GetDoTsByCaster (ObjectGuid casterGUID) const
 
int32 GetTotalAuraModifier (AuraType auratype) const
 
float GetTotalAuraMultiplier (AuraType auratype) const
 
int32 GetMaxPositiveAuraModifier (AuraType auratype) const
 
int32 GetMaxNegativeAuraModifier (AuraType auratype) const
 
int32 GetTotalAuraModifier (AuraType auratype, std::function< bool(AuraEffect const *)> const &predicate) const
 
float GetTotalAuraMultiplier (AuraType auraType, std::function< bool(AuraEffect const *)> const &predicate) const
 
int32 GetMaxPositiveAuraModifier (AuraType auraType, std::function< bool(AuraEffect const *)> const &predicate) const
 
int32 GetMaxNegativeAuraModifier (AuraType auraType, std::function< bool(AuraEffect const *)> const &predicate) const
 
int32 GetTotalAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
float GetTotalAuraMultiplierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
int32 GetMaxPositiveAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask, AuraEffect const *except=nullptr) const
 
int32 GetMaxNegativeAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
int32 GetTotalAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
float GetTotalAuraMultiplierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetMaxPositiveAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetMaxNegativeAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetTotalAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
float GetTotalAuraMultiplierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
int32 GetMaxPositiveAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
int32 GetMaxNegativeAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
VisibleAuraMap const * GetVisibleAuras ()
 
AuraApplication * GetVisibleAura (uint8 slot)
 
void SetVisibleAura (uint8 slot, AuraApplication *aur)
 
void RemoveVisibleAura (uint8 slot)
 
void ModifyAuraState (AuraStateType flag, bool apply)
 
uint32 BuildAuraStateUpdateForTarget (Unit *target) const
 
bool HasAuraState (AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
 
bool CanProc ()
 
void SetCantProc (bool apply)
 
void ProcSkillsAndReactives (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 (AuraApplicationProcContainer &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, AuraApplicationProcContainer &procAuras)
 
float GetWeaponProcChance () const
 
float GetPPMProcChance (uint32 WeaponSpeed, float PPM, SpellInfo const *spellProto) const
 
Player * GetSpellModOwner () const override
 
Spell * GetCurrentSpell (CurrentSpellTypes spellType) const
 
Spell * GetCurrentSpell (uint32 spellType) const
 
Spell * GetFirstCurrentCastingSpell () const
 
Spell * FindCurrentSpellBySpellId (uint32 spell_id) const
 
int32 GetCurrentSpellCastTime (uint32 spell_id) const
 
void SetCurrentCastedSpell (Spell *pSpell)
 
void SetInstantCast (bool set)
 
bool CanInstantCast () const
 
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)
 
float GetSpellMaxRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
float GetSpellMinRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
uint32 GetInterruptMask () const
 
void AddInterruptMask (uint32 mask)
 
void UpdateInterruptMask ()
 
void InterruptSpell (CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
 
bool isSpellBlocked (Unit *victim, SpellInfo const *spellProto, WeaponAttackType attackType=BASE_ATTACK)
 
void FinishSpell (CurrentSpellTypes spellType, bool ok=true)
 
Unit * GetMagicHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo)
 
Unit * GetMeleeHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo=nullptr)
 
float MeleeSpellMissChance (Unit const *victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
 
SpellMissInfo MeleeSpellHitResult (Unit *victim, SpellInfo const *spell) override
 
void SendHealSpellLog (HealInfo const &healInfo, bool critical=false)
 
int32 HealBySpell (HealInfo &healInfo, bool critical=false)
 
int32 SpellBaseHealingBonusDone (SpellSchoolMask schoolMask)
 
float SpellPctHealingModsDone (Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype, bool includeHealingDonePct=true)
 
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)
 
void SendEnergizeSpellLog (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
 
void EnergizeBySpell (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
 
void ApplySpellImmune (uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
 
bool IsImmunedToSpell (SpellInfo const *spellInfo, Unit const *caster)
 
bool IsImmunedToSpell (SpellInfo const *spellInfo, Unit const *caster, SpellSchoolMask spellSchoolMask)
 
bool IsImmunedToSpell (SpellInfo const *spellInfo, uint32 effectMask, Unit const *caster=nullptr)
 
bool IgnoresSchoolImmunityFromFriendlyCaster (Unit const *caster, uint32 immunityAuraId, SpellInfo const *immunitySpellInfo) const
 
bool IsImmunedToDamage (SpellSchoolMask schoolMask) const
 
bool IsImmunedToDamage (Unit const *caster, SpellInfo const *spellInfo) const
 
bool IsImmunedToSchool (SpellSchoolMask schoolMask) const
 
bool HasSchoolImmunityForMask (SpellSchoolMask schoolMask, Unit const *caster, SpellInfo const *spellInfo) const
 
uint32 GetSchoolImmunityMask () const
 
uint32 GetDamageImmunityMask () const
 
bool IsImmunedToDamageOrSchool (SpellSchoolMask schoolMask) const
 
bool IsImmunedToAuraPeriodicTick (Unit const *caster, SpellInfo const *spellInfo) const
 
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
 
float ApplyEffectModifiers (SpellInfo const *spellProto, uint8 effect_index, float value) const
 
float CalculateLevelPenalty (SpellInfo const *spellProto) const
 
uint32 GetCastingTimeForBonus (SpellInfo const *spellProto, DamageEffectType damagetype, uint32 CastingTime) const
 
void CastDelayedSpellWithPeriodicAmount (Unit *caster, uint32 spellId, AuraType auraType, int32 addAmount, uint8 effectIndex=0, TriggerCastFlags extraTriggerFlags=TRIGGERED_NONE)
 
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)
 
SpellCastResult CastCustomSpell (SpellInfo const *spellInfo, CustomSpellValues const &value, Unit *victim=nullptr, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void _RegisterDynObject (DynamicObject *dynObj)
 
void _UnregisterDynObject (DynamicObject *dynObj)
 
DynamicObject * GetDynObject (uint32 spellId)
 
bool RemoveDynObject (uint32 spellId)
 
void RemoveAllDynObjects ()
 
GameObject * GetGameObject (uint32 spellId) const
 
void AddGameObject (GameObject *gameObj)
 
void RemoveGameObject (GameObject *gameObj, bool del)
 
void RemoveGameObject (uint32 spellid, bool del)
 
void RemoveGameObjectsByType (GameobjectTypes type, bool del)
 
void RemoveAllGameObjects ()
 
bool IsPolymorphed () const
 
bool isFrozen () const
 
bool IsInFlight () const
 
bool IsLevitating () const
 
bool IsWalking () const
 
bool isMoving () const
 
bool isTurning () const
 
bool IsHovering () const
 
bool isSwimming () const
 
bool IsFlying () const
 
bool IsFalling () const
 
bool IsRooted () const
 
float GetHoverHeight () const
 
bool IsActionPreventedByCasting () const
 
bool CanFreeMove () const
 
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 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)
 
void SendSpeedToController (UnitMoveType mtype, Player *target) const
 
void propagateSpeedChange ()
 
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 SetDisableGravity (bool disable)
 
void SetCanFly (bool enable)
 Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pressing space for example. For creatures, please look for DisableGravity().
 
void SetWaterWalking (bool enable)
 
void SetFeatherFall (bool enable)
 
void SetHover (bool enable)
 
MotionMaster * GetMotionMaster ()
 
MotionMaster const * GetMotionMaster () const
 
bool IsStopped () const
 
void StopMoving ()
 
void StopMovingOnCurrentPos ()
 
virtual void PauseMovement (uint32 timer=0, uint8 slot=0)
 Disable the unit movement by clearing UNIT_STATE_MOVING and stopping the spline.
 
void ResumeMovement (uint32 timer=0, uint8 slot=0)
 
void SetControlled (bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
 
void DisableRotate (bool apply)
 
void DisableSpline ()
 
SheathState GetSheath () const
 
virtual void SetSheath (SheathState sheathed)
 
uint8 getStandState () const
 
bool IsSitState () const
 
bool IsStandState () const
 
bool IsStandUpOnMovementState () const
 
void SetStandState (uint8 state)
 
void SetStandFlags (uint8 flags)
 
void RemoveStandFlags (uint8 flags)
 
DeathState getDeathState ()
 
Milliseconds GetLastDeathTime () const
 
bool IsInPreDeathAuraTick () const
 
void SetInPreDeathAuraTick (bool value)
 
bool IsAlive () const
 
bool isDying () const
 
bool isDead () const
 
bool HasGhostAura () const
 
bool HasMountedAura () const
 
bool HasWaterWalkAura () const
 
bool HasFeatherFallAura () const
 
bool HasHoverAura () const
 
bool HasFlyAura () const
 
bool HasSpiritOfRedemptionAura () const
 
bool HasPreventsFleeingAura () const
 
bool HasPreventDurabilityLossAura () const
 
bool HasPreventResurectionAura () const
 
bool HasTransformAura () const
 
bool HasInterruptRegenAura () const
 
bool HasNoPVPCreditAura () const
 
bool HasWaterBreathingAura () const
 
bool HasIgnoreHitDirectionAura () const
 
bool HasSpellMagnetAura () const
 
bool HasOpenStableAura () const
 
bool HasCloneCasterAura () const
 
bool HasReflectSpellsAura () const
 
bool HasDetectAmoreAura () const
 
bool HasAllowOnlyAbilityAura () const
 
bool HasPeriodicDummyAura () const
 
bool HasControlVehicleAura () const
 
bool HasAOECharmAura () const
 
bool HasDetectSpellsAura () const
 
bool HasPacifySilenceAura () const
 
bool HasSilenceAura () const
 
bool HasShapeshiftAura () const
 
bool HasDecreaseSpeedAura () const
 
bool HasPacifyAura () const
 
bool HasIgnoreTargetResistModifiersAura () const
 
bool HasIncreaseMountedSpeedAura () const
 
bool HasIncreaseMountedFlightSpeedAura () const
 
bool HasAttackerSpellCritChanceAura () const
 
bool HasUnattackableAura () const
 
bool HasHealthRegenInCombatAura () const
 
bool HasRegenDuringCombatAura () const
 
bool HasFearAura () const
 
bool HasConfuseAura () const
 
bool HasRootAura () const
 
bool HasStunAura () const
 
bool HasTauntAura () const
 
bool HasStealthAura () const
 
bool HasStealthDetectAura () const
 
bool HasInvisibilityAura () const
 
bool HasInvisibilityDetectAura () const
 
bool IsHostileTo (Unit const *unit) const
 
bool IsHostileToPlayers () const
 
bool IsFriendlyTo (Unit const *unit) const
 
bool IsNeutralToAll () const
 
void ClearAllReactives ()
 
void StartReactiveTimer (ReactiveType reactive)
 
void UpdateReactives (uint32 p_time)
 
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 ()
 
bool IsInPartyWith (Unit const *unit) const
 
bool IsInRaidWith (Unit const *unit) const
 
void GetPartyMembers (std::list< Unit * > &units)
 
Unit * GetNextRandomRaidMemberOrPet (float radius)
 
void UpdateAuraForGroup (uint8 slot)
 
ReputationRank GetReactionTo (Unit const *target, bool checkOriginalFaction=false) const
 
ReputationRank GetFactionReactionTo (FactionTemplateEntry const *factionTemplateEntry, Unit const *target) const
 
SharedVisionList const & GetSharedVisionList ()
 
void AddPlayerToVision (Player *player)
 
void RemovePlayerFromVision (Player *player)
 
bool HasSharedVision () const
 
uint32 GetVirtualItemId (uint32 slot) const
 
void SetVirtualItem (uint32 slot, uint32 itemId)
 
bool IsMounted () const
 
uint32 GetMountID () const
 
void Mount (uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
 
void Dismount ()
 
bool IsInDisallowedMountForm () const
 
void FollowerAdded (AbstractFollower *f)
 
void FollowerRemoved (AbstractFollower *f)
 
virtual float GetFollowAngle () const
 
void RemoveAllFollowers ()
 
Guardian * GetGuardianPet () const
 
Minion * GetFirstMinion () const
 
Creature * GetCompanionPet () const
 
Pet * CreateTamedPetFrom (Creature *creatureTarget, uint32 spell_id=0)
 
Pet * CreateTamedPetFrom (uint32 creatureEntry, uint32 spell_id=0)
 
bool InitTamedPet (Pet *pet, uint8 level, uint32 spell_id)
 
void SetMinion (Minion *minion, bool apply)
 
void GetAllMinionsByEntry (std::list< Creature * > &Minions, uint32 entry)
 
void RemoveAllMinionsByEntry (uint32 entry)
 
void AddPetAura (PetAura const *petSpell)
 
void RemovePetAura (PetAura const *petSpell)
 
void CastPetAura (PetAura const *aura)
 
bool IsPetAura (Aura const *aura)
 
void PetSpellFail (SpellInfo const *spellInfo, Unit *target, uint32 result)
 
void UnsummonAllTotems (bool onDeath=false)
 
TransportBase * GetDirectTransport () const
 
bool CreateVehicleKit (uint32 id, uint32 creatureEntry)
 Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
 
void RemoveVehicleKit ()
 
Vehicle * GetVehicleKit () const
 
Vehicle * GetVehicle () const
 
bool IsOnVehicle (Unit const *vehicle) const
 
Unit * GetVehicleBase () const
 
Creature * GetVehicleCreatureBase () const
 
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)
 
bool HandleSpellClick (Unit *clicker, int8 seatId=-1)
 
void _ExitVehicle (Position const *exitPosition=nullptr)
 
void _EnterVehicle (Vehicle *vehicle, int8 seatId, AuraApplication const *aurApp=nullptr)
 
void HandleEmoteCommand (uint32 emoteId)
 
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)
 
ShapeshiftForm GetShapeshiftForm () const
 
void SetShapeshiftForm (ShapeshiftForm form)
 
bool IsAttackSpeedOverridenShapeShift () const
 
bool IsInFeralForm () const
 
void setTransForm (uint32 spellid)
 
uint32 getTransForm () const
 
void DeMorph ()
 
virtual void RecalculateObjectScale ()
 
uint32 GetDisplayId () const
 
virtual void SetDisplayId (uint32 modelId, std::optional< float > displayScale={})
 
uint32 GetNativeDisplayId () const
 
void RestoreDisplayId ()
 
void SetNativeDisplayId (uint32 displayId)
 
uint32 GetModelForForm (ShapeshiftForm form, uint32 spellId)
 
virtual bool IsInWater () const
 
virtual bool IsUnderWater () const
 
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 SetInFront (WorldObject const *target)
 
void SetFacingTo (float ori)
 
void SetFacingToObject (WorldObject *object, Milliseconds timed=0ms)
 
bool isInAccessiblePlaceFor (Creature const *c) const
 
bool isInFrontInMap (Unit const *target, float distance, float arc=M_PI) const
 
bool isInBackInMap (Unit const *target, float distance, float arc=M_PI) const
 
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 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.
 
virtual bool UpdatePosition (float x, float y, float z, float ang, bool teleport=false)
 
bool UpdatePosition (Position const &pos, bool teleport=false)
 
void ProcessPositionDataChanged (PositionFullTerrainStatus const &data) override
 
virtual void ProcessTerrainStatusUpdate ()
 
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
 
void AddPointedBy (SafeUnitPointer *sup)
 
void RemovePointedBy (SafeUnitPointer *sup)
 
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 SendComboPoints ()
 
void SendPlaySpellVisual (uint32 id)
 
void SendPlaySpellImpact (ObjectGuid guid, uint32 id)
 
void SendPetActionFeedback (uint8 msg) const
 -------—Pet responses methods--------------—
 
void SendPetActionSound (PetAction action) const
 
void SendPetDismissSound () const
 
void SendPetAIReaction (ObjectGuid guid) const
 
void SendPeriodicAuraLog (SpellPeriodicAuraLogInfo *pInfo)
 
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 SendSpellDamageResist (Unit *target, uint32 spellId)
 
void SendSpellDamageImmune (Unit *target, uint32 spellId)
 
void SendTameFailure (uint8 result)
 
void SendTeleportPacket (Position &pos)
 
void SendMovementFlagUpdate (bool self=false)
 
void SendMovementWaterWalking (Player *sendTo)
 
void SendMovementFeatherFall (Player *sendTo)
 
void SendMovementHover (Player *sendTo)
 
void SendClearTarget ()
 
void ExecuteDelayedUnitRelocationEvent ()
 
void ExecuteDelayedUnitAINotifyEvent ()
 
void BuildHeartBeatMsg (WorldPacket *data) const
 
void BuildMovementPacket (ByteBuffer *data) const
 
void OutDebugInfo () const
 
std::string GetDebugInfo () const override
 
SpellCastResult CastSpell (CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={})
 
SpellCastResult CastSpell (CastSpellTargetArg const &targets, SpellInfo const *info, CastSpellExtraArgs const &args={})
 
bool IsHostileTo (WorldObject const *target) const
 
bool IsFriendlyTo (WorldObject const *target) const
 
- Public Member Functions inherited from WorldObject
 ~WorldObject () override
 
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
 
void UpdateGroundPositionZ (float x, float y, float &z) const
 
void UpdateAllowedPositionZ (float x, float y, float &z, float *groundZ=nullptr) const
 
void GetRandomPoint (Position const &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
 
Position GetRandomPoint (Position const &srcPos, float distance) const
 
uint32 GetInstanceId () const
 
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
 
InstanceScript * GetInstanceScript () const
 
std::string const & GetName () const
 
void SetName (std::string const &newname)
 
float GetDistance (WorldObject const *obj) const
 
float GetDistance (Position const &pos) const
 
float GetDistance (float x, float y, float z) const
 
float GetDistance2d (WorldObject const *obj) const
 
float GetDistance2d (float x, float y) const
 
float GetDistanceZ (WorldObject const *obj) const
 
bool IsSelfOrInSameMap (WorldObject const *obj) const
 
bool IsInMap (WorldObject const *obj) const
 
bool IsWithinDist3d (float x, float y, float z, float dist) const
 
bool IsWithinDist3d (Position const *pos, float dist) const
 
bool IsWithinDist2d (float x, float y, float dist) const
 
bool IsWithinDist2d (Position const *pos, float dist) const
 
virtual bool IsWithinSightRange (Position const &pos, float dist) const
 
bool IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
 
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
 
bool IsWithinLOS (float x, float y, float z, 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 SendMessageToSet (WorldPacket const *data, bool self) const
 
virtual void SendMessageToSetInRange (WorldPacket const *data, float dist, bool self) const
 
virtual void SendMessageToSet (WorldPacket const *data, Player const *skipped_rcvr) const
 
void PlayDistanceSound (uint32 sound_id, Player *target=nullptr)
 
void PlayDirectSound (uint32 sound_id, Player *target=nullptr)
 
void PlayRadiusSound (uint32 sound_id, float radius)
 
void PlayDirectMusic (uint32 music_id, Player *target=nullptr)
 
void PlayRadiusMusic (uint32 music_id, float radius)
 
template<typename Worker >
void DoForAllVisiblePlayers (Worker &&worker)
 
template<typename Worker >
void DoForAllVisibleWorldObjects (Worker &&worker)
 
void DestroyForVisiblePlayers ()
 
void SendObjectDeSpawnAnim (ObjectGuid guid)
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
virtual float GetSightRange (WorldObject const *target=nullptr) const
 
float GetLeewayBonusRange (Unit const *target) const
 
float GetLeewayBonusRadius () 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 ()
 
Map * GetMap () const
 
Map * FindMap () const
 
void SetZoneScript ()
 
void ClearZoneScript ()
 
ZoneScript * GetZoneScript () const
 
TempSummon * SummonCreature (uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
 
TempSummon * SummonCreature (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)
 
GameObject * SummonGameObject (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)
 
Creature * SummonTrigger (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)
 
void SummonGameObjectGroup (uint8 group, std::list< GameObject * > *list=nullptr)
 
Creature * FindNearestCreature (uint32 entry, float range, bool alive=true) const
 
GameObject * FindNearestGameObject (uint32 entry, float range, bool onlySpawned=false) const
 
GameObject * FindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
Player * SelectNearestPlayer (float distance=0) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &gameobjectList, std::vector< uint32 > const &entries, float maxSearchRange) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &creatureList, std::vector< uint32 > const &entries, float maxSearchRange) const
 
void GetDeadCreatureListInGrid (std::list< Creature * > &lList, float maxSearchRange, bool alive=false) const
 
virtual void UpdateObjectVisibilityOnCreate ()
 
void BuildUpdate (UpdateDataMapType &data_map) override
 
void GetCreaturesWithEntryInRange (std::list< Creature * > &creatureList, float radius, uint32 entry)
 
void SetPositionDataUpdate ()
 
void UpdatePositionData ()
 
bool IsPositionDataUpdatePending () const
 
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)
 
VisibilityDistanceType GetVisibilityOverrideType () const
 
bool IsVisibilityOverridden () const
 
bool IsZoneWideVisible () const
 
bool IsFarVisible () const
 
float GetVisibilityOverrideDistance () const
 
void SetVisibilityDistanceOverride (VisibilityDistanceType type)
 
bool IsInWintergrasp () const
 
Transport * GetTransport () const
 
float GetTransOffsetX () const
 
float GetTransOffsetY () const
 
float GetTransOffsetZ () const
 
float GetTransOffsetO () const
 
uint32 GetTransTime () const
 
int8 GetTransSeat () const
 
void SetTransport (Transport *t)
 
virtual float GetStationaryX () const
 
virtual float GetStationaryY () const
 
virtual float GetStationaryZ () const
 
virtual float GetStationaryO () const
 
float GetMapWaterOrGroundLevel (Position pos, float *ground=nullptr) 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.
 
void AddAllowedLooter (ObjectGuid guid)
 
void ResetAllowedLooters ()
 
void SetAllowedLooters (GuidUnorderedSet const looters)
 
bool HasAllowedLooter (ObjectGuid guid) const
 
GuidUnorderedSet const & GetAllowedLooters () const
 
void RemoveAllowedLooter (ObjectGuid guid)
 
bool CanBeAddedToMapUpdateList ()
 
std::string GetDebugInfo () const override
 
ObjectVisibilityContainer & GetObjectVisibilityContainer ()
 
ObjectVisibilityContainer const & GetObjectVisibilityContainer () const
 
SpellCastResult CastSpell (CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={})
 
SpellCastResult CastSpell (CastSpellTargetArg const &targets, SpellInfo const *info, CastSpellExtraArgs const &args={})
 
Unit * GetOwnerUnit () const
 
Unit * GetCharmerOrOwnerUnit () const
 
Unit * GetCharmerOrOwnerOrSelfUnit () const
 
Player * GetCharmerOrOwnerPlayerOrPlayerItself () const
 
Player * GetAffectingPlayer () const
 
FactionTemplateEntry const * GetFactionTemplateEntry () const
 
ReputationRank GetReactionTo (WorldObject const *target) const
 
bool IsHostileTo (WorldObject const *target) const
 
bool IsFriendlyTo (WorldObject const *target) const
 
float GetSpellMaxRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
float GetSpellMinRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
bool IsValidAttackTarget (WorldObject const *target, SpellInfo const *bySpell=nullptr) const
 
bool IsValidAssistTarget (WorldObject const *target, SpellInfo const *bySpell=nullptr) const
 
Unit * GetMagicHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo)
 
Unit * GetMeleeHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo)
 
int32 CalculateSpellDamage (Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
 
int32 CalcSpellDuration (SpellInfo const *spellProto) const
 
int32 ModSpellDuration (SpellInfo const *spellProto, Unit const *target, int32 duration, bool positive, uint32 effectMask) const
 
void ModSpellCastTime (SpellInfo const *spellProto, int32 &castTime, Spell *spell=nullptr) const
 
SpellMissInfo MagicSpellHitResult (Unit *victim, SpellInfo const *spellInfo)
 
SpellMissInfo SpellHitResult (Unit *victim, SpellInfo const *spellInfo, bool canReflect=false)
 
SpellMissInfo SpellHitResult (Unit *victim, Spell const *spell, bool canReflect=false)
 
void SendSpellMiss (Unit *target, uint32 spellID, SpellMissInfo missInfo)
 
void SendSpellNonMeleeDamageLog (Unit *target, SpellInfo const *spellInfo, uint32 damage, SpellSchoolMask schoolMask, uint32 absorb, uint32 resist)
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
ObjectGuid GetGUID () const
 
PackedGuid const & GetPackGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
bool HasDynamicFlag (uint32 flag) const
 
virtual void SetDynamicFlag (uint32 flag)
 
virtual void RemoveDynamicFlag (uint32 flag)
 
TypeID GetTypeId () const
 
bool isType (uint16 mask) const
 
virtual void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target)
 
void SendUpdateToPlayer (Player *player)
 
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player *target)
 
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 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
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &)
 
void SetFieldNotifyFlag (uint16 flag)
 
void RemoveFieldNotifyFlag (uint16 flag)
 
void ForceValuesUpdateAtIndex (uint32)
 
bool IsPlayer () const
 
Player * ToPlayer ()
 
Player const * ToPlayer () const
 
bool IsCreature () const
 
Creature * ToCreature ()
 
Creature const * ToCreature () const
 
bool IsUnit () const
 
Unit * ToUnit ()
 
Unit const * ToUnit () const
 
bool IsGameObject () const
 
GameObject * ToGameObject ()
 
GameObject const * ToGameObject () const
 
bool IsCorpse () const
 
Corpse * ToCorpse ()
 
Corpse const * ToCorpse () const
 
bool IsDynamicObject () const
 
DynamicObject * ToDynObject ()
 
DynamicObject const * ToDynObject () const
 
bool IsItem () const
 
virtual void Heartbeat ()
 
template<typename... T>
bool EntryEquals (T... entries) const
 
- Public Member Functions inherited from WorldLocation
 WorldLocation (uint32 _mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
 WorldLocation (uint32 mapId, Position const &position)
 
void WorldRelocate (WorldLocation const &loc)
 
void WorldRelocate (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
 
Position & operator= (Position const &)=default
 
Position & operator= (Position &&)=default
 
bool operator== (Position const &a) const
 
bool operator!= (Position const &a)
 
bool operator!= (Position const &a) const
 
 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 (Position const &pos)
 
void Relocate (Position const *pos)
 
void RelocatePolarOffset (float angle, float dist, float z=0.0f)
 
void RelocateOffset (Position const &offset)
 
void SetOrientation (float orientation)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
float GetOrientation () const
 
void GetPosition (float &x, float &y) const
 
void GetPosition (float &x, float &y, float &z) const
 
void GetPosition (float &x, float &y, float &z, float &o) const
 
Position GetPosition () const
 
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 (Position const &endPos, Position &retOffset) const
 
Position GetPositionWithOffset (Position const &offset) const
 
float GetAngle (Position const *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 (Position const *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 (Position const *pos, float dist) const
 
bool IsInDist (float x, float y, float z, float dist) const
 
bool IsInDist (Position const *pos, float dist) const
 
bool IsWithinBox (Position const &center, float xradius, float yradius, float zradius) const
 
bool HasInArc (float arcangle, Position const *pos, float targetRadius=0.0f) const
 
bool HasInLine (Position const *pos, float width) const
 
bool HasInLine (Position const *pos, float objSize, 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 void ApplyResilience (Unit const *victim, float *crit, int32 *damage, bool isCrit, CombatRating type)
 
static float GetEffectiveResistChance (Unit const *owner, SpellSchoolMask schoolMask, Unit const *victim, SpellInfo const *spellInfo=nullptr, uint8 casterLevel=0)
 
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, bool skipCombat=false)
 
static void DealDamageMods (Unit const *victim, uint32 &damage, uint32 *absorb)
 
static void Kill (Unit *killer, Unit *victim, bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
 
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 uint32 SpellCriticalDamageBonus (Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
 
static void ProcSkillsAndAuras (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 int32 DealHeal (Unit *healer, Unit *victim, uint32 addhealth)
 
static uint32 SpellCriticalHealingBonus (Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
 
static void CalcAbsorbResist (DamageInfo &dmgInfo, bool Splited=false, uint8 casterLevel=0)
 
static void CalcHealAbsorb (HealInfo &healInfo)
 
static bool IsImmuneMaskFully (SpellSchoolMask immuneMask, SpellSchoolMask schoolMask)
 
static ReputationRank GetFactionReactionTo (FactionTemplateEntry const *factionTemplateEntry, FactionTemplateEntry const *targetFactionTemplateEntry)
 
static void HandleSafeUnitPointersOnDelete (Unit *thisUnit)
 
- Static Public Member Functions inherited from WorldObject
static float GetLeewayBonusRangeForTargets (Player const *player, Unit const *target)
 
static ReputationRank GetFactionReactionTo (FactionTemplateEntry const *factionTemplateEntry, WorldObject const *target)
 
- 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
 
uint32 m_moveCircleMovementTime = MOVE_CIRCLE_CHECK_INTERVAL
 
uint32 m_moveBackwardsMovementTime = MOVE_BACKWARDS_CHECK_INTERVAL
 
uint32 m_extendLeashTime = EXTEND_LEASH_CHECK_INTERVAL
 
- Public Attributes inherited from Unit
uint32 m_extraAttacks
 
DualWieldMode _dualWieldMode
 
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_modAttackSpeedPct [3]
 
SpellImmuneContainer m_spellImmune [MAX_SPELL_IMMUNITY]
 
uint32 m_lastSanctuaryTime
 
PetAuraSet m_petAuras
 
ObjectGuid LastCharmerGUID
 
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::MoveSpline * movespline
 
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealth
 
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealthDetect
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibility
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibilityDetect
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
 
uint32 LastUsedScriptID
 
MovementInfo m_movementInfo
 
ALEEventProcessor * ALEEvents
 
EventProcessor m_Events
 
- 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
 
static constexpr uint32 EXTEND_LEASH_CHECK_INTERVAL = 3000
 

Protected Member Functions

bool CreateFromProto (ObjectGuid::LowType guidlow, uint32 Entry, uint32 vehId, CreatureData const *data=nullptr)
 
bool InitEntry (uint32 entry, CreatureData const *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 ()
 
void BuildValuesUpdate (uint8 updateType, ByteBuffer *data, Player *target) override
 
void _UpdateSpells (uint32 time)
 
void _DeleteRemovedAuras ()
 
void _UpdateAutoRepeatSpell ()
 
bool CanSparringWith (Unit const *attacker) const
 
bool IsAlwaysVisibleFor (WorldObject const *seer) const override
 : Check if unit is eligible for sparring damages. Work only if attacker and victim are creatures.
 
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 stun=false, bool logout=false)
 
void SendMoveRoot (bool state)
 
- Protected Member Functions inherited from WorldObject
 WorldObject ()
 
void SetLocationMapId (uint32 _mapId)
 
void SetLocationInstanceId (uint32 _instanceId)
 
virtual bool IsNeverVisible () const
 
- Protected Member Functions inherited from Object
 Object ()
 
void _InitValues ()
 
void _Create (ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
 
void _Create (ObjectGuid guid)
 
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
 
void AddToObjectUpdateIfNeeded ()
 
- Protected Member Functions inherited from MovableMapObject
 MovableMapObject ()=default
 
Cell const & GetCurrentCell () const
 
- Protected Member Functions inherited from UpdatableMapObject
 UpdatableMapObject ()
 

Static Protected Member Functions

static float _GetHealthMod (int32 Rank)
 

Protected Attributes

VendorItemCounts m_vendorItemCounts
 
ObjectGuid m_lootRecipient
 
ObjectGuid::LowType m_lootRecipientGroup
 
bool _respawnCompatibilityMode {true}
 
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_alreadyCallForHelp
 
bool m_AlreadyCallAssistance
 
bool m_AlreadySearchedAssistance
 
bool m_regenHealth
 
bool m_regenPower
 
bool m_AI_locked
 
SpellSchoolMask m_meleeDamageSchoolMask
 
uint32 m_originalEntry
 
int32 _creatureImmunitiesId
 
uint32 _gossipMenuId
 
bool m_moveInLineOfSightDisabled
 
bool m_moveInLineOfSightStrictlyDisabled
 
Position m_homePosition
 
Position m_transportHomePosition
 
Position LastMovementFlagsPos
 
bool DisableReputationReward
 
bool DisableLootReward
 
CreatureTemplate const * m_creatureInfo
 
CreatureData const * m_creatureData
 
uint32 CachedScriptId = 0
 
uint32 CachedScriptIdEntry = 0
 
float m_detectionDistance
 
uint16 m_LootMode
 
float _sparringPct
 
- Protected Attributes inherited from Unit
UnitAI * i_AI
 
UnitAI * i_disabledAI
 
uint8 m_realRace
 
uint8 m_race
 
bool m_AutoRepeatFirstCast
 
int32 m_attackTimer [MAX_ATTACK]
 
float m_createStats [MAX_STATS]
 
AttackerSet m_attackers
 
Unit * m_attacking
 
DeathState m_deathState
 
Milliseconds m_lastDeathTime {Milliseconds::min()}
 
bool m_inPreDeathAuraTick {false}
 
int32 m_procDeep
 
DynObjectList m_dynObj
 
GameObjectList m_gameObj
 
uint32 m_transform
 
Spell * m_currentSpells [CURRENT_MAX_SPELL]
 
AuraMap m_ownedAuras
 
AuraApplicationMap m_appliedAuras
 
AuraList m_removedAuras
 
std::vector< Aura * > m_auraUpdateSnapshot
 
uint32 m_removedAurasCount
 
AuraEffectList m_modAuras [TOTAL_AURAS]
 
AuraList m_scAuras
 
AuraApplicationList m_interruptableAuras
 
AuraStateAurasMap m_auraStateAuras
 
uint32 m_interruptMask
 
float m_auraFlatModifiersGroup [UNIT_MOD_END][MODIFIER_TYPE_FLAT_END]
 
float m_auraPctModifiersGroup [UNIT_MOD_END][MODIFIER_TYPE_PCT_END]
 
float m_weaponDamage [MAX_ATTACK][MAX_WEAPON_DAMAGE_RANGE][MAX_ITEM_PROTO_DAMAGES]
 
bool m_canModifyStats
 
VisibleAuraMap m_visibleAuras
 
float m_speed_rate [MAX_MOVE_TYPE]
 
float _charmStartSpeedRate [MAX_MOVE_TYPE] {}
 
CharmInfo * m_charmInfo
 
SharedVisionList m_sharedVision
 
MotionMaster * i_motionMaster
 
uint32 m_reactiveTimer [MAX_REACTIVE]
 
int32 m_regenTimer
 
ThreatManager m_threatManager
 
CombatManager m_combatManager
 
CharmThreatMap _charmThreatInfo
 
Vehicle * m_vehicle
 
Vehicle * m_vehicleKit
 
uint32 m_unitTypeMask
 
LiquidTypeEntry const * _lastLiquid
 
bool m_applyResilience
 
bool _instantCast
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
VisibilityDistanceType _visibilityDistanceOverrideType
 
ZoneScript * m_zoneScript
 
uint32 _zoneId
 
uint32 _areaId
 
float _floorZ
 
bool _outdoors
 
LiquidData _liquidData
 
bool _updatePositionData
 
Transport * m_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 (Milliseconds timeMSToDespawn=0ms, Seconds forcedRespawnTimer=0s)
 
bool CanPeriodicallyCallForAssistance () const
 

Private Attributes

uint32 m_waypointID
 
uint32 m_path_id
 
std::pair< uint32, uint32 > _currentWaypointNodeInfo {0, 0}
 
CreatureGroup * m_formation
 
bool TriggerJustRespawned
 
std::shared_ptr< time_t > m_lastLeashExtensionTime
 
ObjectGuid m_cannotReachTarget
 
Spell const * _focusSpell
 
ObjectGuid _spellFocusTarget
 

‍Locks the target during spell cast for proper facing


 
CreatureTextRepeatGroup m_textRepeat
 

‍Saved target during spell focus for restoration


 
std::unordered_map< uint8, uint32 > m_textCooldowns
 
bool _isMissingSwimmingFlagOutOfCombat
 
uint32 m_assistanceTimer
 
uint32 _playerDamageReq
 
bool _damagedByPlayer
 
uint8 _highestPlayerAttackerLevel
 
bool _isCombatMovementAllowed
 
float _nativeObjectScale = 1.0f
 DisplayScale of the native model, set in InitEntry.
 

Additional Inherited Members

- Public Types inherited from Unit
typedef std::unordered_set< Unit * > AttackerSet
 
typedef std::set< Unit * > ControlSet
 
typedef boost::container::flat_multimap< uint32, Aura * > AuraMap
 
typedef std::pair< AuraMap::const_iterator, AuraMap::const_iterator > AuraMapBounds
 
typedef std::pair< AuraMap::iterator, AuraMap::iterator > AuraMapBoundsNonConst
 
typedef boost::container::flat_multimap< uint32, AuraApplication * > AuraApplicationMap
 
typedef std::pair< AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator > AuraApplicationMapBounds
 
typedef std::pair< AuraApplicationMap::iterator, AuraApplicationMap::iterator > AuraApplicationMapBoundsNonConst
 
typedef boost::container::flat_multimap< AuraStateType, AuraApplication * > AuraStateAurasMap
 
typedef std::pair< AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator > AuraStateAurasMapBounds
 
typedef std::vector< AuraEffect * > AuraEffectList
 
typedef std::list< Aura * > AuraList
 
typedef std::list< AuraApplication * > AuraApplicationList
 
typedef std::vector< std::pair< uint8, AuraApplication * > > AuraApplicationProcContainer
 
typedef std::list< DiminishingReturn > Diminishing
 
typedef GuidUnorderedSet ComboPointHolderSet
 
typedef std::map< uint8, AuraApplication * > VisibleAuraMap
 
typedef std::unordered_multimap< uint32, uint32 > SpellImmuneContainer
 
typedef std::set< PetAura const * > PetAuraSet
 
- Public Types inherited from UpdatableMapObject
enum  UpdateState : uint8 {
  NotUpdating ,
  PendingAdd ,
  Updating
}
 
- 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 ( )
explicit
273{
276
277 for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
278 m_spells[i] = 0;
279
280 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
282
284
286 DisableLootReward = false;
287
289 m_CombatDistance = 0.0f;
290
291 ResetLootMode(); // restore default loot mode
293 _focusSpell = nullptr;
294
295 m_respawnedTime = time_t(0);
296}
#define CREATURE_REGEN_INTERVAL
Definition CreatureData.h:32
std::uint8_t uint8
Definition Define.h:109
@ IDLE_MOTION_TYPE
Definition MotionMaster.h:39
@ SPELL_SCHOOL_NORMAL
Definition SharedDefines.h:271
constexpr auto MAX_SPELL_SCHOOL
Definition SharedDefines.h:280
@ SPELL_SCHOOL_MASK_NORMAL
Definition SharedDefines.h:285
@ REACT_AGGRESSIVE
Definition Unit.h:576
static constexpr uint32 MAX_CREATURE_SPELLS
Definition Unit.h:47
@ UNIT_END
Definition UpdateFields.h:175
@ CONFIG_SIGHT_MONSTER
Definition WorldConfig.h:156
bool m_regenPower
Definition Creature.h:501
float m_wanderDistance
Definition Creature.h:482
void ResetLootMode()
Definition Creature.h:250
std::shared_ptr< time_t > m_lastLeashExtensionTime
Definition Creature.h:549
SpellSchoolMask m_meleeDamageSchoolMask
Definition Creature.h:504
uint16 m_transportCheckTimer
Definition Creature.h:484
bool m_AI_locked
Definition Creature.h:502
uint32 m_assistanceTimer
Definition Creature.h:561
int8 m_originalEquipmentId
Definition Creature.h:495
ObjectGuid::LowType m_spawnId
For new or temporary creatures is 0 for saved it is lowguid.
Definition Creature.h:493
Position m_transportHomePosition
Definition Creature.h:513
ObjectGuid::LowType m_lootRecipientGroup
Definition Creature.h:472
uint32 m_spells[MAX_CREATURE_SPELLS]
Definition Creature.h:255
CreatureTemplate const * m_creatureInfo
Definition Creature.h:519
bool _isMissingSwimmingFlagOutOfCombat
Definition Creature.h:559
uint32 m_waypointID
Definition Creature.h:539
MovementGeneratorType m_defaultMovementType
Definition Creature.h:492
float m_detectionDistance
Definition Creature.h:524
CreatureSpellCooldowns m_CreatureSpellCooldowns
Definition Creature.h:256
uint8 _highestPlayerAttackerLevel
Definition Creature.h:565
float m_SightDistance
Definition Creature.h:393
float _sparringPct
Definition Creature.h:527
uint32 m_respawnDelay
Definition Creature.h:480
bool m_alreadyCallForHelp
Definition Creature.h:497
time_t m_corpseRemoveTime
Timers.
Definition Creature.h:477
uint32 m_combatPulseDelay
Definition Creature.h:487
time_t m_respawnTime
Definition Creature.h:478
uint32 _gossipMenuId
Definition Creature.h:507
CreatureData const * m_creatureData
Definition Creature.h:520
float m_CombatDistance
Definition Creature.h:393
time_t m_respawnedTime
Definition Creature.h:479
uint32 m_boundaryCheckTime
Definition Creature.h:483
Position m_homePosition
Definition Creature.h:512
bool TriggerJustRespawned
Definition Creature.h:545
bool m_AlreadyCallAssistance
Definition Creature.h:498
CreatureGroup * m_formation
Definition Creature.h:544
uint32 m_corpseDelay
Definition Creature.h:481
uint8 m_equipmentId
Definition Creature.h:494
bool m_AlreadySearchedAssistance
Definition Creature.h:499
uint32 m_originalEntry
Definition Creature.h:505
ReactStates m_reactState
Definition Creature.h:489
bool DisableReputationReward
Definition Creature.h:516
Spell const * _focusSpell
Definition Creature.h:553
uint32 lootPickPocketRestoreTime
Definition Creature.h:485
bool m_moveInLineOfSightStrictlyDisabled
Definition Creature.h:510
uint32 lootingGroupLowGUID
Definition Creature.h:313
bool _isCombatMovementAllowed
Definition Creature.h:566
bool DisableLootReward
Definition Creature.h:517
bool m_regenHealth
Definition Creature.h:500
uint32 _playerDamageReq
Definition Creature.h:563
bool _damagedByPlayer
Definition Creature.h:564
uint32 m_path_id
Definition Creature.h:540
bool m_moveInLineOfSightDisabled
Definition Creature.h:509
uint32 m_groupLootTimer
Definition Creature.h:312
uint32 m_combatPulseTime
Definition Creature.h:486
uint32 m_ProhibitSchoolTime[7]
Definition Creature.h:257
MovableMapObject()=default
uint16 m_valuesCount
Definition Object.h:273
int32 m_regenTimer
Definition Unit.h:2218
Unit()
Definition Unit.cpp:334
#define sWorld
Definition World.h:337

References _focusSpell, CONFIG_SIGHT_MONSTER, CREATURE_REGEN_INTERVAL, DisableLootReward, DisableReputationReward, m_CombatDistance, m_CreatureSpellCooldowns, 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
299{
300 m_vendorItemCounts.clear();
301
302 delete i_AI;
303 i_AI = nullptr;
304}
VendorItemCounts m_vendorItemCounts
Definition Creature.h:467
UnitAI * i_AI
Definition Unit.h:2159

References Unit::i_AI, and m_vendorItemCounts.

Member Function Documentation

◆ _AddCreatureSpellCooldown()

void Creature::_AddCreatureSpellCooldown ( uint32  spell_id,
uint16  categoryId,
uint32  end_time 
)
3006{
3007 CreatureSpellCooldown spellCooldown;
3008 spellCooldown.category = categoryId;
3009 spellCooldown.end = GameTime::GetGameTimeMS().count() + end_time;
3010 m_CreatureSpellCooldowns[spell_id] = std::move(spellCooldown);
3011}
Milliseconds GetGameTimeMS()
Definition GameTime.cpp:44
Definition CreatureData.h:498
uint16 category
Definition CreatureData.h:502
uint32 end
Definition CreatureData.h:503

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

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

◆ _GetDamageMod()

float Creature::_GetDamageMod ( int32  Rank)
static
1594{
1595 switch (Rank) // define rates for each elite rank
1596 {
1598 return sWorld->getRate(RATE_CREATURE_NORMAL_DAMAGE);
1606 return sWorld->getRate(RATE_CREATURE_ELITE_RARE_DAMAGE);
1607 default:
1609 }
1610}
@ CREATURE_ELITE_NORMAL
Definition SharedDefines.h:2964
@ CREATURE_ELITE_WORLDBOSS
Definition SharedDefines.h:2967
@ CREATURE_ELITE_RARE
Definition SharedDefines.h:2968
@ CREATURE_ELITE_RAREELITE
Definition SharedDefines.h:2966
@ CREATURE_ELITE_ELITE
Definition SharedDefines.h:2965
@ RATE_CREATURE_NORMAL_DAMAGE
Definition WorldConfig.h:468
@ RATE_CREATURE_ELITE_RARE_DAMAGE
Definition WorldConfig.h:472
@ RATE_CREATURE_ELITE_WORLDBOSS_DAMAGE
Definition WorldConfig.h:471
@ RATE_CREATURE_ELITE_RAREELITE_DAMAGE
Definition WorldConfig.h:470
@ RATE_CREATURE_ELITE_ELITE_DAMAGE
Definition WorldConfig.h:469

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
1575{
1576 switch (Rank) // define rates for each elite rank
1577 {
1579 return sWorld->getRate(RATE_CREATURE_NORMAL_HP);
1581 return sWorld->getRate(RATE_CREATURE_ELITE_ELITE_HP);
1587 return sWorld->getRate(RATE_CREATURE_ELITE_RARE_HP);
1588 default:
1589 return sWorld->getRate(RATE_CREATURE_ELITE_ELITE_HP);
1590 }
1591}
@ RATE_CREATURE_NORMAL_HP
Definition WorldConfig.h:463
@ RATE_CREATURE_ELITE_WORLDBOSS_HP
Definition WorldConfig.h:466
@ RATE_CREATURE_ELITE_ELITE_HP
Definition WorldConfig.h:464
@ RATE_CREATURE_ELITE_RARE_HP
Definition WorldConfig.h:467
@ RATE_CREATURE_ELITE_RAREELITE_HP
Definition WorldConfig.h:465

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
2625{
2626 ASSERT(target);
2627
2628 // if the target cannot be attacked, the target is not acceptable
2629 if (IsFriendlyTo(target) || !target->isTargetableForAttack(false, this) || (m_vehicle && (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target))))
2630 return false;
2631
2632 if (target->HasUnitState(UNIT_STATE_DIED))
2633 {
2634 // some creatures can detect fake death
2635 if (CanIgnoreFeignDeath() && target->HasUnitFlag2(UNIT_FLAG2_FEIGN_DEATH))
2636 return true;
2637 else
2638 return false;
2639 }
2640
2641 Unit const* targetVictim = target->getAttackerForHelper();
2642
2643 // if I'm already fighting target, or I'm hostile towards the target, the target is acceptable
2644 if (IsEngagedBy(target) || IsHostileTo(target))
2645 return true;
2646
2647 // if the target's victim is friendly, and the target is neutral, the target is acceptable
2648 if (targetVictim && !IsNeutralToAll() && IsFriendlyTo(targetVictim))
2649 return true;
2650
2651 // if the target's victim is not friendly, or the target is friendly, the target is not acceptable
2652 return false;
2653}
#define ASSERT
Definition Errors.h:68
@ UNIT_FLAG2_FEIGN_DEATH
Definition UnitDefines.h:296
@ UNIT_STATE_DIED
Definition UnitDefines.h:173
bool CanIgnoreFeignDeath() const
Definition Creature.h:278
Definition Unit.h:670
Vehicle * m_vehicle
Definition Unit.h:2225
Unit * getAttackerForHelper() const
Definition Unit.cpp:878
bool IsNeutralToAll() const
Definition Unit.cpp:7097
bool IsOnVehicle(Unit const *vehicle) const
Definition Unit.h:1949
bool IsEngagedBy(Unit const *who) const
Definition Unit.h:946
bool IsFriendlyTo(Unit const *unit) const
Definition Unit.cpp:7079
bool IsHostileTo(Unit const *unit) const
Definition Unit.cpp:7074
Unit * GetBase() const
May be called from scripts.
Definition Vehicle.h:37

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(), IsTargetableAtRange(), SelectVictim(), ThreatReference::ShouldBeOffline(), 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.

3014{
3015 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id);
3016 if (!spellInfo)
3017 return;
3018
3019 // used in proc system, otherwise normal creature cooldown
3020 if (end_time)
3021 {
3022 _AddCreatureSpellCooldown(spellInfo->Id, 0, end_time);
3023 return;
3024 }
3025
3026 uint32 spellcooldown = spellInfo->RecoveryTime;
3027 uint32 categoryId = spellInfo->GetCategory();
3028 uint32 categorycooldown = categoryId ? spellInfo->CategoryRecoveryTime : 0;
3029 if (Player* modOwner = GetSpellModOwner())
3030 {
3031 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, spellcooldown);
3032 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, categorycooldown);
3033 }
3034
3035 SpellCategoryStore::const_iterator i_scstore = sSpellsByCategoryStore.find(categoryId);
3036 bool const hasCategoryCooldown = categorycooldown && i_scstore != sSpellsByCategoryStore.end();
3037 if (hasCategoryCooldown)
3038 {
3039 for (auto const& [itemBased, categorySpellId] : i_scstore->second)
3040 {
3041 // A longer cooldown still running on a category spell is never shortened
3042 if (GetSpellCooldown(categorySpellId) > categorycooldown)
3043 continue;
3044
3045 _AddCreatureSpellCooldown(categorySpellId, categoryId, categorycooldown);
3046 }
3047 }
3048
3049 // The cast spell keeps its own recovery time when it outlasts the category cooldown
3050 if (spellcooldown > categorycooldown)
3051 _AddCreatureSpellCooldown(spellInfo->Id, 0, spellcooldown);
3052
3053 // The controlling player only learns creature cooldowns from us, category spells included
3055 if (!player)
3056 return;
3057
3058 PacketCooldowns cooldowns;
3059 if (hasCategoryCooldown)
3060 {
3061 for (auto const& [itemBased, categorySpellId] : i_scstore->second)
3062 {
3063 if (HasSpell(categorySpellId))
3064 cooldowns[categorySpellId] = GetSpellCooldown(categorySpellId);
3065 }
3066 }
3067
3068 if (uint32 remaining = GetSpellCooldown(spellInfo->Id))
3069 cooldowns[spellInfo->Id] = remaining;
3070
3071 if (cooldowns.empty())
3072 return;
3073
3074 WorldPacket data;
3076 player->SendDirectMessage(&data);
3077}
SpellCategoryStore sSpellsByCategoryStore
Definition DBCStores.cpp:156
std::uint32_t uint32
Definition Define.h:107
@ SPELLMOD_COOLDOWN
Definition SpellDefines.h:95
#define sSpellMgr
Definition SpellMgr.h:851
@ SPELL_COOLDOWN_FLAG_NONE
Definition Unit.h:638
std::unordered_map< uint32, uint32 > PacketCooldowns
Definition Unit.h:643
uint32 GetSpellCooldown(uint32 spell_id) const
Definition Creature.cpp:3079
bool HasSpell(uint32 spellID) const override
Definition Creature.cpp:3110
void _AddCreatureSpellCooldown(uint32 spell_id, uint16 categoryId, uint32 end_time)
Definition Creature.cpp:3005
Definition Player.h:1086
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:5886
Definition SpellInfo.h:340
uint32 GetCategory() const
Definition SpellInfo.cpp:884
uint32 RecoveryTime
Definition SpellInfo.h:372
uint32 Id
Definition SpellInfo.h:344
uint32 CategoryRecoveryTime
Definition SpellInfo.h:373
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition Unit.cpp:7533
void BuildCooldownPacket(WorldPacket &data, uint8 flags, uint32 spellId, uint32 cooldown)
Definition Unit.cpp:16747
Player * GetSpellModOwner() const override
Definition Unit.cpp:12637
Definition WorldPacket.h:26

References _AddCreatureSpellCooldown(), Unit::BuildCooldownPacket(), SpellInfo::CategoryRecoveryTime, SpellInfo::GetCategory(), Unit::GetCharmerOrOwnerPlayerOrPlayerItself(), GetSpellCooldown(), Unit::GetSpellModOwner(), HasSpell(), SpellInfo::Id, SpellInfo::RecoveryTime, Player::SendDirectMessage(), SPELL_COOLDOWN_FLAG_NONE, SPELLMOD_COOLDOWN, sSpellMgr, and sSpellsByCategoryStore.

Referenced by Aura::_ApplyForTarget(), Aura::_UnapplyForTarget(), Pet::CastPendingSpell(), spell_chapter5_return_to_capital::HandleHit(), WorldSession::HandlePetActionHelper(), boss_faction_championsAI::IsCCed(), boss_zuljin::JustEngagedWith(), and PetAI::UpdateAI().

◆ AddToWorld()

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

Reimplemented from Object.

Reimplemented in Pet, and TestCreature.

307{
309 if (!IsInWorld())
310 {
311 // pussywizard: motion master needs to be initialized before OnCreatureCreate, which may set death state to JUST_DIED, to prevent crash
312 // it's also initialized in AIM_Initialize(), few lines below, but it's not a problem
314
316 if (m_spawnId)
317 {
318 GetMap()->GetCreatureBySpawnIdStore().insert(std::make_pair(m_spawnId, this));
319 }
321
323
325
326 if (IsVehicle())
327 {
329 }
330
331 if (GetZoneScript())
332 {
334 }
335
337
338 sScriptMgr->OnCreatureAddWorld(this);
339 }
340}
#define sScriptMgr
Definition ScriptMgr.h:769
Definition Creature.h:47
Loot loot
Definition Creature.h:231
bool AIM_Initialize(CreatureAI *ai=nullptr)
Definition Creature.cpp:1118
void Motion_Initialize()
Definition Creature.cpp:1139
void SearchFormation()
Definition Creature.cpp:376
MapStoredObjectTypesContainer & GetObjectsStore()
Definition Map.h:358
CreatureBySpawnIdContainer & GetCreatureBySpawnIdStore()
Definition Map.h:361
bool IsInWorld() const
Definition Object.h:115
ObjectGuid GetGUID() const
Definition Object.h:121
bool Insert(KEY_TYPE const &handle, SPECIFIC_TYPE *obj)
Definition TypeContainer.h:177
bool IsVehicle() const
Definition Unit.h:806
void AddToWorld() override
Definition Unit.cpp:12216
Vehicle * GetVehicleKit() const
Definition Unit.h:1947
void Install()
Definition Vehicle.cpp:79
Map * GetMap() const
Definition Object.h:637
ZoneScript * GetZoneScript() const
Definition Object.h:643
virtual void OnCreatureCreate(Creature *)
Definition ZoneScript.h:34
ObjectGuid sourceWorldObjectGUID
Definition LootMgr.h:330

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.

◆ AI()

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

References Unit::i_AI.

Referenced by at_hol_hall_of_watchers::_OnTrigger(), Unit::_UnapplyAura(), boss_yoggsaron_sara::ActivateKeepers(), boss_flame_leviathan_seat::ActivateTurret(), Vehicle::AddPassenger(), Player::AddQuestAndCheckCompletion(), AtEngage(), npc_anubisath_sentinel::aqsentinelAI::CallBuddiesToAttack(), boss_algalon_the_observer::CallConstellations(), instance_ruins_of_ahnqiraj::instance_ruins_of_ahnqiraj_InstanceMapScript::CallNextRajaxxLeader(), CanAlwaysSee(), CanCreatureAttack(), Pet::CastPendingSpell(), BattlegroundAV::ChangeMineOwner(), instance_obsidian_sanctum::instance_obsidian_sanctum_InstanceMapScript::CheckAchievementCriteriaMeet(), npc_still_at_it_trigger::npc_still_at_it_triggerAI::CheckAction(), spell_putricide_mutation_init::CheckRequirementInternal(), spell_the_lich_king_ice_burst_target_search::CheckTargetCount(), npc_riggle_bassbait::npc_riggle_bassbaitAI::CheckTournamentState(), npc_simone::npc_simoneAI::CorpseRemoved(), CreatureUnitRelocationWorker(), Unit::DealDamage(), DespawnOnEvade(), npc_mistress_nagmara::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), instance_karazhan::instance_karazhan_InstanceMapScript::DoAction(), SummonList::DoAction(), Spell::DoAllEffectOnTarget(), HomeMovementGenerator< Creature >::DoFinalize(), boss_hodir::DoHelperVictoryEmotes(), WaypointMovementGenerator< Creature >::DoInitialize(), instance_stratholme::instance_stratholme_InstanceMapScript::DoSpawnPlaguedCritters(), WaypointMovementGenerator< Creature >::DoUpdate(), SummonList::DoZoneInCombat(), UnitAI::EvadeTimerExpired(), RestoreAttack::Execute(), DelayedTalk::Execute(), UtherBatteredHiltEvent::Execute(), StartMovementEvent::Execute(), ValithriaDespawner::Execute(), CaptainSurviveTalk::Execute(), ChargeRifts::Execute(), spell_kiljaeden_sinister_reflection_clone::FilterTargets(), spell_sapphiron_frost_explosion::FilterTargets(), spell_eoe_ph3_surge_of_power::FilterTargets(), spell_malygos_surge_of_power_25::FilterTargets(), RotateMovementGenerator::Finalize(), EffectMovementGenerator::Finalize(), boss_janalai::FireWall(), npc_anubisath_sentinel::aqsentinelAI::GetOtherSentinels(), SmartScript::GetTargets(), go_ossirian_crystal::go_ossirian_crystalAI::GossipHello(), spell_herald_volzaj_insanity::HandleAfterCast(), spell_illidari_council_empyreal_balance::HandleAfterCast(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), debug_commandscript::HandleDebugBoundaryCommand(), spell_item_lil_xt::HandleDummy(), spell_shadowblink::HandleDummy(), spell_halion_twilight_division::HandleDummy(), spell_dred_raptor_call::HandleDummy(), spell_q12096_q12092_dummy::HandleDummy(), spell_q12589_shoot_rjr::HandleDummy(), spell_q12211_container_of_rats::HandleDummy(), spell_algalon_trigger_3_adds::HandleDummyEffect(), spell_herald_volzaj_insanity::HandleDummyEffect(), spell_hydross_cleansing_field_aura::HandleEffectApply(), spell_ulduar_random_aggro_periodic::HandleEffectPeriodic(), spell_hodir_flash_freeze_aura::HandleEffectPeriodic(), spell_mc_play_dead_aura::HandleEffectRemove(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), spell_hydross_cleansing_field_aura::HandleEffectRemove(), spell_cauldron_event_timer_aura::HandleExpire(), WorldSession::HandleGossipHelloOpcode(), WorldSession::HandleGossipSelectOptionOpcode(), spell_razorscale_flame_breath::HandleHit(), spell_chapter2_persuasive_strike::HandleHit(), spell_chapter5_return_to_capital::HandleHit(), npc_commandscript::HandleNpcDoActionCommand(), npc_commandscript::HandleNpcSetDataCommand(), WorldSession::HandlePetActionHelper(), WorldSession::HandleQuestgiverChooseRewardOpcode(), WorldSession::HandleQuestgiverHelloOpcode(), spell_kiljaeden_darkness_aura::HandleRemove(), spell_gormok_jump_to_hand::HandleRemove(), spell_taldaram_summon_flame_ball::HandleScript(), spell_putricide_unstable_experiment::HandleScript(), spell_the_lich_king_vile_spirit_move_target_search::HandleScript(), spell_ayamiss_swarmer_swarm::HandleScript(), spell_festergut_pungent_blight::HandleScript(), spell_rotface_large_ooze_combine::HandleScript(), spell_rotface_large_ooze_buff_combine::HandleScript(), spell_freya_attuned_to_nature_dose_reduction::HandleScript(), spell_q13011_bear_flank_master::HandleScript(), spell_kologarn_focused_eyebeam::HandleScriptEffect(), spell_volazj_whisper::HandleScriptEffect(), Unit::HandleSpellClick(), spell_putricide_mutated_transformation::HandleSummon(), boss_yoggsaron_sara::InformCloud(), TempSummon::InitSummon(), Unit::InterruptSpell(), IsAlwaysDetectableFor(), IsEngaged(), SmartScript::IsSmart(), npc_mr_bigglesworth::JustDied(), npc_toc_warlock::npc_toc_warlockAI::JustSummoned(), npc_toc_hunter::npc_toc_hunterAI::JustSummoned(), npc_toc_boomkin::npc_toc_boomkinAI::JustSummoned(), boss_anubrekhan::JustSummoned(), boss_maexxna::boss_maexxnaAI::JustSummoned(), npc_frosthound::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::JustSummoned(), WorldBossAI::JustSummoned(), npc_grimstone::JustSummoned(), boss_gyth::JustSummoned(), boss_rend_blackhand::JustSummoned(), boss_curator::JustSummoned(), boss_attumen::JustSummoned(), boss_midnight::JustSummoned(), boss_nightbane::JustSummoned(), boss_sacrolash::JustSummoned(), npc_demonic_vapor_trail::JustSummoned(), npc_kiljaeden_controller::JustSummoned(), boss_anetheron::JustSummoned(), boss_onyxia::JustSummoned(), boss_taldaram::JustSummoned(), boss_black_knight::boss_black_knightAI::JustSummoned(), boss_devourer_of_souls::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_gothik::boss_gothikAI::JustSummoned(), boss_volkhan::JustSummoned(), boss_razorscale::JustSummoned(), boss_nexusprince_shaffar::JustSummoned(), boss_grandmaster_vorpil::JustSummoned(), npc_akama_illidan::JustSummoned(), npc_flame_of_azzinoth::JustSummoned(), npc_creature_generator_akama::JustSummoned(), boss_the_black_stalker::JustSummoned(), boss_nethermancer_sepethrea::JustSummoned(), emerald_dragonAI::JustSummoned(), npc_nelson::npc_nelsonAI::JustSummoned(), boss_balinda::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::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(), CreatureGroup::MemberEvaded(), npc_brew_bubble::MoveInLineOfSight(), npc_dkc1_gothik::MoveInLineOfSight(), npc_love_in_air_supply_sentry::MoveInLineOfSight(), npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight(), FormationMovementGenerator::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(), boss_razorgore::OnCharmed(), 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::OnCreatureCreate(), instance_hyjal::instance_mount_hyjal_InstanceMapScript::OnCreatureCreate(), instance_ulduar::instance_ulduar_InstanceMapScript::OnCreatureCreate(), go_palehoof_sphere::OnGossipHello(), go_main_chambers_access_panel::OnGossipHello(), npc_pet_gen_argent_pony_bridle::OnGossipHello(), npc_finklestein::OnGossipHello(), npc_captain_saeed::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(), npc_hyjal_jaina::OnGossipSelect(), npc_hyjal_thrall::OnGossipSelect(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), npc_barnes::OnGossipSelect(), npc_varian_wrynn::OnGossipSelect(), npc_thrall_bfu::OnGossipSelect(), npc_arthas::OnGossipSelect(), npc_high_overlord_saurfang_icc::OnGossipSelect(), npc_muradin_bronzebeard_icc::OnGossipSelect(), npc_ulduar_keeper::OnGossipSelect(), npc_vekjik::OnGossipSelect(), npc_adventurous_dwarf::OnGossipSelect(), npc_fos_leader::OnGossipSelect(), npc_hor_leader::OnGossipSelect(), npc_mcmanus::OnGossipSelect(), npc_finklestein::OnGossipSelect(), npc_captain_saeed::OnGossipSelect(), boss_azuregos::OnGossipSelect(), npc_hyjal_tyrande::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(), npc_chicken_cluck::OnQuestAccept(), npc_kernobee::OnQuestAccept(), npc_eris_hevenfire::OnQuestAccept(), npc_deathstalker_erland::OnQuestAccept(), npc_daphne_stilwell::OnQuestAccept(), npc_mikhail::OnQuestAccept(), npc_kerlonian::OnQuestAccept(), npc_prospector_remtravel::OnQuestAccept(), npc_cork_gizelton::OnQuestAccept(), npc_shenthul::OnQuestAccept(), npc_kaya_flathoof::OnQuestAccept(), npc_tooga::OnQuestAccept(), npc_gilthares::OnQuestAccept(), npc_wizzlecrank_shredder::OnQuestAccept(), npc_lakota_windsong::OnQuestAccept(), npc_paoka_swiftmountain::OnQuestAccept(), npc_ame::OnQuestAccept(), npc_ringo::OnQuestAccept(), npc_ranshalla::OnQuestAccept(), npc_lurgglbr::OnQuestAccept(), npc_mootoo_the_younger::OnQuestAccept(), npc_emily::OnQuestAccept(), npc_battle_at_valhalas::OnQuestAccept(), npc_engineer_helice::OnQuestAccept(), npc_finklestein::OnQuestAccept(), npc_maghar_captive::OnQuestAccept(), npc_kurenai_captive::OnQuestAccept(), npc_bessy::OnQuestAccept(), npc_maxx_a_million_escort::OnQuestAccept(), npc_isla_starmane::OnQuestAccept(), npc_doctor::OnQuestAccept(), go_crystal_prison::OnQuestAccept(), go_crystalline_tear::OnQuestAccept(), npc_chicken_cluck::OnQuestComplete(), boss_apothecary_hummel::OnQuestReward(), npc_lady_sylvanas_windrunner::OnQuestReward(), npc_tharnarian::OnQuestReward(), npc_thrall_warchief::OnQuestReward(), npc_elder_clearwater::OnQuestReward(), npc_riggle_bassbait::OnQuestReward(), spell_electrial_storm::OnRemove(), spell_q12937_relief_for_the_fallen::OnRemove(), at_blackrock_stadium::OnTrigger(), at_commander_dawnforge::OnTrigger(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnUnitDeath(), instance_magtheridons_lair::instance_magtheridons_lair_InstanceMapScript::OnUnitDeath(), OrderWhelpTargetSelector::operator()(), FrostwingGauntletRespawner::operator()(), ValithriaDespawner::operator()(), SplineHandler::operator()(), Unit::PetSpellFail(), instance_ulduar::instance_ulduar_InstanceMapScript::PlayBrannRhydianLine(), PretendToDie(), npc_jungle_punch_target::npc_jungle_punch_targetAI::proceedCwEvent(), SmartScript::ProcessAction(), instance_stratholme::instance_stratholme_InstanceMapScript::ProcessSlaughterEvent(), WaypointMovementGenerator< Creature >::ProcessWaypointArrival(), RemoveCorpse(), Vehicle::RemovePassenger(), npc_mistress_nagmara::ResetLovePotionEvent(), Respawn(), Resurrect(), boss_freya_summons::ReviveWithAllies(), boss_yoggsaron_lich_king::Say(), boss_yoggsaron_llane::Say(), boss_yoggsaron_neltharion::Say(), boss_fathomguard_tidalvess::ScheduleRemoval(), npc_snobold_vassal::npc_snobold_vassalAI::SelectFireBombTarget(), spell_the_lich_king_valkyr_target_search::SelectTarget(), SelectVictim(), spell_malygos_surge_of_power_warning_selector_25::SendThreeTargets(), instance_naxxramas::SetBossState(), Unit::SetCharmedBy(), boss_gormok::boss_gormokAI::SetGUID(), SetInCombatWithZone(), npc_mistress_nagmara::sGossipSelect(), npc_expedition_commander::sGossipSelect(), npc_thrall_bfu::npc_thrall_bfuAI::SpawnWave(), npc_xt_toy_pile::SpellHit(), npc_pilgrims_bounty_chair::SpellHitTarget(), npc_still_at_it_trigger::npc_still_at_it_triggerAI::Start(), spell_putricide_ooze_channel::StartAttack(), npc_mistress_nagmara::StartLoversRoute(), WaypointMovementGenerator< Creature >::StartMove(), boss_sindragosa::boss_sindragosaAI::SummonedCreatureDespawn(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::SummonedCreatureDespawn(), boss_razorscale::SummonedCreatureDespawn(), boss_zuramat::SummonedCreatureDespawn(), boss_anubrekhan::SummonedCreatureDies(), npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::SummonNextWave(), npc_love_in_air_snivel_real::Talk(), spell_igb_check_for_players::TriggerWipe(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), instance_ulduar::instance_ulduar_InstanceMapScript::Update(), Update(), npc_vaelastrasz_the_red::UpdateAI(), go_blood_drenched_door::go_blood_drenched_doorAI::UpdateAI(), npc_kalecgos_kj::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::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_cos_stratholme_citizien::npc_cos_stratholme_citizienAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), boss_mimiron::UpdateAI(), npc_expedition_engineer::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_simone::npc_simoneAI::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)
1119{
1120 // make sure nothing can change the AI during AI update
1121 if (m_AI_locked)
1122 {
1123 LOG_DEBUG("scripts.ai", "AIM_Initialize: failed to init, locked.");
1124 return false;
1125 }
1126
1127 UnitAI* oldAI = i_AI;
1128
1130
1131 i_AI = ai ? ai : FactorySelector::SelectAI(this);
1132 delete oldAI;
1133 IsAIEnabled = true;
1134 i_AI->InitializeAI();
1135
1136 return true;
1137}
#define LOG_DEBUG(filterType__,...)
Definition Log.h:157
Definition UnitAI.h:198
virtual void InitializeAI()
Definition UnitAI.h:209
bool IsAIEnabled
Definition Unit.h:2118
CreatureAI * SelectAI(Creature *creature)
Definition CreatureAISelector.cpp:78

References Unit::i_AI, UnitAI::InitializeAI(), Unit::IsAIEnabled, LOG_DEBUG, m_AI_locked, Motion_Initialize(), and FactorySelector::SelectAI().

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

◆ AllLootRemovedFromCorpse()

void Creature::AllLootRemovedFromCorpse ( )
3193{
3194 if (loot.loot_type != LOOT_SKINNING && !IsPet() && GetCreatureTemplate()->SkinLootId && hasLootRecipient())
3195 {
3197 {
3199 }
3200 }
3201
3202 time_t now = GameTime::GetGameTime().count();
3203 if (m_corpseRemoveTime <= now)
3204 {
3205 return;
3206 }
3207
3208 // the corpse keeps decayRate of the time it had left
3209 float decayRate = sWorld->getRate(RATE_CORPSE_DECAY_LOOTED);
3210 time_t timeLeft = m_corpseRemoveTime - now;
3211 time_t diff = time_t(timeLeft * (1.0f - decayRate));
3212
3213 m_respawnTime -= diff;
3214
3215 // corpse skinnable, but without skinning flag, and then skinned, corpse will despawn next update
3217 {
3219 }
3220 else
3221 {
3222 m_corpseRemoveTime -= diff;
3223 }
3224}
LootStore LootTemplates_Skinning("skinning_loot_template", "creature skinning id", true)
@ LOOT_SKINNING
Definition LootMgr.h:85
@ UNIT_FLAG_SKINNABLE
Definition UnitDefines.h:283
@ RATE_CORPSE_DECAY_LOOTED
Definition WorldConfig.h:493
bool hasLootRecipient() const
Definition Creature.h:236
CreatureTemplate const * GetCreatureTemplate() const
Definition Creature.h:207
bool HaveLootFor(uint32 loot_id) const
Definition LootMgr.h:224
bool IsPet() const
Definition Unit.h:803
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:754
Seconds GetGameTime()
Definition GameTime.cpp:39
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().

◆ AtDisengage()

void Creature::AtDisengage ( )
overridevirtual

Reimplemented from Unit.

2948{
2950
2954
2955 if (IsPet() || IsGuardian()) // update pets' speed for catchup OOC speed
2956 {
2957 UpdateSpeed(MOVE_RUN, true);
2958 UpdateSpeed(MOVE_SWIM, true);
2959 UpdateSpeed(MOVE_FLIGHT, true);
2960 }
2961}
@ UNIT_DYNFLAG_TAPPED
Definition SharedDefines.h:3356
@ UNIT_STATE_ATTACK_PLAYER
Definition UnitDefines.h:187
@ MOVE_FLIGHT
Definition UnitDefines.h:362
@ MOVE_SWIM
Definition UnitDefines.h:359
@ MOVE_RUN
Definition UnitDefines.h:357
bool HasDynamicFlag(uint32 flag) const
Definition Object.h:130
void ClearUnitState(uint32 f)
Definition Unit.h:743
void ReplaceAllDynamicFlags(uint32 flag) override
Definition Unit.h:775
virtual void AtDisengage()
Definition Unit.h:980
bool IsAlive() const
Definition Unit.h:1812
bool IsGuardian() const
Definition Unit.h:801
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition Unit.cpp:10934

References Unit::AtDisengage(), Unit::ClearUnitState(), GetCreatureTemplate(), Object::HasDynamicFlag(), Unit::IsAlive(), Unit::IsGuardian(), Unit::IsPet(), MOVE_FLIGHT, MOVE_RUN, MOVE_SWIM, Unit::ReplaceAllDynamicFlags(), UNIT_DYNFLAG_TAPPED, UNIT_STATE_ATTACK_PLAYER, and Unit::UpdateSpeed().

Referenced by CreatureAI::EngagementOver().

◆ AtEngage()

void Creature::AtEngage ( Unit *  target)
overridevirtual

Reimplemented from Unit.

2894{
2895 Unit::AtEngage(target);
2896
2897 if (!IsStandState())
2899
2901 Dismount();
2902
2904
2905 if (IsPet() || IsGuardian()) // update pets' speed for catchup OOC speed
2906 {
2907 UpdateSpeed(MOVE_RUN, true);
2908 UpdateSpeed(MOVE_SWIM, true);
2909 UpdateSpeed(MOVE_FLIGHT, true);
2910 }
2911
2912 // Notify controlled creatures (guardians/pets) so they assist when
2913 // the owner enters combat via assist/aggro chain, not only via damage.
2914 for (Unit* controlled : m_Controlled)
2915 if (Creature* cControlled = controlled->ToCreature())
2916 if (CreatureAI* controlledAI = cControlled->AI())
2917 controlledAI->OwnerAttackedBy(target);
2918
2920 if (movetype == WAYPOINT_MOTION_TYPE || movetype == ESCORT_MOTION_TYPE || (IsAIEnabled && AI()->IsEscorted()))
2921 {
2923
2924 // if its a vehicle, set the home position of every creature passenger at engage
2925 // so that they are in combat range if hostile
2926 if (Vehicle* vehicle = GetVehicleKit())
2927 {
2928 for (auto& seat : vehicle->Seats)
2929 if (Unit* passenger = ObjectAccessor::GetUnit(*this, seat.second.Passenger.Guid))
2930 if (Creature* creature = passenger->ToCreature())
2931 creature->SetHomePosition(GetPosition());
2932 }
2933 }
2934
2935 if (CreatureAI* ai = AI())
2936 {
2937 ai->JustEngagedWith(target);
2939
2940 if (CreatureGroup* formation = GetFormation())
2941 formation->MemberEngagingTarget(this, target);
2942
2943 sScriptMgr->OnUnitEnterCombat(this, target);
2944 }
2945}
MovementGeneratorType
Definition MotionMaster.h:38
@ ESCORT_MOTION_TYPE
Definition MotionMaster.h:57
@ WAYPOINT_MOTION_TYPE
Definition MotionMaster.h:41
@ CREATURE_TYPE_FLAG_ALLOW_MOUNTED_COMBAT
Definition SharedDefines.h:2700
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:35
Seats
Definition boss_flame_leviathan.cpp:171
Definition CreatureGroups.h:95
void SetHomePosition(float x, float y, float z, float o)
Definition Creature.h:347
CreatureGroup const * GetFormation() const
Definition Creature.h:372
void RefreshSwimmingFlag(bool recheck=false)
Definition Creature.cpp:3464
void UpdateLeashExtensionTime()
Definition Creature.cpp:3783
CreatureAI * AI() const
Definition Creature.h:143
MovementGeneratorType GetCurrentMovementGeneratorType() const
Definition MotionMaster.cpp:1088
Creature * ToCreature()
Definition Object.h:212
ControlSet m_Controlled
Definition Unit.h:2095
MotionMaster * GetMotionMaster()
Definition Unit.h:1774
void Dismount()
Definition Unit.cpp:10363
bool IsStandState() const
Definition Unit.cpp:12786
virtual void AtEngage(Unit *target)
Definition Unit.cpp:7389
void SetStandState(uint8 state)
Definition Unit.cpp:12801
Definition Vehicle.h:28
Definition ObjectAccessor.h:61
Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:223
Position GetPosition() const
Definition Position.h:147

References AI(), Unit::AtEngage(), CREATURE_TYPE_FLAG_ALLOW_MOUNTED_COMBAT, Unit::Dismount(), ESCORT_MOTION_TYPE, GetCreatureTemplate(), MotionMaster::GetCurrentMovementGeneratorType(), GetFormation(), Unit::GetMotionMaster(), Position::GetPosition(), ObjectAccessor::GetUnit(), Unit::GetVehicleKit(), Unit::IsAIEnabled, Unit::IsGuardian(), Unit::IsPet(), Unit::IsStandState(), Unit::m_Controlled, MOVE_FLIGHT, MOVE_RUN, MOVE_SWIM, RefreshSwimmingFlag(), SetHomePosition(), Unit::SetStandState(), sScriptMgr, Object::ToCreature(), UNIT_STAND_STATE_STAND, UpdateLeashExtensionTime(), Unit::UpdateSpeed(), and WAYPOINT_MOTION_TYPE.

Referenced by CreatureAI::EngagementStart().

◆ CalculateMinMaxDamage()

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

Implements Unit.

1118{
1119 // creatures only have one damage
1120 if (damageIndex != 0)
1121 {
1122 minDamage = 0.f;
1123 maxDamage = 0.f;
1124 return;
1125 }
1126
1127 UnitMods unitMod;
1128 float variance = 1.0f;
1129 switch (attType)
1130 {
1131 case BASE_ATTACK:
1132 default:
1133 variance = GetCreatureTemplate()->BaseVariance;
1134 unitMod = UNIT_MOD_DAMAGE_MAINHAND;
1135 break;
1136 case OFF_ATTACK:
1137 variance = GetCreatureTemplate()->BaseVariance;
1138 unitMod = UNIT_MOD_DAMAGE_OFFHAND;
1139 break;
1140 case RANGED_ATTACK:
1141 variance = GetCreatureTemplate()->RangeVariance;
1142 unitMod = UNIT_MOD_DAMAGE_RANGED;
1143 break;
1144 }
1145
1146 if (attType == OFF_ATTACK && !HasOffhandWeaponForAttack())
1147 {
1148 minDamage = 0.0f;
1149 maxDamage = 0.0f;
1150 return;
1151 }
1152
1153 float weaponMinDamage = GetWeaponDamageRange(attType, MINDAMAGE);
1154 float weaponMaxDamage = GetWeaponDamageRange(attType, MAXDAMAGE);
1155
1156 // Disarm for creatures
1157 if (HasWeapon(attType) && !HasWeaponForAttack(attType))
1158 {
1159 minDamage *= 0.5f;
1160 maxDamage *= 0.5f;
1161 }
1162
1163 float attackPower = GetTotalAttackPowerValue(attType);
1164 float attackSpeedMulti = GetAPMultiplier(attType, normalized);
1165 float baseValue = GetFlatModifierValue(unitMod, BASE_VALUE) + (attackPower / 14.0f) * variance;
1166 float basePct = GetPctModifierValue(unitMod, BASE_PCT) * attackSpeedMulti;
1167 float totalValue = GetFlatModifierValue(unitMod, TOTAL_VALUE);
1168 float totalPct = addTotalPct ? GetPctModifierValue(unitMod, TOTAL_PCT) : 1.0f;
1169 float dmgMultiplier = GetCreatureTemplate()->DamageModifier; // = DamageModifier * _GetDamageMod(rank);
1170
1171 minDamage = ((weaponMinDamage + baseValue) * dmgMultiplier * basePct + totalValue) * totalPct;
1172 maxDamage = ((weaponMaxDamage + baseValue) * dmgMultiplier * basePct + totalValue) * totalPct;
1173
1174 // pussywizard: crashfix (casting negative to uint => min > max => assertion in urand)
1175 if (minDamage < 0.0f || minDamage > 1000000000.0f)
1176 minDamage = 0.0f;
1177 if (maxDamage < 0.0f || maxDamage > 1000000000.0f)
1178 maxDamage = 0.0f;
1179 if (minDamage > maxDamage)
1180 minDamage = maxDamage;
1181}
@ BASE_VALUE
Definition Unit.h:131
@ TOTAL_VALUE
Definition Unit.h:132
@ MINDAMAGE
Definition Unit.h:145
@ MAXDAMAGE
Definition Unit.h:146
UnitMods
Definition Unit.h:152
@ UNIT_MOD_DAMAGE_OFFHAND
Definition Unit.h:176
@ UNIT_MOD_DAMAGE_RANGED
Definition Unit.h:177
@ UNIT_MOD_DAMAGE_MAINHAND
Definition Unit.h:175
@ OFF_ATTACK
Definition Unit.h:224
@ BASE_ATTACK
Definition Unit.h:223
@ RANGED_ATTACK
Definition Unit.h:225
@ TOTAL_PCT
Definition Unit.h:139
@ BASE_PCT
Definition Unit.h:138
bool HasWeaponForAttack(WeaponAttackType type) const override
Definition Creature.h:195
bool HasWeapon(WeaponAttackType type) const override
Definition Creature.cpp:3392
bool HasOffhandWeaponForAttack() const
Definition Unit.h:1004
float GetPctModifierValue(UnitMods unitMod, UnitModifierPctType modifierType) const
Definition Unit.cpp:11699
float GetTotalAttackPowerValue(WeaponAttackType attType, Unit *pVictim=nullptr) const
Definition Unit.cpp:11970
float GetWeaponDamageRange(WeaponAttackType attType, WeaponDamageRange type, uint8 damageIndex=0) const
Definition Unit.cpp:11994
float GetAPMultiplier(WeaponAttackType attType, bool normalized)
Definition Unit.cpp:13306
float GetFlatModifierValue(UnitMods unitMod, UnitModifierFlatType modifierType) const
Definition Unit.cpp:11688
float BaseVariance
Definition CreatureData.h:211
float RangeVariance
Definition CreatureData.h:212
float DamageModifier
Definition CreatureData.h:208

References BASE_ATTACK, BASE_PCT, BASE_VALUE, CreatureTemplate::BaseVariance, CreatureTemplate::DamageModifier, Unit::GetAPMultiplier(), GetCreatureTemplate(), Unit::GetFlatModifierValue(), Unit::GetPctModifierValue(), Unit::GetTotalAttackPowerValue(), Unit::GetWeaponDamageRange(), Unit::HasOffhandWeaponForAttack(), HasWeapon(), HasWeaponForAttack(), 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)
2497{
2498 if (!target)
2499 {
2500 target = GetVictim();
2501 }
2502
2503 if (!m_AlreadyCallAssistance && target && !IsPet() && !IsCharmed())
2504 {
2505 SetNoCallAssistance(true);
2506
2507 float radius = sWorld->getFloatConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS);
2508
2509 if (radius > 0)
2510 {
2511 std::list<Creature*> assistList;
2512
2513 Acore::AnyAssistCreatureInRangeCheck u_check(this, target, radius);
2515 Cell::VisitObjects(this, searcher, radius);
2516
2517 if (!assistList.empty())
2518 {
2519 AssistDelayEvent* e = new AssistDelayEvent(target->GetGUID(), this);
2520 while (!assistList.empty())
2521 {
2522 // Pushing guids because in delay can happen some creature gets despawned => invalid pointer
2523 e->AddAssistant((*assistList.begin())->GetGUID());
2524 assistList.pop_front();
2525 }
2527 }
2528 }
2529 }
2530}
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:27
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS
Definition WorldConfig.h:162
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY
Definition WorldConfig.h:242
Definition GridNotifiers.h:1292
Definition Creature.h:571
void AddAssistant(ObjectGuid guid)
Definition Creature.h:576
void SetNoCallAssistance(bool val)
Definition Creature.h:273
void AddEventAtOffset(BasicEvent *event, Milliseconds offset, uint8 eventGroup=0)
Definition EventProcessor.h:108
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:120
bool IsCharmed() const
Definition Unit.h:1327
Unit * GetVictim() const
Definition Unit.h:910
EventProcessor m_Events
Definition Object.h:749
Definition GridNotifiers.h:496
static void VisitObjects(WorldObject const *obj, T &visitor, float radius)
Definition CellImpl.h:165

References AssistDelayEvent::AddAssistant(), EventProcessor::AddEventAtOffset(), CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY, CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS, Object::GetGUID(), Unit::GetVictim(), Unit::IsCharmed(), Unit::IsPet(), m_AlreadyCallAssistance, WorldObject::m_Events, SetNoCallAssistance(), sWorld, and Cell::VisitObjects().

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

◆ CallForHelp()

void Creature::CallForHelp ( float  fRadius,
Unit *  target = nullptr 
)
2533{
2534 if (radius <= 0.0f || !IsEngaged() || !IsAlive() || IsPet() || IsCharmed())
2535 return;
2536
2537 if (!target)
2538 target = GetThreatMgr().GetCurrentVictim();
2539 if (!target)
2540 target = GetThreatMgr().GetAnyTarget();
2541 if (!target)
2542 target = GetCombatManager().GetAnyTarget();
2543
2544 if (!target)
2545 return;
2546
2547 if (m_alreadyCallForHelp) // avoid recursive call for help for any reason
2548 return;
2549
2550 Acore::CallOfHelpCreatureInRangeDo u_do(this, target, radius);
2552 Cell::VisitObjects(this, worker, radius);
2553}
Definition GridNotifiers.h:1172
Unit * GetAnyTarget() const
Definition CombatManager.cpp:203
bool IsEngaged() const override
Definition Creature.cpp:2963
Unit * GetCurrentVictim()
Definition ThreatManager.cpp:266
Unit * GetAnyTarget() const
Definition ThreatManager.cpp:281
ThreatManager & GetThreatMgr()
Definition Unit.h:965
CombatManager & GetCombatManager()
Definition Unit.h:967
Definition GridNotifiers.h:512

References CombatManager::GetAnyTarget(), ThreatManager::GetAnyTarget(), Unit::GetCombatManager(), ThreatManager::GetCurrentVictim(), Unit::GetThreatMgr(), Unit::IsAlive(), Unit::IsCharmed(), IsEngaged(), Unit::IsPet(), m_alreadyCallForHelp, and Cell::VisitObjects().

Referenced by BossAI::_JustEngagedWith(), boss_emperor_dagran_thaurissan::JustEngagedWith(), npc_sunblade_scout::JustEngagedWith(), boss_grand_champion::boss_grand_championAI::JustEngagedWith(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::JustEngagedWith(), DarkFallenAI::JustEngagedWith(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::JustEngagedWith(), boss_thorim_start_npcs::JustEngagedWith(), boss_thorim_gauntlet_npcs::JustEngagedWith(), boss_blackheart_the_inciter::JustEngagedWith(), boss_moroes::JustEngagedWith(), npc_sindragosa_trash::npc_sindragosa_trashAI::JustEngagedWith(), boss_anubrekhan::JustEngagedWith(), boss_gothik::boss_gothikAI::JustSummoned(), npc_sergeant_bly::npc_sergeant_blyAI::MovementInform(), npc_sentinel_leader::UpdateAI(), and npc_cork_gizelton::npc_cork_gizeltonAI::WaypointReached().

◆ CanAlwaysSee()

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

Reimplemented from WorldObject.

1899{
1900 if (IsAIEnabled && AI()->CanSeeAlways(obj))
1901 return true;
1902
1903 return false;
1904}

References AI(), and Unit::IsAIEnabled.

◆ CanAssistTo()

bool Creature::CanAssistTo ( Unit const *  u,
Unit const *  enemy,
bool  checkfaction = true 
) const
Todo:
: Implement aggro range, detection range and assistance range templates
2556{
2557 // is it true?
2559 return false;
2560
2561 // we don't need help from zombies :)
2562 if (!IsAlive())
2563 return false;
2564
2565 // Xinef: we cannot assist in evade mode
2566 if (IsInEvadeMode())
2567 return false;
2568
2569 // pussywizard: or if enemy is in evade mode
2570 if (enemy && enemy->IsCreature() && enemy->ToCreature()->IsInEvadeMode())
2571 return false;
2572
2573 // we don't need help from non-combatant ;)
2574 if (IsCivilian())
2575 return false;
2576
2578 return false;
2579
2580 // skip fighting creature
2581 if (IsEngaged())
2582 return false;
2583
2584 // only free creature
2586 return false;
2587
2590 {
2591 return false;
2592 }
2593
2594 // only from same creature faction
2595 if (checkfaction)
2596 {
2597 if (GetFaction() != u->GetFaction())
2598 return false;
2599
2600 if (!RespondsToCallForHelp())
2601 return false;
2602 }
2603 else
2604 {
2605 if (!IsFriendlyTo(u))
2606 return false;
2607 }
2608
2609 // skip non hostile to caster enemy creatures
2610 if (!IsHostileTo(enemy))
2611 return false;
2612
2613 // Check if can see the enemy
2614 if (!CanSeeOrDetect(enemy))
2615 {
2616 return false;
2617 }
2618
2619 return true;
2620}
@ CREATURE_FLAG_EXTRA_IGNORE_ALL_ASSISTANCE_CALLS
Definition CreatureData.h:72
@ UNIT_FLAG_NON_ATTACKABLE
Definition UnitDefines.h:258
@ UNIT_FLAG_NOT_SELECTABLE
Definition UnitDefines.h:282
bool IsCivilian() const
Definition Creature.h:78
bool HasReactState(ReactStates state) const
Definition Creature.h:101
bool IsInEvadeMode() const
Definition Creature.h:137
bool RespondsToCallForHelp() const
Definition Unit.h:1050
bool HasUnitFlag(UnitFlags flags) const
Definition Unit.h:753
ObjectGuid GetCharmerOrOwnerGUID() const override
Definition Unit.h:1312
bool IsImmuneToNPC() const
Definition Unit.h:943
uint32 GetFaction() const override
Definition Unit.h:857
bool CanSeeOrDetect(WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
Definition Object.cpp:1815
bool HasFlagsExtra(uint32 flag) const
Definition CreatureData.h:278

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

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

◆ CanCastSpell()

bool Creature::CanCastSpell ( uint32  spellID) const

Returns true if the creature is able to cast the spell.

3955{
3956 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID);
3957 int32 currentPower = GetPower(getPowerType());
3958
3960 {
3961 return false;
3962 }
3963
3964 if (spellInfo && (currentPower < spellInfo->CalcPowerCost(this, spellInfo->GetSchoolMask())))
3965 {
3966 return false;
3967 }
3968
3969 return true;
3970}
std::int32_t int32
Definition Define.h:103
@ UNIT_FLAG_SILENCED
Definition UnitDefines.h:270
@ UNIT_FIELD_FLAGS
Definition UpdateFields.h:117
bool IsSpellProhibited(SpellSchoolMask idSchoolMask) const
Definition Creature.cpp:2981
bool HasFlag(uint16 index, uint32 flag) const
Definition Object.cpp:880
SpellSchoolMask GetSchoolMask() const
Definition SpellInfo.cpp:1935
Powers getPowerType() const
Definition Unit.h:1145
uint32 GetPower(Powers power) const
Definition Unit.h:1149

References Unit::GetPower(), Unit::getPowerType(), SpellInfo::GetSchoolMask(), Object::HasFlag(), IsSpellProhibited(), sSpellMgr, UNIT_FIELD_FLAGS, and UNIT_FLAG_SILENCED.

Referenced by boss_shade_of_aran::JustEngagedWith(), and npc_capernian::ScheduleEvents().

◆ CanCreatureAttack()

bool Creature::CanCreatureAttack ( Unit const *  victim,
bool  skipDistCheck = false 
) const
2693{
2694 if (!victim->IsInMap(this))
2695 return false;
2696
2697 if (!IsValidAttackTarget(victim))
2698 return false;
2699
2700 if (!victim->isInAccessiblePlaceFor(this))
2701 return false;
2702
2703 if (IsAIEnabled && !AI()->CanAIAttack(victim))
2704 return false;
2705
2706 // pussywizard: we cannot attack in evade mode
2707 if (IsInEvadeMode())
2708 return false;
2709
2710 // pussywizard: or if enemy is in evade mode
2711 if (victim->IsCreature() && victim->ToCreature()->IsInEvadeMode())
2712 return false;
2713
2714 // cannot attack if is during 5 second grace period, unless being attacked
2715 if (m_respawnedTime && (GameTime::GetGameTime().count() - m_respawnedTime) < 5 && !IsEngagedBy(victim))
2716 {
2717 return false;
2718 }
2719
2720 // if victim is in FD and we can't see that
2721 if (victim->HasUnitFlag2(UNIT_FLAG2_FEIGN_DEATH) && !CanIgnoreFeignDeath())
2722 {
2723 return false;
2724 }
2725
2727 {
2728 if (GetMap()->IsDungeon())
2729 return true;
2730
2731 float visibility = std::max<float>(GetVisibilityRange(), victim->GetVisibilityRange());
2732
2733 // if outside visibility
2734 if (!IsWithinDist(victim, visibility))
2735 return false;
2736
2737 // pussywizard: don't check distance to home position if recently damaged (allow kiting away from spawnpoint!)
2738 // xinef: this should include taunt auras
2740 return true;
2741 }
2742
2743 if (skipDistCheck)
2744 return true;
2745
2746 if (Unit* unit = GetCharmerOrOwner())
2747 {
2748 float visibilityDist = std::min<float>(GetMap()->GetVisibilityRange() + GetObjectSize() * 2, DEFAULT_VISIBILITY_DISTANCE);
2749 return victim->IsWithinDist(unit, visibilityDist);
2750 }
2751
2752 float dist = sWorld->getFloatConfig(CONFIG_CREATURE_LEASH_RADIUS);
2753 if (!dist)
2754 return true;
2755
2756 float x, y, z;
2757 x = y = z = 0.0f;
2759 if (idleSlot && idleSlot->GetResetPosition(x, y, z))
2760 return IsInDist2d(x, y, dist);
2761 else
2762 return IsInDist2d(&m_homePosition, dist);
2763}
@ MOTION_SLOT_IDLE
Definition MotionMaster.h:64
#define DEFAULT_VISIBILITY_DISTANCE
Definition ObjectDefines.h:39
@ CONFIG_CREATURE_LEASH_RADIUS
Definition WorldConfig.h:160
bool isWorldBoss() const
Definition Creature.h:123
time_t GetLastLeashExtensionTime() const
Definition Creature.cpp:3778
uint8 GetLeashTimer() const
Definition Creature.cpp:3788
_Ty GetMotionSlot(int slot) const
Definition MotionMaster.h:182
Definition MovementGenerator.h:28
virtual bool GetResetPosition(float &, float &, float &)
Definition MovementGenerator.h:51
bool IsPlayer() const
Definition Object.h:207
Unit * GetCharmerOrOwner() const
Definition Unit.h:1303
bool IsValidAttackTarget(Unit const *target, SpellInfo const *bySpell=nullptr) const
Definition Unit.cpp:10537
bool HasTauntAura() const
Definition Unit.h:1859
float GetVisibilityRange() const
Definition Object.cpp:1710
float GetObjectSize() const
Definition Object.cpp:2904
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1381
bool IsInDist2d(float x, float y, float dist) const
Definition Position.h:211

References AI(), CanIgnoreFeignDeath(), CONFIG_CREATURE_LEASH_RADIUS, DEFAULT_VISIBILITY_DISTANCE, Unit::GetCharmerOrOwner(), Unit::GetCharmerOrOwnerGUID(), GameTime::GetGameTime(), GetLastLeashExtensionTime(), GetLeashTimer(), WorldObject::GetMap(), Unit::GetMotionMaster(), MotionMaster::GetMotionSlot(), WorldObject::GetObjectSize(), MovementGenerator::GetResetPosition(), WorldObject::GetVisibilityRange(), Unit::HasTauntAura(), Unit::HasUnitFlag2(), Unit::IsAIEnabled, Object::IsCreature(), Unit::IsEngagedBy(), Unit::isInAccessiblePlaceFor(), Position::IsInDist2d(), IsInEvadeMode(), WorldObject::IsInMap(), Object::IsPlayer(), Unit::IsValidAttackTarget(), WorldObject::IsWithinDist(), isWorldBoss(), m_homePosition, m_respawnedTime, MOTION_SLOT_IDLE, sWorld, Object::ToCreature(), and UNIT_FLAG2_FEIGN_DEATH.

Referenced by PetAI::_needToStop(), CanStartAttack(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustSummoned(), PetAI::SelectNextTarget(), SelectVictim(), ThreatReference::ShouldBeOffline(), npc_pet_hunter_snake_trap::UpdateAI(), npc_pet_shaman_earth_elemental::UpdateAI(), and npc_pet_shaman_fire_elemental::UpdateAI().

◆ CanEnterWater()

bool Creature::CanEnterWater ( ) const
overridevirtual

Implements Unit.

3457{
3458 if (CanSwim())
3459 return true;
3460
3462}
bool CanSwim() const override
This method check the current flag/status of a creature and its inhabit type.
Definition Creature.cpp:3445
CreatureMovementData const & GetMovementTemplate() const
Definition Creature.cpp:3169
bool IsSwimAllowed() const
Definition CreatureData.h:136

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

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

◆ CanFly()

◆ CanGeneratePickPocketLoot()

bool Creature::CanGeneratePickPocketLoot ( ) const

◆ CanHover()

bool Creature::CanHover ( ) const
inline
bool IsHovering() const
Definition Unit.h:1730
CreatureGroundMovementType Ground
Definition CreatureData.h:123

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

Referenced by LoadCreaturesAddon(), and UpdateMovementFlags().

◆ CanIgnoreFeignDeath()

bool Creature::CanIgnoreFeignDeath ( ) const
inline
@ CREATURE_FLAG_EXTRA_IGNORE_FEIGN_DEATH
Definition CreatureData.h:62
bool HasFlagsExtra(uint32 flag) const
Definition Creature.h:76

References CREATURE_FLAG_EXTRA_IGNORE_FEIGN_DEATH, and HasFlagsExtra().

Referenced by _IsTargetAcceptable(), and CanCreatureAttack().

◆ CanNotReachTarget()

bool Creature::CanNotReachTarget ( ) const
3752{
3753 return m_cannotReachTarget;
3754}
ObjectGuid m_cannotReachTarget
Definition Creature.h:551

References m_cannotReachTarget.

Referenced by IsEvadingAttacks(), and IsNotReachableAndNeedRegen().

◆ CanPeriodicallyCallForAssistance()

bool Creature::CanPeriodicallyCallForAssistance ( ) const
private
3799{
3800 if (!IsInCombat())
3801 return false;
3802
3804 return false;
3805
3806 if (!CanHaveThreatList())
3807 return false;
3808
3809 if (IsSummon() && GetMap()->Instanceable())
3810 return false;
3811
3812 return true;
3813}
@ UNIT_STATE_POSSESSED
Definition UnitDefines.h:189
bool IsSummon() const
Definition Unit.h:800
bool HasUnitState(const uint32 f) const
Definition Unit.h:742
bool CanHaveThreatList(bool skipAliveCheck=false) const
Definition Unit.cpp:11249
bool IsInCombat() const
Definition Unit.h:949

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

Referenced by Update().

◆ CanResetTalents()

bool Creature::CanResetTalents ( Player *  player) const
1301{
1302 Trainer::Trainer const* trainer = sObjectMgr->GetTrainer(GetEntry());
1303 if (!trainer)
1304 return false;
1305
1306 return player->GetLevel() >= 10 && trainer->IsTrainerValidForPlayer(player);
1307}
#define sObjectMgr
Definition ObjectMgr.h:1731
uint32 GetEntry() const
Definition Object.h:123
Definition Trainer.h:66
bool IsTrainerValidForPlayer(Player const *player) const
Definition Trainer.cpp:223
uint8 GetLevel() const
Definition Unit.h:1117

References Object::GetEntry(), Unit::GetLevel(), Trainer::Trainer::IsTrainerValidForPlayer(), and sObjectMgr.

Referenced by WorldSession::HandleTalentWipeConfirmOpcode(), and Player::PrepareGossipMenu().

◆ CanStartAttack()

bool Creature::CanStartAttack ( Unit const *  u,
bool  force = false 
) const
1922{
1923 if (IsCivilian())
1924 return false;
1925
1926 // This set of checks is should be done only for creatures
1927 if ((IsImmuneToNPC() && !who->IsPlayer()) ||
1928 (IsImmuneToPC() && who->IsPlayer()))
1929 return false;
1930
1931 if (Unit* owner = who->GetOwner())
1932 if (owner->IsPlayer() && IsImmuneToPC())
1933 return false;
1934
1935 // Do not attack non-combat pets
1936 if (who->IsCreature() && who->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET)
1937 return false;
1938
1940 return false;
1941
1942 if (!force)
1943 {
1944 if (!_IsTargetAcceptable(who))
1945 return false;
1946
1947 // Totems never pull proximity aggro; they are only attacked in response
1948 // to threat they generate themselves (e.g. Searing Totem)
1949 if (who->IsTotem())
1950 return false;
1951
1952 if (IsNeutralToAll() || !IsWithinDistInMap(who, GetAggroRange(who) + m_CombatDistance, true, false, false))
1953 return false;
1954 }
1955
1956 if (!CanCreatureAttack(who))
1957 return false;
1958
1959 return IsWithinLOSInMap(who);
1960}
#define CREATURE_Z_ATTACK_RANGE
Definition Creature.h:38
@ CREATURE_TYPE_NON_COMBAT_PET
Definition SharedDefines.h:2633
bool _IsTargetAcceptable(Unit const *target) const
Definition Creature.cpp:2624
bool CanFly() const override
Definition Creature.h:86
bool CanCreatureAttack(Unit const *victim, bool skipDistCheck=false) const
Definition Creature.cpp:2692
float GetAggroRange(Unit const *target) const
Definition Creature.cpp:3475
Unit * GetOwner() const
Definition Unit.cpp:7517
bool IsImmuneToPC() const
Definition Unit.h:941
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:1412
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1386
float GetDistanceZ(WorldObject const *obj) const
Definition Object.cpp:1253

References _IsTargetAcceptable(), CanCreatureAttack(), CanFly(), CREATURE_TYPE_NON_COMBAT_PET, CREATURE_Z_ATTACK_RANGE, GetAggroRange(), Unit::GetCreatureType(), WorldObject::GetDistanceZ(), Unit::GetOwner(), IsCivilian(), Object::IsCreature(), Unit::IsImmuneToNPC(), Unit::IsImmuneToPC(), Unit::IsNeutralToAll(), Object::IsPlayer(), Unit::IsTotem(), WorldObject::IsWithinDistInMap(), WorldObject::IsWithinLOSInMap(), and m_CombatDistance.

Referenced by CreatureAI::MoveInLineOfSight(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), SmartAI::MoveInLineOfSight(), npc_hadronox_crusherPackAI::MoveInLineOfSight(), CreatureAI::OnOwnerCombatInteraction(), 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.

3446{
3447 if (Unit::CanSwim() || (!Unit::CanSwim() && !CanFly()))
3448 return true;
3449
3450 if (IsPet())
3451 return true;
3452
3453 return false;
3454}
virtual bool CanSwim() const
this method checks the current flag of a unit
Definition Unit.cpp:15636

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

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

◆ CanWalk()

◆ ClearLastLeashExtensionTimePtr()

void Creature::ClearLastLeashExtensionTimePtr ( )

◆ ClearProhibitedSpellTimers()

void Creature::ClearProhibitedSpellTimers ( )
2998{
2999 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
3000 {
3001 m_ProhibitSchoolTime[i] = 0;
3002 }
3003}

References m_ProhibitSchoolTime, MAX_SPELL_SCHOOL, and SPELL_SCHOOL_NORMAL.

Referenced by boss_shade_of_aran::JustEngagedWith().

◆ ClearTarget()

void Creature::ClearTarget ( )
inline
397{ SetTarget(); };
void SetTarget(ObjectGuid guid=ObjectGuid::Empty) override
Definition Creature.cpp:3616

References SetTarget().

Referenced by boss_julianne::DamageTaken(), npc_sunblade_scout::JustEngagedWith(), npc_amanishi_scout::JustEngagedWith(), and boss_leotheras_the_blind::Reset().

◆ ClearTextRepeatGroup()

void Creature::ClearTextRepeatGroup ( uint8  textGroup)
3876{
3877 CreatureTextRepeatGroup::iterator groupItr = m_textRepeat.find(textGroup);
3878 if (groupItr != m_textRepeat.end())
3879 groupItr->second.clear();
3880}
CreatureTextRepeatGroup m_textRepeat
‍Saved target during spell focus for restoration
Definition Creature.h:556
uint8 textGroup
Definition instance_ulduar.cpp:87

References m_textRepeat, and textGroup.

Referenced by CreatureTextMgr::SendChat().

◆ Create()

bool Creature::Create ( ObjectGuid::LowType  guidlow,
Map *  map,
uint32  phaseMask,
uint32  Entry,
uint32  vehId,
float  x,
float  y,
float  z,
float  ang,
CreatureData const *  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

1167{
1168 ASSERT(map);
1169 SetMap(map);
1170 SetPhaseMask(phaseMask, false);
1171
1172 CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(Entry);
1173 if (!cinfo)
1174 {
1175 LOG_ERROR("sql.sql", "Creature::Create(): creature template (guidlow: {}, entry: {}) does not exist.", guidlow, Entry);
1176 return false;
1177 }
1178
1181 Relocate(x, y, z, ang);
1182
1183 if (!IsPositionValid())
1184 {
1185 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);
1186 return false;
1187 }
1188
1189 // area/zone id is needed immediately for ZoneScript::GetCreatureEntry hook before it is known which creature template to load (no model/scale available yet)
1190 PositionFullTerrainStatus terrainData;
1192 ProcessPositionDataChanged(terrainData);
1193
1194 //oX = x; oY = y; dX = x; dY = y; m_moveTime = 0; m_startMove = 0;
1195 if (!CreateFromProto(guidlow, Entry, vehId, data))
1196 return false;
1197
1199
1200 switch (GetCreatureTemplate()->rank)
1201 {
1204 break;
1207 break;
1210 break;
1212 // Xinef: Reduce corpse delay for bossess outside of instance
1213 if (!GetInstanceId())
1214 m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_ELITE) * 2;
1215 else
1217 break;
1218 default:
1220 break;
1221 }
1222
1224 CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&display, cinfo);
1225 if (minfo && !IsTotem()) // Cancel load if no model defined or if totem
1226 {
1227 _nativeObjectScale = display.DisplayScale;
1228 SetDisplayId(display.CreatureDisplayID);
1229 SetNativeDisplayId(display.CreatureDisplayID);
1230 }
1231
1234
1237
1239
1241 {
1244 }
1245 else if (cinfo->type_flags & CREATURE_TYPE_FLAG_VISIBLE_TO_GHOSTS) // Xinef: Add ghost visibility for ghost units
1246 {
1249 }
1250 if (Entry == VISUAL_WAYPOINT)
1251 SetVisible(false);
1252
1255
1256 return true;
1257}
@ CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING
Definition CreatureData.h:75
@ CREATURE_FLAG_EXTRA_GHOST_VISIBILITY
Definition CreatureData.h:56
#define LOG_ERROR(filterType__,...)
Definition Log.h:145
#define VISUAL_WAYPOINT
Definition MotionMaster.h:34
#define DEFAULT_COLLISION_HEIGHT
Definition ObjectDefines.h:49
@ SERVERSIDE_VISIBILITY_GHOST
Definition SharedDefines.h:1262
@ GHOST_VISIBILITY_ALIVE
Definition SharedDefines.h:1269
@ GHOST_VISIBILITY_GHOST
Definition SharedDefines.h:1270
@ CREATURE_TYPE_FLAG_VISIBLE_TO_GHOSTS
Definition SharedDefines.h:2690
@ UNIT_STATE_IGNORE_PATHFINDING
Definition UnitDefines.h:200
@ CONFIG_CORPSE_DECAY_ELITE
Definition WorldConfig.h:261
@ CONFIG_CORPSE_DECAY_NORMAL
Definition WorldConfig.h:259
@ CONFIG_CORPSE_DECAY_WORLDBOSS
Definition WorldConfig.h:263
@ CONFIG_CORPSE_DECAY_RARE
Definition WorldConfig.h:260
@ CONFIG_CORPSE_DECAY_RAREELITE
Definition WorldConfig.h:262
bool LoadCreaturesAddon(bool reload=false)
Definition Creature.cpp:2778
bool CreateFromProto(ObjectGuid::LowType guidlow, uint32 Entry, uint32 vehId, CreatureData const *data=nullptr)
Definition Creature.cpp:1631
uint32 GetScriptId() const
Definition Creature.cpp:3249
void UpdateMovementFlags()
Definition Creature.cpp:3520
float GetNativeObjectScale() const override
Definition Creature.cpp:3586
float _nativeObjectScale
DisplayScale of the native model, set in InitEntry.
Definition Creature.h:567
void LoadSparringPct()
Definition Creature.cpp:2864
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition Object.h:405
void GetFullTerrainStatusForPosition(uint32 phaseMask, float x, float y, float z, float collisionHeight, PositionFullTerrainStatus &data, Optional< uint8 > reqLiquidType={})
Definition Map.cpp:1419
void SetVisible(bool x)
Definition Unit.cpp:10916
virtual void SetDisplayId(uint32 modelId, std::optional< float > displayScale={})
Definition Unit.cpp:12837
void SetNativeDisplayId(uint32 displayId)
Definition Unit.h:2000
void AddUnitState(uint32 f)
Definition Unit.h:741
float GetHoverHeight() const
Definition Unit.h:1737
uint32 GetNativeDisplayId() const
Definition Unit.h:1998
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition Unit.cpp:15011
void ProcessPositionDataChanged(PositionFullTerrainStatus const &data) override
Definition Unit.cpp:4233
bool IsSpiritHealer() const
Definition Unit.h:818
bool IsTotem() const
Definition Unit.h:805
bool IsSpiritGuide() const
Definition Unit.h:819
uint32 GetPhaseMask() const
Definition Object.h:523
uint32 LastUsedScriptID
Definition Object.h:698
uint32 GetInstanceId() const
Definition Object.h:520
virtual void SetMap(Map *map)
Definition Object.cpp:2203
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
Definition Object.h:630
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition Object.h:629
uint32 const Entry[3]
Definition instance_blackwing_lair.cpp:73
Definition CreatureData.h:389
Definition CreatureData.h:170
Definition CreatureData.h:187
uint32 type_flags
Definition CreatureData.h:219
Definition Map.h:99
float m_positionZ
Definition Position.h:57
float GetPositionZ() const
Definition Position.h:123
bool IsPositionValid() const
Definition Position.cpp:183
float GetPositionX() const
Definition Position.h:121
float GetPositionY() const
Definition Position.h:122
void Relocate(float x, float y)
Definition Position.h:77

References _nativeObjectScale, 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, CreatureModel::CreatureDisplayID, DEFAULT_COLLISION_HEIGHT, CreatureModel::DisplayScale, Entry, GetCreatureTemplate(), Map::GetFullTerrainStatusForPosition(), Unit::GetHoverHeight(), WorldObject::GetInstanceId(), WorldObject::GetMap(), Unit::GetNativeDisplayId(), GetNativeObjectScale(), WorldObject::GetPhaseMask(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetScriptId(), GHOST_VISIBILITY_ALIVE, GHOST_VISIBILITY_GHOST, HasFlagsExtra(), Position::IsPositionValid(), Unit::IsSpiritGuide(), Unit::IsSpiritHealer(), Unit::IsTotem(), WorldObject::LastUsedScriptID, LoadCreaturesAddon(), LoadSparringPct(), LOG_ERROR, m_corpseDelay, Position::m_positionZ, WorldObject::m_serverSideVisibility, WorldObject::m_serverSideVisibilityDetect, Unit::ProcessPositionDataChanged(), Position::Relocate(), SERVERSIDE_VISIBILITY_GHOST, Unit::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,
CreatureData const *  data = nullptr 
)
protected
1632{
1633 SetZoneScript();
1634 if (GetZoneScript() && data)
1635 {
1636 uint32 FirstEntry = GetZoneScript()->GetCreatureEntry(guidlow, data);
1637 if (!FirstEntry)
1638 return false;
1639 }
1640
1641 CreatureTemplate const* normalInfo = sObjectMgr->GetCreatureTemplate(Entry);
1642 if (!normalInfo)
1643 {
1644 LOG_ERROR("sql.sql", "Creature::CreateFromProto(): creature template (guidlow: {}, entry: {}) does not exist.", guidlow, Entry);
1645 return false;
1646 }
1647
1649
1650 Object::_Create(guidlow, Entry, (vehId || normalInfo->VehicleId) ? HighGuid::Vehicle : HighGuid::Unit);
1651
1652 // Xinef: select proper vehicle id
1653 if (!vehId)
1654 {
1655 CreatureTemplate const* cinfo = normalInfo;
1656 for (uint8 diff = uint8(GetMap()->GetSpawnMode()); diff > 0 && !IsPet();)
1657 {
1658 // we already have valid Map pointer for current creature!
1659 if (cinfo->DifficultyEntry[diff - 1])
1660 {
1661 cinfo = sObjectMgr->GetCreatureTemplate(normalInfo->DifficultyEntry[diff - 1]);
1662 if (cinfo && cinfo->VehicleId)
1663 break; // template found
1664
1665 // check and reported at startup, so just ignore (restore normalInfo)
1666 cinfo = normalInfo;
1667 }
1668
1669 // for instances heroic to normal, other cases attempt to retrieve previous difficulty
1670 if (diff >= RAID_DIFFICULTY_10MAN_HEROIC && GetMap()->IsRaid())
1671 diff -= 2; // to normal raid difficulty cases
1672 else
1673 --diff;
1674 }
1675
1676 if (cinfo->VehicleId)
1677 CreateVehicleKit(cinfo->VehicleId, (cinfo->VehicleId != normalInfo->VehicleId ? cinfo->Entry : normalInfo->Entry));
1678 }
1679 else
1680 CreateVehicleKit(vehId, Entry);
1681
1682 if (!UpdateEntry(Entry, data))
1683 return false;
1684
1685 return true;
1686}
@ RAID_DIFFICULTY_10MAN_HEROIC
Definition DBCEnums.h:275
HighGuid
Definition ObjectGuid.h:61
bool UpdateEntry(uint32 entry, CreatureData const *data=nullptr, bool changelevel=true, bool updateAI=false)
Definition Creature.cpp:585
void SetOriginalEntry(uint32 entry)
Definition Creature.h:389
bool IsRaid() const
Definition Map.h:301
void _Create(ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
Definition Object.cpp:128
bool CreateVehicleKit(uint32 id, uint32 creatureEntry)
Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
Definition Unit.cpp:14677
void SetZoneScript()
Definition Object.cpp:2438
virtual uint32 GetCreatureEntry(ObjectGuid::LowType, CreatureData const *data)
Definition ZoneScript.h:31
uint32 Entry
Definition CreatureData.h:188
uint32 VehicleId
Definition CreatureData.h:226
uint32 DifficultyEntry[MAX_DIFFICULTY - 1]
Definition CreatureData.h:189

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, Unit, UpdateEntry(), Vehicle, and CreatureTemplate::VehicleId.

Referenced by Create().

◆ DeleteFromDB()

void Creature::DeleteFromDB ( )
virtual

Reimplemented in Pet.

1852{
1853 if (!m_spawnId)
1854 {
1855 LOG_ERROR("entities.unit", "Trying to delete not saved creature: {}", GetGUID().ToString());
1856 return;
1857 }
1858
1860 sObjectMgr->DeleteCreatureData(m_spawnId);
1861
1862 WorldDatabaseTransaction trans = WorldDatabase.BeginTransaction();
1863
1865 stmt->SetData(0, m_spawnId);
1866 trans->Append(stmt);
1867
1868 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE_ADDON);
1869 stmt->SetData(0, m_spawnId);
1870 trans->Append(stmt);
1871
1872 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE_MULTISPAWN);
1873 stmt->SetData(0, m_spawnId);
1874 trans->Append(stmt);
1875
1876 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAME_EVENT_CREATURE);
1877 stmt->SetData(0, m_spawnId);
1878 trans->Append(stmt);
1879
1880 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAME_EVENT_MODEL_EQUIP);
1881 stmt->SetData(0, m_spawnId);
1882 trans->Append(stmt);
1883
1884 WorldDatabase.CommitTransaction(trans);
1885}
SQLTransaction< WorldDatabaseConnection > WorldDatabaseTransaction
Definition DatabaseEnvFwd.h:71
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
Definition DatabaseEnv.cpp:20
@ WORLD_DEL_GAME_EVENT_MODEL_EQUIP
Definition WorldDatabase.h:110
@ WORLD_DEL_CREATURE_MULTISPAWN
Definition WorldDatabase.h:85
@ WORLD_DEL_CREATURE_ADDON
Definition WorldDatabase.h:74
@ WORLD_DEL_GAME_EVENT_CREATURE
Definition WorldDatabase.h:109
@ WORLD_DEL_CREATURE
Definition WorldDatabase.h:84
void RemoveCreatureRespawnTime(ObjectGuid::LowType dbGuid)
Definition Map.cpp:2506
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition PreparedStatement.h:77
Definition PreparedStatement.h:157
std::string ToString() const
Definition Position.cpp:59

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_CREATURE_MULTISPAWN, 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)
2230{
2232
2233 if (respawnDelay < 2s)
2234 {
2235 LOG_WARN("entities.unit", "DespawnOnEvade called with delay of {} seconds, defaulting to 2.", respawnDelay.count());
2236 respawnDelay = 2s;
2237 }
2238
2239 if (TempSummon* whoSummon = ToTempSummon())
2240 {
2242 whoSummon->UnSummon();
2243 return;
2244 }
2245
2246 DespawnOrUnsummon(0ms, respawnDelay);
2247}
#define LOG_WARN(filterType__,...)
Definition Log.h:149
virtual void SummonedCreatureDespawnAll()
Definition CreatureAI.h:157
Position const & GetHomePosition() const
Definition Creature.h:350
void DespawnOrUnsummon(Milliseconds msTimeToDespawn=0ms, Seconds forcedRespawnTimer=0s)
Definition Creature.cpp:2221
void ScheduleCreatureRespawn(ObjectGuid, Milliseconds, Position pos=Position())
Definition Map.cpp:3205
Definition TemporarySummon.h:50
TempSummon * ToTempSummon()
Definition Unit.h:737

References AI(), DespawnOrUnsummon(), Object::GetGUID(), GetHomePosition(), WorldObject::GetMap(), LOG_WARN, Map::ScheduleCreatureRespawn(), CreatureAI::SummonedCreatureDespawnAll(), and Unit::ToTempSummon().

Referenced by npc_akama_illidan::DoAction(), npc_maiev_illidan::DoAction(), boss_jeklik::EnterEvadeMode(), boss_onyxia::EnterEvadeMode(), boss_illidan_stormrage::EnterEvadeMode(), CreatureAI::EnterEvadeMode(), boss_midnight::EnterEvadeMode(), boss_zuljin::EnterEvadeMode(), boss_nightbane::JustReachedHome(), npc_vengeful_spirit::OnCharmed(), and instance_scarlet_monastery::instance_scarlet_monastery_InstanceMapScript::SetData().

◆ DespawnOrUnsummon()

void Creature::DespawnOrUnsummon ( Milliseconds  msTimeToDespawn = 0ms,
Seconds  forcedRespawnTimer = 0s 
)
2222{
2223 if (TempSummon* summon = this->ToTempSummon())
2224 summon->UnSummon(msTimeToDespawn);
2225 else
2226 ForcedDespawn(msTimeToDespawn, forcedRespawnTimer);
2227}
void ForcedDespawn(Milliseconds timeMSToDespawn=0ms, Seconds forcedRespawnTimer=0s)
Definition Creature.cpp:2184

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

Referenced by spell_the_lich_king_shadow_trap_periodic::CheckTargetCount(), npc_simone::npc_simoneAI::CorpseRemoved(), Player::CreatePet(), npc_jenny::DamageTaken(), boss_headless_horseman_head::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), npc_power_spark::DamageTaken(), npc_akama_shade::DamageTaken(), npc_tiger_matriarch::npc_tiger_matriarchAI::DamageTaken(), MotionTransport::DelayedTeleportTransport(), SummonList::DespawnAll(), SummonList::DespawnEntry(), brann_bronzebeard::DespawnHeads(), DespawnOnEvade(), spell_rotface_unstable_ooze_explosion_suicide_aura::DespawnSelf(), Vehicle::Dismiss(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), npc_ulduar_toasty_fire::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::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(), brann_bronzebeard::DoAction(), boss_algalon_the_observer::DoAction(), boss_fathomlord_karathress::DoAction(), npc_herald_of_the_lich_king::DoAction(), boss_infinite_corruptor::boss_infinite_corruptorAI::DoAction(), npc_twilight_summon::DoAction(), npc_living_mojo::npc_living_mojoAI::DoAction(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::DoAction(), npc_spark_of_ionar::DoAction(), npc_molten_golem::DoAction(), boss_thorim_sif::DoAction(), npc_blade_of_azzinoth::DoAction(), boss_hodir::DoHelperVictoryEmotes(), Spell::EffectScriptEffect(), Spell::EffectTameCreature(), npc_plague_cauldron_bunny::EndEvent(), boss_julianne::EnterEvadeMode(), boss_rend_blackhand::EnterEvadeMode(), boss_attumen::EnterEvadeMode(), boss_entropius::EnterEvadeMode(), boss_black_knight::boss_black_knightAI::EnterEvadeMode(), npc_snobold_vassal::npc_snobold_vassalAI::EnterEvadeMode(), npc_phantom_hallucination::EnterEvadeMode(), boss_the_lurker_below::EnterEvadeMode(), boss_harbinger_skyriss::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::EnterEvadeMode(), npc_mistress_of_pain::EnterEvadeMode(), boss_tyrannus::boss_tyrannusAI::EnterEvadeMode(), npc_vampiric_fiend::EnterEvadeMode(), npc_parasitic_shadowfiend::EnterEvadeMode(), boss_ahune::EnterEvadeMode(), boss_nazan::EnterEvadeMode(), boss_vazruden::EnterEvadeMode(), ForcedDespawnDelayEvent::Execute(), VehicleDespawnEvent::Execute(), DelayedCastEvent::Execute(), SuckBackEvent::Execute(), npc_hallows_end_soh::FinishEvent(), spell_gen_despawn_self::HandleDummy(), spell_item_lil_xt::HandleDummy(), spell_q12096_q12092_dummy::HandleDummy(), spell_item_complete_raptor_capture::HandleDummy(), spell_item_rocket_chicken::HandleDummyTick(), spell_mc_play_dead_aura::HandleEffectRemove(), spell_dtk_raise_dead_aura::HandleEffectRemove(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), spell_riding_jokkum::HandleEffectRemove(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_putricide_eat_ooze::HandleScript(), spell_rotface_little_ooze_combine::HandleScript(), spell_rotface_large_ooze_combine::HandleScript(), spell_rotface_large_ooze_buff_combine::HandleScript(), spell_vehicle_grab_pyrite::HandleScript(), spell_shredder_delivery::HandleScript(), spell_ahune_minion_despawner::HandleScript(), spell_q12805_lifeblood_dummy::HandleScript(), spell_q12690_burst_at_the_seams::HandleScript(), spell_illidan_cage_trap::HandleScriptEffect(), spell_winter_veil_racer_slam_hit::HandleScriptEffect(), spell_hawk_hunting::HandleScriptEffect(), spell_q11065_wrangle_some_aether_rays_aura::if(), boss_twilight_corrupter::InitializeAI(), npc_ulduar_rocket_strike_trigger::InitializeAI(), npc_ahune_ice_spear_bunny::InitializeAI(), npc_underbog_mushroom::InitializeAI(), Guardian::InitStatsForLevel(), npc_taldaram_flamesphere::IsSummonedBy(), npc_putricide_oozeAI::IsSummonedBy(), boss_yoggsaron_death_orb::IsSummonedBy(), boss_yoggsaron_death_ray::IsSummonedBy(), npc_ranshalla::npc_ranshallaAI::JustDidDialogueStep(), boss_majordomo::JustDied(), npc_kilrek::JustDied(), boss_dorothee::JustDied(), boss_roar::JustDied(), boss_strawman::JustDied(), boss_tinhead::JustDied(), npc_zulian_prowler::npc_zulian_prowlerAI::JustDied(), npc_chained_spirit::JustDied(), npc_onyxian_whelp::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::JustDied(), npc_mistress_of_pain::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::JustDied(), brann_bronzebeard::JustDied(), npc_ulduar_saronite_animus::JustDied(), boss_yoggsaron_constrictor_tentacle::JustDied(), boss_skadi_grauf::boss_skadi_graufAI::JustDied(), npc_ichor_globule::JustDied(), npc_vh_void_sentry::JustDied(), npc_wintergarde_gryphon::JustDied(), npc_q24545_vegard::npc_q24545_vegardAI::JustDied(), npc_blessed_banner::npc_blessed_bannerAI::JustDied(), boss_fathomguard_sharkkis::JustDied(), boss_fathomguard_tidalvess::JustDied(), boss_fathomguard_caribdis::JustDied(), boss_hydromancer_thespia::JustDied(), npc_necrotic_shard::JustDied(), npc_buru_egg::JustDied(), boss_bug_trio::JustDied(), npc_frost_tomb::JustDied(), npc_lava_spawn::JustEngagedWith(), npc_dirt_mound::JustEngagedWith(), npc_vampiric_fiend::JustEngagedWith(), boss_dorothee::JustReachedHome(), boss_roar::JustReachedHome(), boss_strawman::JustReachedHome(), boss_tinhead::JustReachedHome(), boss_crone::JustReachedHome(), boss_bigbadwolf::JustReachedHome(), boss_julianne::JustReachedHome(), boss_romulo::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::JustSummoned(), boss_kiljaeden::JustSummoned(), npc_medivh_bm::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::JustSummoned(), npc_freya_ward::JustSummoned(), npc_ulduar_vx001::JustSummoned(), npc_tiger_matriarch::npc_tiger_matriarchAI::KilledUnit(), npc_brew_bubble::MoveInLineOfSight(), npc_khunok_the_behemoth::npc_khunok_the_behemothAI::MoveInLineOfSight(), FollowerAI::MovementInform(), npc_brann_bronzebeard_algalon::MovementInform(), npc_spirit_shade::npc_spirit_shadeAI::MovementInform(), npc_forest_frog::MovementInform(), npc_enslaved_netherwing_drake::MovementInform(), npc_koltira_deathweaver::MovementInform(), npc_amanishi_lookout::MovementInform(), npc_troll_volunteer::npc_troll_volunteerAI::MovementInform(), npc_taldaram_flamesphere::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(), brann_bronzebeard::MovementInform(), npc_vehicle_d16_propelled_delivery::npc_vehicle_d16_propelled_deliveryAI::MovementInform(), npc_scarlet_ghoul::MovementInform(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::MovementInform(), npc_shattered_hand_scout::MovementInform(), npc_chained_spirit::MovementInform(), npc_dusk::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::MovementInform(), npc_released_offspring_harkoa::npc_released_offspring_harkoaAI::MovementInform(), boss_flame_leviathan_safety_container::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(), npc_midsummer_bonfire::npc_midsummer_bonfire(), npc_midsummer_bonfire_despawner::npc_midsummer_bonfire_despawner(), npc_midsummer_ribbon_pole_target::npc_midsummer_ribbon_pole_target(), 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_ulduar::instance_ulduar_InstanceMapScript::OnCreatureCreate(), instance_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript::OnCreatureCreate(), go_scourge_enclosure::OnGossipHello(), go_jotunheim_cage::OnGossipHello(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), npc_grandmother::OnGossipSelect(), npc_adventurous_dwarf::OnGossipSelect(), spell_item_eye_of_grillok_aura::OnPeriodic(), spell_dragonblight_devour_ghoul_periodic::OnRemove(), spell_kaelthas_flame_strike::OnRemove(), spell_q12937_relief_for_the_fallen::OnRemove(), npc_valithria_portal::npc_valithria_portalAI::OnSpellClick(), boss_yoggsaron_descend_portal::OnSpellClick(), instance_zulaman::instance_zulaman_InstanceMapScript::OnUnitDeath(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnUnitDeath(), FrostwingGauntletRespawner::operator()(), ValithriaDespawner::operator()(), npc_ulduar_leviathan_mkii::PassengerBoarded(), npc_ulduar_vx001::PassengerBoarded(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::PassengerBoarded(), npc_eoe_wyrmrest_skytalon::PassengerBoarded(), npc_oculus_drake::npc_oculus_drakeAI::PassengerBoarded(), npc_dusk::PassengerBoarded(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::PathEndReached(), npc_ulduar_flames_initial::RemoveAll(), boss_gyth::Reset(), boss_nefarian::Reset(), npc_sanguine_spirit::Reset(), npc_image_of_medivh::npc_image_of_medivhAI::Reset(), npc_demonic_vapor_trail::Reset(), npc_singularity::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::Reset(), boss_freya_lifebinder::Reset(), npc_scrapbot::Reset(), npc_pummeller::Reset(), npc_boombot::Reset(), npc_violet_hold_defense_system::Reset(), npc_target_trigger::Reset(), npc_oscillating_frequency_scanner_master_bunny::npc_oscillating_frequency_scanner_master_bunnyAI::Reset(), npc_simon_bunny::npc_simon_bunnyAI::ResetNode(), npc_snobold_vassal::npc_snobold_vassalAI::ReturnToGormok(), NPCStaveQuestAI::RevealForm(), npc_necrotic_shard::ScheduleTasks(), spell_putricide_ooze_channel::SelectTarget(), instance_scarlet_monastery::instance_scarlet_monastery_InstanceMapScript::SetData(), npc_harrison_jones::SpellHit(), npc_frost_sphere::SpellHit(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::SpellHit(), npc_ulduar_flames_spread::SpellHit(), npc_preparations_for_war_vehicle::SpellHit(), boss_headless_horseman_pumpkin::SpellHit(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), boss_freya::SpellHit(), boss_hodir::SpellHit(), boss_mimiron::SpellHit(), npc_ulduar_keeper::npc_ulduar_keeperAI::SpellHit(), npc_aged_dying_ancient_kodo::SpellHit(), npc_living_constellation::SpellHit(), npc_enslaved_netherwing_drake::SpellHit(), boss_magus_telestra::SpellHit(), boss_thorim::SpellHit(), npc_iron_watcher::npc_iron_watcherAI::SpellHit(), npc_vengeful_shade::npc_vengeful_shadeAI::SpellHitTarget(), npc_necropolis_relay::SpellHitTarget(), boss_headless_horseman_head::SpellHitTarget(), npc_necropolis_proxy::SpellHitTarget(), npc_necrotic_shard::SpellHitTarget(), npc_q24545_lich_king::npc_q24545_lich_kingAI::SpellHitTarget(), npc_necropolis_health::SpellHitTarget(), boss_ouro::Submerge(), npc_time_rift::SummonedCreatureDies(), boss_hazzarah::SummonedCreatureDies(), boss_novos::SummonedCreatureDies(), npc_creature_generator_akama::SummonedCreatureDies(), boss_vexallus::SummonedCreatureDies(), boss_hydross_the_unstable::SummonMovementInform(), boss_razorgore::SummonMovementInform(), VehicleAI::UpdateAI(), npc_escortAI::UpdateAI(), npc_vaelastrasz_the_red::UpdateAI(), boss_victor_nefarius::UpdateAI(), npc_kernobee::npc_kernobeeAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_highlord_darion_mograine::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_draenei_survivor::npc_draenei_survivorAI::UpdateAI(), npc_stillpine_capitive::npc_stillpine_capitiveAI::UpdateAI(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::UpdateAI(), npc_giant_spotlight::npc_giant_spotlightAI::UpdateAI(), npc_sergeant_bly::npc_sergeant_blyAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), npc_fos_corrupted_soul_fragment::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_power_spark::UpdateAI(), npc_oculus_drake::npc_oculus_drakeAI::UpdateAI(), boss_algalon_the_observer::UpdateAI(), boss_flame_leviathan_seat::UpdateAI(), npc_thorims_hammer::UpdateAI(), boss_freya_healthy_spore::UpdateAI(), boss_freya_summons::UpdateAI(), boss_freya_nature_bomb::UpdateAI(), npc_ulduar_flash_freeze::UpdateAI(), npc_ulduar_hodir_priest::UpdateAI(), npc_ulduar_hodir_druid::UpdateAI(), npc_ulduar_hodir_shaman::UpdateAI(), npc_ulduar_hodir_mage::UpdateAI(), boss_mimiron::UpdateAI(), npc_ulduar_proximity_mine::UpdateAI(), npc_ulduar_bot_summon_trigger::UpdateAI(), npc_ulduar_flames_initial::UpdateAI(), boss_thorim_sif::UpdateAI(), npc_ichor_globule::UpdateAI(), npc_vh_teleportation_portal::UpdateAI(), npc_azure_saboteur::UpdateAI(), npc_lurgglbr::npc_lurgglbrAI::UpdateAI(), npc_minigob_manabonk::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_crusade_recruit::npc_crusade_recruitAI::UpdateAI(), npc_fel_guard_hound::npc_fel_guard_houndAI::UpdateAI(), npc_pet_dk_ebon_gargoyle::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(), FollowerAI::UpdateAI(), npc_dark_fiend::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::UpdateFollow(), npc_jenny::UpdateFollowerAI(), SmartAI::UpdatePath(), npc_daphne_stilwell::npc_daphne_stilwellAI::WaypointReached(), and npc_plaguehound_tracker::npc_plaguehound_trackerAI::WaypointReached().

◆ DisappearAndDie()

void Creature::DisappearAndDie ( )
367{
369 //SetVisibility(VISIBILITY_OFF);
370 //ObjectAccessor::UpdateObjectVisibility(this);
371 if (IsAlive())
373 RemoveCorpse(false, true);
374}
void setDeathState(DeathState s, bool despawn=false) override
A creature can be in 4 different states: Alive, JustDied, Corpse, and JustRespawned....
Definition Creature.cpp:1972
void RemoveCorpse(bool setSpawnTime=true, bool skipVisibility=false)
Definition Creature.cpp:423
void DestroyForVisiblePlayers()
Definition Object.cpp:3062

References WorldObject::DestroyForVisiblePlayers(), Unit::IsAlive(), JustDied, RemoveCorpse(), and setDeathState().

Referenced by npc_swarm_scarab::DoAction(), 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(), instance_blackrock_spire::OnCreatureCreate(), go_ulduar_tower::OnDestroyed(), go_dragonflayer_cage::OnGossipHello(), npc_valkyr_battle_maiden::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 ( )
1089{
1090 if (!GetVictim())
1091 return;
1092
1094 return;
1095
1096 float radius = sWorld->getFloatConfig(CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS);
1097 if (radius > 0)
1098 {
1099 Creature* creature = nullptr;
1100
1103
1104 Cell::VisitObjects(this, searcher, radius);
1105
1107 UpdateSpeed(MOVE_RUN, false);
1108
1109 if (!creature)
1110 //SetFeared(true, GetVictim()->GetGUID(), 0, sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY));
1111 //TODO: use 31365
1113 else
1114 GetMotionMaster()->MoveSeekAssistance(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ());
1115 }
1116}
@ UNIT_STATE_FLEEING
Definition UnitDefines.h:180
@ CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS
Definition WorldConfig.h:161
void SetNoSearchAssistance(bool val)
Definition Creature.h:274
void MoveSeekAssistance(float x, float y, float z)
Definition MotionMaster.cpp:861
bool HasPreventsFleeingAura() const
Definition Unit.h:1824
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition Unit.cpp:13985
Definition GridNotifiers.h:481

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

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

◆ DoImmediateBoundaryCheck()

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

References m_boundaryCheckTime.

Referenced by CreatureAI::SetBoundary().

◆ FocusTarget()

void Creature::FocusTarget ( Spell const *  focusSpell,
WorldObject const *  target 
)
3625{
3626 // already focused
3627 if (_focusSpell)
3628 return;
3629
3630 _focusSpell = focusSpell;
3632
3633 SetGuidValue(UNIT_FIELD_TARGET, this == target ? ObjectGuid::Empty : target->GetGUID());
3634 if (focusSpell->GetSpellInfo()->HasAttribute(SPELL_ATTR5_AI_DOESNT_FACE_TARGET))
3636
3637 // Set serverside orientation if needed (needs to be after attribute check)
3638 if (this == target && (movespline->Finalized() || GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE))
3640 else
3641 SetInFront(target);
3642}
@ CHASE_MOTION_TYPE
Definition MotionMaster.h:45
@ SPELL_ATTR5_AI_DOESNT_FACE_TARGET
Definition SharedDefines.h:574
@ UNIT_STATE_ROTATING
Definition UnitDefines.h:193
@ UNIT_FIELD_TARGET
Definition UpdateFields.h:92
ObjectGuid _spellFocusTarget
‍Locks the target during spell cast for proper facing
Definition Creature.h:554
bool Finalized() const
Definition MoveSpline.h:118
static ObjectGuid const Empty
Definition ObjectGuid.h:123
void SetGuidValue(uint16 index, ObjectGuid value)
Definition Object.cpp:721
ObjectGuid GetGuidValue(uint16 index) const
Definition Object.cpp:335
void SetFacingTo(float ori)
Definition Unit.cpp:16157
Movement::MoveSpline * movespline
Definition Unit.h:2135
void SetInFront(WorldObject const *target)
Definition Unit.cpp:16151
float GetOrientation() const
Definition Position.h:124

References _focusSpell, _spellFocusTarget, Unit::AddUnitState(), CHASE_MOTION_TYPE, ObjectGuid::Empty, Movement::MoveSpline::Finalized(), Object::GetGUID(), Object::GetGuidValue(), 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 ( Milliseconds  timeMSToDespawn = 0ms,
Seconds  forcedRespawnTimer = 0s 
)
private
2185{
2186 if (timeMSToDespawn > 0ms)
2187 {
2188 ForcedDespawnDelayEvent* pEvent = new ForcedDespawnDelayEvent(*this, forceRespawnTimer);
2189 m_Events.AddEventAtOffset(pEvent, timeMSToDespawn);
2190 return;
2191 }
2192
2193 // Override respawn delay BEFORE setDeathState, because setDeathState(JustDied)
2194 // computes m_respawnTime = now + m_respawnDelay + m_corpseDelay and immediately
2195 // saves it to DB for bosses/elites. We must have the correct delay in place
2196 // before that happens.
2197 if (forceRespawnTimer > 0s)
2198 m_respawnDelay = forceRespawnTimer.count();
2199
2200 bool const wasAlive = IsAlive();
2201
2202 if (wasAlive)
2204
2205 // Xinef: Set new respawn time, ignore corpse decay time...
2206 // setDeathState(JustDied) folds m_corpseDelay into m_respawnTime, but a creature
2207 // despawned while alive never leaves a corpse, so the decay must not be charged.
2208 // Recompute so RemoveCorpse's max() has nothing stale to pick up.
2209 if (forceRespawnTimer > 0s || wasAlive)
2211
2212 RemoveCorpse(true);
2213
2214 // In compat mode the creature stays in the world as a dead body and needs
2215 // an event-based kick to call Respawn() after the timer expires.
2216 if (forceRespawnTimer > 0s && _respawnCompatibilityMode)
2217 if (GetMap())
2218 GetMap()->ScheduleCreatureRespawn(GetGUID(), forceRespawnTimer);
2219}
bool _respawnCompatibilityMode
Definition Creature.h:474
Definition Creature.h:587

References _respawnCompatibilityMode, EventProcessor::AddEventAtOffset(), GameTime::GetGameTime(), Object::GetGUID(), WorldObject::GetMap(), Unit::IsAlive(), JustDied, WorldObject::m_Events, m_respawnDelay, m_respawnTime, RemoveCorpse(), Map::ScheduleCreatureRespawn(), and setDeathState().

Referenced by DespawnOrUnsummon().

◆ GetAggroRange()

float Creature::GetAggroRange ( Unit const *  target) const
3476{
3477 // Determines the aggro range for creatures
3478 // Based on data from wowwiki due to lack of 3.3.5a data
3479
3480 float aggroRate = sWorld->getRate(RATE_CREATURE_AGGRO);
3481 if (aggroRate == 0)
3482 return 0.0f;
3483
3484 auto creatureLevel = target->getLevelForTarget(this);
3485 auto playerLevel = getLevelForTarget(target);
3486 int32 levelDiff = int32(creatureLevel) - int32(playerLevel);
3487
3488 // The maximum Aggro Radius is capped at 45 yards (25 level difference)
3489 if (levelDiff < -25)
3490 levelDiff = -25;
3491
3492 // The base aggro radius for mob of same level
3493 auto aggroRadius = GetDetectionRange();
3494 if (aggroRadius < 1)
3495 {
3496 return 0.0f;
3497 }
3498 // Aggro Radius varies with level difference at a rate of roughly 1 yard/level
3499 aggroRadius -= (float)levelDiff;
3500
3501 // detect range auras
3503
3504 // detected range auras
3505 aggroRadius += target->GetTotalAuraModifier(SPELL_AURA_MOD_DETECTED_RANGE);
3506
3507 // Just in case, we don't want pets running all over the map
3508 if (aggroRadius > MAX_AGGRO_RADIUS)
3509 aggroRadius = MAX_AGGRO_RADIUS;
3510
3511 // Minimum Aggro Radius for a mob seems to be combat range (5 yards)
3512 // hunter pets seem to ignore minimum aggro radius so we'll default it a little higher
3513 float minRange = IsPet() ? 10.0f : 5.0f;
3514 if (aggroRadius < minRange)
3515 aggroRadius = minRange;
3516
3517 return (aggroRadius * aggroRate);
3518}
@ SPELL_AURA_MOD_DETECTED_RANGE
Definition SpellAuraDefines.h:215
@ SPELL_AURA_MOD_DETECT_RANGE
Definition SpellAuraDefines.h:154
#define MAX_AGGRO_RADIUS
Definition Unit.h:45
@ RATE_CREATURE_AGGRO
Definition WorldConfig.h:478
float GetDetectionRange() const
Definition Creature.h:262
uint8 getLevelForTarget(WorldObject const *target) const override
Definition Creature.cpp:3226
int32 GetTotalAuraModifier(AuraType auratype) const
Definition Unit.cpp:6086

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(), npc_amanishi_lookout::MoveInLineOfSight(), and npc_eagle_trash_aggro_trigger::MoveInLineOfSight().

◆ GetAIName()

std::string const & Creature::GetAIName ( ) const

◆ GetAttackDistance()

float Creature::GetAttackDistance ( Unit const *  player) const
3669{
3670 float aggroRate = sWorld->getRate(RATE_CREATURE_AGGRO);
3671
3672 if (aggroRate == 0)
3673 return 0.0f;
3674
3675 if (!player)
3676 return 0.0f;
3677
3678 uint32 playerLevel = player->getLevelForTarget(this);
3679 uint32 creatureLevel = getLevelForTarget(player);
3680
3681 int32 levelDiff = static_cast<int32>(playerLevel) - static_cast<int32>(creatureLevel);
3682
3683 // "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."
3684 if (levelDiff < -25)
3685 levelDiff = -25;
3686
3687 // "The aggro radius of a mob having the same level as the player is roughly 20 yards"
3688 float retDistance = 20.0f;
3689
3690 // "Aggro Radius varies with level difference at a rate of roughly 1 yard/level"
3691 // radius grow if playlevel < creaturelevel
3692 retDistance -= static_cast<float>(levelDiff);
3693
3694 if (creatureLevel + 5 <= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
3695 {
3696 // detect range auras
3697 retDistance += static_cast<float>( GetTotalAuraModifier(SPELL_AURA_MOD_DETECT_RANGE));
3698
3699 // detected range auras
3700 retDistance += static_cast<float>( player->GetTotalAuraModifier(SPELL_AURA_MOD_DETECTED_RANGE));
3701 }
3702
3703 // "Minimum Aggro Radius for a mob seems to be combat range (5 yards)"
3704 if (retDistance < 5.0f)
3705 retDistance = 5.0f;
3706
3707 return (retDistance * aggroRate);
3708}
@ CONFIG_MAX_PLAYER_LEVEL
Definition WorldConfig.h:195

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(), npc_hadronox_crusherPackAI::MoveInLineOfSight(), and npc_pet_hunter_snake_trap::UpdateAI().

◆ GetCannotReachTarget()

ObjectGuid const & Creature::GetCannotReachTarget ( ) const
inline
341{ return m_cannotReachTarget; }

References m_cannotReachTarget.

Referenced by UnitAI::EvadeTimerExpired().

◆ GetCombatPulseDelay()

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

References m_combatPulseDelay.

◆ GetCorpseDelay()

◆ GetCreatureAddon()

CreatureAddon const * Creature::GetCreatureAddon ( ) const
2766{
2767 if (m_spawnId)
2768 {
2769 if (CreatureAddon const* addon = sObjectMgr->GetCreatureAddon(m_spawnId))
2770 return addon;
2771 }
2772
2773 // dependent from difficulty mode entry
2774 return sObjectMgr->GetCreatureTemplateAddon(GetCreatureTemplate()->Entry);
2775}
Definition CreatureData.h:431

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
207{ return m_creatureInfo; }

References m_creatureInfo.

Referenced by KillRewarder::_InitXP(), Unit::_IsValidAttackTarget(), AllLootRemovedFromCorpse(), Vehicle::ApplyAllImmunities(), npc_escortAI::AssistPlayerInCombatAgainst(), FollowerAI::AssistPlayerInCombatAgainst(), SmartAI::AssistPlayerInCombatAgainst(), AtDisengage(), AtEngage(), Player::BuildPetTalentsInfoData(), CalculateMinMaxDamage(), SpellEffectInfo::CalcValue(), Spell::CheckCast(), SpellInfo::CheckTarget(), Create(), Pet::CreateBaseAtCreature(), Unit::DealMeleeDamage(), boss_high_king_maulgar::DoAction(), ScriptedAI::DoRewardPlayersInArea(), Spell::DoSpellHitOnUnit(), Spell::EffectForceDeselect(), Spell::EffectSanctuary(), Spell::EffectSkinning(), Spell::EffectSummonType(), Acore::XP::Gain(), GetCreatureAddon(), Unit::GetCreatureType(), GetGossipMenuId(), GetLeashTimer(), GetMovementTemplate(), Pet::GetNativeObjectScale(), Player::GetNPCIfCanInteractWith(), SmartScript::GetScript(), AuraEffect::HandleFeignDeath(), learn_commandscript::HandleLearnAllMyPetTalentsCommand(), npc_commandscript::HandleNpcInfoCommandShowCreature(), npc_commandscript::HandleNpcSetFactionIdCommand(), npc_commandscript::HandleNpcTameCommand(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), HasFlagsExtra(), Pet::HaveInDiet(), InitEntry(), Pet::InitLevelupSpellsForLevel(), Guardian::InitStatsForLevel(), isElite(), IsImmunedToSpellEffect(), Unit::IsInPartyWith(), Unit::IsInRaidWith(), Pet::IsPermanentPetFor(), IsRacialLeader(), isWorldBoss(), npc_escortAI::JustRespawned(), FollowerAI::JustRespawned(), SmartAI::JustRespawned(), Unit::Kill(), Pet::LearnPetPassives(), Player::LearnPetTalent(), LoadCreatureFromDB(), Pet::LoadPetFromDB(), Unit::MeleeSpellHitResult(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_hor_leader_second::npc_hor_leader_secondAI::MoveToNextStopPoint(), spell_item_mind_amplify_dish::OnDummyEffect(), npc_zulaman_hostage::OnGossipHello(), npc_thrall_old_hillsbrad::OnGossipHello(), npc_artorius::OnGossipHello(), npc_simone::OnGossipHello(), npc_nelson::OnGossipHello(), npc_franklin::OnGossipHello(), npc_taxi::OnGossipHello(), Unit::PatchValuesUpdate(), Player::PetSpellInitialize(), Unit::RemoveCharmedBy(), Player::RemovePet(), boss_sindragosa::boss_sindragosaAI::Reset(), Pet::resetTalents(), Respawn(), Player::RewardReputation(), SaveToDB(), SelectLevel(), Player::SendLoot(), WorldSession::SendPetNameQuery(), Unit::SetCharmedBy(), setDeathState(), SetDisplayFromModel(), npc_tirion_fordring_tft::npc_tirion_fordringAI::sGossipSelect(), npc_harrison_jones::sGossipSelect(), boss_priestess_delrissa::SummonedCreatureDies(), Player::SummonPet(), npc_hor_lich_king::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_sinkhole_kill_credit::npc_sinkhole_kill_creditAI::UpdateAI(), npc_pet_gen_valkyr_guardian::UpdateAI(), UpdateEntry(), GameEventMgr::UpdateEventNPCFlags(), UpdateMovementFlags(), and Unit::UpdateSpeed().

◆ GetCurrentEquipmentId()

uint8 Creature::GetCurrentEquipmentId ( )
inline

◆ GetCurrentWaypointID()

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

References m_waypointID.

Referenced by npc_akama_illidan::MovementInform().

◆ GetCurrentWaypointInfo()

std::pair< uint32, uint32 > Creature::GetCurrentWaypointInfo ( ) const
inline
364{ return _currentWaypointNodeInfo; }
std::pair< uint32, uint32 > _currentWaypointNodeInfo
Definition Creature.h:541

References _currentWaypointNodeInfo.

◆ GetDebugInfo()

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

Reimplemented from Object.

Reimplemented in TempSummon, Minion, Guardian, and Pet.

3987{
3988 std::stringstream sstr;
3989 sstr << Unit::GetDebugInfo() << "\n"
3990 << "AIName: " << GetAIName() << " ScriptName: " << GetScriptName()
3991 << " WaypointPath: " << GetWaypointPath() << " SpawnId: " << GetSpawnId();
3992 return sstr.str();
3993}
uint32 GetWaypointPath() const
Definition Creature.h:357
ObjectGuid::LowType GetSpawnId() const
Definition Creature.h:68
std::string GetScriptName() const
Definition Creature.cpp:3244
std::string const & GetAIName() const
Definition Creature.cpp:3239
std::string GetDebugInfo() const override
Definition Unit.cpp:17092

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

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

◆ GetDefaultMovementType()

MovementGeneratorType Creature::GetDefaultMovementType ( ) const
inlineoverridevirtual

◆ GetDetectionRange()

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

References m_detectionDistance.

Referenced by GetAggroRange().

◆ GetFormation() [1/2]

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

References m_formation.

◆ GetFormation() [2/2]

◆ GetGossipMenuId()

◆ GetHighestPlayerAttackerLevel()

uint8 Creature::GetHighestPlayerAttackerLevel ( ) const
inline

◆ GetHomePosition() [1/2]

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

References m_homePosition.

Referenced by DespawnOnEvade(), and GetRespawnPosition().

◆ GetHomePosition() [2/2]

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

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::CanAIAttack(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::CanAIAttack(), boss_halion::boss_halionAI::CanAIAttack(), boss_midnight::CanMeleeHit(), boss_anomalus::CheckEvadeIfOutOfCombatArea(), boss_gurtogg_bloodboil::CheckEvadeIfOutOfCombatArea(), boss_lady_vashj::CheckEvadeIfOutOfCombatArea(), boss_priestess_delrissa::CheckInRoom(), boss_sacrolash::CheckInRoom(), boss_kalecgos::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(), boss_taldaram::DoAction(), 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(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::DoAction(), npc_hor_spiritual_reflection::EnterEvadeMode(), boss_professor_putricide::boss_professor_putricideAI::EnterEvadeMode(), boss_yoggsaron_sara::EnterEvadeMode(), UtherBatteredHiltEvent::Execute(), boss_kaelthas::ExecuteMiddleEvent(), 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(), npc_expedition_engineer::IsEast(), boss_loatheb::boss_loathebAI::IsInRoom(), boss_algalon_the_observer::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_balinda::JustEngagedWith(), boss_the_black_stalker::JustEngagedWith(), 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_zuljin::MovementInform(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::MovementInform(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::MovementInform(), npc_saurfang_event::npc_saurfang_eventAI::MovementInform(), boss_lady_vashj::MovementInform(), npc_dragonflayer_forge_master::npc_dragonflayer_forge_master(), 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(), npc_phalanx::PathEndReached(), spell_halion_twilight_phasing::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_lady_vashj::Reset(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::RestoreSaurfangEventNpc(), SmartAI::ReturnToLastOOCPos(), npc_escortAI::ReturnToLastPoint(), 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_drekthar::boss_drektharAI::UpdateAI(), boss_galvangar::boss_galvangarAI::UpdateAI(), boss_vanndar::boss_vanndarAI::UpdateAI(), npc_blackhand_incarcerator::UpdateAI(), boss_broodlord::UpdateAI(), npc_alexstraza_the_lifebinder::UpdateAI(), boss_elder_nadox::UpdateAI(), boss_frostsworn_general::UpdateAI(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::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::UpdateAI(), npc_bloodmage_laurith::npc_bloodmage_laurithAI::UpdateAI(), and CreatureAI::VisualizeBoundary().

◆ GetLastLeashExtensionTime()

time_t Creature::GetLastLeashExtensionTime ( ) const
3779{
3781}
std::shared_ptr< time_t > const & GetLastLeashExtensionTimePtr() const
Definition Creature.cpp:3761

References GetLastLeashExtensionTimePtr().

Referenced by CanCreatureAttack().

◆ GetLastLeashExtensionTimePtr()

std::shared_ptr< time_t > const & Creature::GetLastLeashExtensionTimePtr ( ) const

◆ GetLeashTimer()

uint8 Creature::GetLeashTimer ( ) const
3789{ // Based on testing on Classic, seems to range from ~11s for low level mobs (1-5) to ~16s for high level mobs (70+)
3790 uint8 timerOffset = 11;
3791
3792 uint8 timerModifier = uint8(GetCreatureTemplate()->minlevel / 10) - 2;
3793
3794 // Formula is likely not quite correct, but better than flat timer
3795 return std::max<uint8>(timerOffset, timerOffset + timerModifier);
3796}

References GetCreatureTemplate().

Referenced by CanCreatureAttack().

◆ getLevelForTarget()

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

Reimplemented from WorldObject.

3227{
3228 if (!isWorldBoss() || !target->ToUnit())
3229 return Unit::getLevelForTarget(target);
3230
3231 uint16 level = target->ToUnit()->GetLevel() + sWorld->getIntConfig(CONFIG_WORLD_BOSS_LEVEL_DIFF);
3232 if (level < 1)
3233 return 1;
3234 if (level > 255)
3235 return 255;
3236 return uint8(level);
3237}
std::uint16_t uint16
Definition Define.h:108
@ CONFIG_WORLD_BOSS_LEVEL_DIFF
Definition WorldConfig.h:245
uint8 getLevelForTarget(WorldObject const *) const override
Definition Unit.h:1118

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
1317{
1319 return nullptr;
1320 return sGroupMgr->GetGroupByGUID(m_lootRecipientGroup);
1321}
#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.

162{ return m_meleeDamageSchoolMask; }

References m_meleeDamageSchoolMask.

Referenced by ThreatReference::ShouldBeSuppressed().

◆ GetMovementTemplate()

CreatureMovementData const & Creature::GetMovementTemplate ( ) const
3170{
3171 if (CreatureMovementData const* movementOverride = sObjectMgr->GetCreatureMovementOverride(m_spawnId))
3172 return *movementOverride;
3173
3174 return GetCreatureTemplate()->Movement;
3175}
Definition CreatureData.h:120
CreatureMovementData Movement
Definition CreatureData.h:231

References GetCreatureTemplate(), m_spawnId, CreatureTemplate::Movement, and sObjectMgr.

Referenced by RandomMovementGenerator< T >::_setRandomLocation(), CanEnterWater(), CanFly(), CanHover(), CanWalk(), ChaseMovementGenerator< T >::DoUpdate(), IsRooted(), PauseMovementForInteraction(), and UpdateMovementFlags().

◆ GetNameForLocaleIdx()

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

Reimplemented from WorldObject.

3351{
3352 if (loc_idx != DEFAULT_LOCALE)
3353 {
3354 uint8 uloc_idx = uint8(loc_idx);
3355 CreatureLocale const* cl = sObjectMgr->GetCreatureLocale(GetEntry());
3356 if (cl)
3357 {
3358 if (cl->Name.size() > uloc_idx && !cl->Name[uloc_idx].empty())
3359 return cl->Name[uloc_idx];
3360 }
3361 }
3362
3363 return GetName();
3364}
#define DEFAULT_LOCALE
Definition Common.h:140
std::string const & GetName() const
Definition Object.h:535
Definition CreatureData.h:343
std::vector< std::string > Name
Definition CreatureData.h:344

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, and TestCreature.

3587{
3588 return _nativeObjectScale;
3589}

References _nativeObjectScale.

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

◆ GetOriginalEntry()

uint32 Creature::GetOriginalEntry ( ) const
inline

◆ GetOriginalEquipmentId()

int8 Creature::GetOriginalEquipmentId ( ) const
inline

◆ GetPetAutoSpellOnPos()

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

Reimplemented in Pet.

332 {
334 return 0;
335 else
336 return m_charmInfo->GetCharmSpell(pos)->GetAction();
337 }
#define MAX_SPELL_CHARM
Definition CharmInfo.h:24
@ ACT_ENABLED
Definition CharmInfo.h:63
CharmInfo * m_charmInfo
Definition Unit.h:2212
CharmSpellInfo * GetCharmSpell(uint8 index)
Definition CharmInfo.h:158
ActiveStates GetType() const
Definition CharmInfo.h:101
uint32 GetAction() const
Definition CharmInfo.h:102

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.

330{ return MAX_SPELL_CHARM; }

References MAX_SPELL_CHARM.

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

◆ GetPlayerDamageReq()

uint32 Creature::GetPlayerDamageReq ( ) const
3950{
3951 return _playerDamageReq;
3952}

References _playerDamageReq.

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

◆ GetRandomId()

uint32 Creature::GetRandomId ( uint32  id1,
uint32  id2,
uint32  id3 
)
3816{
3817 uint32 id = id1;
3818 uint8 ids = 0;
3819
3820 if (id2)
3821 {
3822 ++ids;
3823 if (id3) ++ids;
3824 }
3825
3826 if (ids)
3827 {
3828 uint8 idNumber = urand(0, ids);
3829 switch (idNumber)
3830 {
3831 case 0:
3832 id = id1;
3833 break;
3834 case 1:
3835 id = id2;
3836 break;
3837 case 2:
3838 id = id3;
3839 break;
3840 }
3841 }
3842 return id;
3843}
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:44

References urand().

Referenced by LoadCreatureFromDB(), and Respawn().

◆ GetReactState()

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

References m_reactState.

Referenced by boss_shade_of_aran::AttackStart(), boss_alythess::AttackStart(), boss_kiljaeden::AttackStart(), boss_icehowl::boss_icehowlAI::AttackStart(), boss_the_lurker_below::AttackStart(), npc_capernian::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(), boss_renataki::boss_renatakiAI::CanAlwaysBeDetectable(), boss_renataki::boss_renatakiAI::CanBeSeen(), boss_renataki::boss_renatakiAI::CanSeeAlways(), CharmInfo::CharmInfo(), Player::CharmSpellInitialize(), npc_ulduar_leviathan_mkii::DamageTaken(), npc_ulduar_vx001::DamageTaken(), boss_shade_of_aran::DamageTaken(), boss_kiljaeden::EnterEvadeMode(), Pet::FillPetInfo(), boss_ick::boss_ickAI::KilledUnit(), npc_chesspiece::OnCharmed(), npc_scarlet_ghoul::OwnerAttackedBy(), Player::PetSpellInitialize(), npc_imprisoned_beryl_sorcerer::npc_imprisoned_beryl_sorcererAI::Reset(), Pet::SavePetToDB(), boss_kiljaeden::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), boss_viscidus::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::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::UpdateAI(), npc_auriaya_feral_defender::UpdateAI(), boss_lady_vashj::UpdateAI(), boss_leotheras_the_blind::UpdateAI(), boss_the_lurker_below::UpdateAI(), npc_gunship_rocketeer::npc_gunship_rocketeerAI::UpdateAI(), InstanceScript::UpdateMinionState(), and Player::VehicleSpellInitialize().

◆ GetRespawnDelay()

◆ GetRespawnPosition()

void Creature::GetRespawnPosition ( float &  x,
float &  y,
float &  z,
float *  ori = nullptr,
float *  dist = nullptr 
) const
3130{
3131 if (m_spawnId)
3132 {
3133 if (CreatureData const* data = sObjectMgr->GetCreatureData(m_spawnId))
3134 {
3135 x = data->posX;
3136 y = data->posY;
3137 z = data->posZ;
3138 if (ori)
3139 *ori = data->orientation;
3140 if (dist)
3141 *dist = data->wander_distance;
3142
3143 return;
3144 }
3145 }
3146
3147 // xinef: changed this from current position to home position, fixes world summons with infinite duration
3148 if (GetTransport())
3149 {
3150 x = GetPositionX();
3151 y = GetPositionY();
3152 z = GetPositionZ();
3153 if (ori)
3154 *ori = GetOrientation();
3155 }
3156 else
3157 {
3159 x = homePos.GetPositionX();
3160 y = homePos.GetPositionY();
3161 z = homePos.GetPositionZ();
3162 if (ori)
3163 *ori = homePos.GetOrientation();
3164 }
3165 if (dist)
3166 *dist = 0;
3167}
Position const homePos
Definition boss_chromaggus.cpp:71
Transport * GetTransport() const
Definition Object.h:701
Definition CreatureData.h:370
Definition Position.h:27

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

Referenced by SmartScript::ProcessAction(), RemoveCorpse(), npc_rocknot::StartAleEvent(), and npc_escortAI::UpdateAI().

◆ GetRespawnTime()

time_t const & Creature::GetRespawnTime ( ) const
inline

◆ GetRespawnTimeEx()

time_t Creature::GetRespawnTimeEx ( ) const
3120{
3121 time_t now = GameTime::GetGameTime().count();
3122
3123 if (m_respawnTime > now)
3124 return m_respawnTime;
3125 else
3126 return now;
3127}

References GameTime::GetGameTime(), and m_respawnTime.

Referenced by npc_commandscript::HandleNpcInfoCommandShowCreature().

◆ GetScriptId()

uint32 Creature::GetScriptId ( ) const
3250{
3251 uint32 const entry = GetEntry();
3252
3253 // Cache the resolved id per entry. Re-resolve whenever the entry changes - InitEntry(),
3254 // UpdateEntry(), or a bare SetEntry() done by transform / entry-swap scripts.
3255 if (entry && CachedScriptIdEntry == entry)
3256 return CachedScriptId;
3257
3258 uint32 scriptId = 0;
3260 if (creatureData->ScriptId && entry == creatureData->id)
3261 scriptId = creatureData->ScriptId;
3262
3263 if (!scriptId)
3264 if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(entry))
3265 scriptId = cInfo->ScriptID;
3266
3267 CachedScriptId = scriptId;
3268 CachedScriptIdEntry = entry;
3269 return scriptId;
3270}
uint32 CachedScriptIdEntry
Definition Creature.h:522
CreatureData const * GetCreatureData() const
Definition Creature.h:208
uint32 CachedScriptId
Definition Creature.h:521
ObjectData const creatureData[]
Definition instance_blackwing_lair.cpp:45

References CachedScriptId, CachedScriptIdEntry, creatureData, GetCreatureData(), Object::GetEntry(), and sObjectMgr.

Referenced by Create(), ScriptMgr::GetCreatureAI(), ScriptMgr::GetDialogStatus(), GetScriptName(), WorldSession::HandleGossipSelectOptionOpcode(), InitializeReactState(), ScriptMgr::OnAddPassenger(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), ScriptMgr::OnCreatureUpdate(), ScriptMgr::OnGossipHello(), ScriptMgr::OnGossipSelect(), ScriptMgr::OnGossipSelectCode(), ScriptMgr::OnInstall(), ScriptMgr::OnInstallAccessory(), ScriptMgr::OnQuestAccept(), ScriptMgr::OnQuestComplete(), ScriptMgr::OnQuestReward(), ScriptMgr::OnQuestSelect(), ScriptMgr::OnRemovePassenger(), ScriptMgr::OnReset(), ScriptMgr::OnUninstall(), and UpdateMoveInLineOfSightState().

◆ GetScriptName()

std::string Creature::GetScriptName ( ) const

◆ GetShieldBlockValue()

uint32 Creature::GetShieldBlockValue ( ) const
inlineoverridevirtual

Implements Unit.

158 {
159 return (GetLevel() / 2 + uint32(GetStat(STAT_STRENGTH) / 20));
160 }
@ STAT_STRENGTH
Definition SharedDefines.h:246
float GetStat(Stats stat) const
Definition Unit.h:1072

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

◆ GetSparringPct()

float Creature::GetSparringPct ( ) const
inline
192{ return _sparringPct; }

References _sparringPct.

Referenced by Unit::DealDamage().

◆ GetSpawnId()

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

References m_spawnId.

Referenced by BattlegroundAV::AddAVCreature(), CreatureGroup::AddMember(), Vehicle::ApplyAllImmunities(), OPvPCapturePointZM_Graveyard::CanTalkTo(), boss_ghazan::DoAction(), RandomMovementGenerator< T >::DoInitialize(), GetDebugInfo(), CreatureGroup::GetNewTargetForMember(), GameEventMgr::GetNPCFlag(), SmartScript::GetScript(), WorldSession::HandleAuctionSellItem(), debug_commandscript::HandleDebugCombatListCommand(), debug_commandscript::HandleDebugGetLootRecipientCommand(), debug_commandscript::HandleDebugThreatListCommand(), OPvPCapturePointZM_Graveyard::HandleGossipOption(), npc_commandscript::HandleNpcAddCommand(), npc_commandscript::HandleNpcAddFormationCommand(), npc_commandscript::HandleNpcGuidCommand(), npc_commandscript::HandleNpcInfoCommandShowCreature(), npc_commandscript::HandleNpcMoveCommand(), npc_commandscript::HandleNpcSetLinkCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetSpawnTimeCommand(), npc_commandscript::HandleNpcSetWanderDistanceCommand(), pool_commandscript::HandlePoolLookupCommand(), 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(), DarkFallenAI::JustDied(), npc_spinestalker::npc_spinestalkerAI::JustRespawned(), npc_rimefang::npc_rimefangAI::JustRespawned(), npc_sindragosa_trash::npc_sindragosa_trashAI::JustRespawned(), LoadSparringPct(), CreatureGroup::MemberEngagingTarget(), CreatureGroup::MemberEvaded(), instance_stratholme::instance_stratholme_InstanceMapScript::OnCreatureCreate(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnCreatureCreate(), instance_temple_of_ahnqiraj::instance_temple_of_ahnqiraj_InstanceMapScript::OnCreatureCreate(), instance_stratholme::instance_stratholme_InstanceMapScript::OnUnitDeath(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnUnitDeath(), DoorsGuidCheck::operator()(), FormationMgr::RemoveCreatureFromGroup(), npc_ahnqiraji_critter::Reset(), Respawn(), SearchFormation(), and outdoorpvp_na_halaa_creatures::UpdateAI().

◆ GetSpellCooldown()

uint32 Creature::GetSpellCooldown ( uint32  spell_id) const
3080{
3081 CreatureSpellCooldowns::const_iterator itr = m_CreatureSpellCooldowns.find(spell_id);
3082 if (itr == m_CreatureSpellCooldowns.end())
3083 return 0;
3084
3085 return itr->second.end > GameTime::GetGameTimeMS().count() ? itr->second.end - GameTime::GetGameTimeMS().count() : 0;
3086}

References GameTime::GetGameTimeMS(), and m_CreatureSpellCooldowns.

Referenced by AddSpellCooldown().

◆ GetSpellDamageMod()

float Creature::GetSpellDamageMod ( int32  Rank)
1613{
1614 switch (Rank) // define rates for each elite rank
1615 {
1626 default:
1628 }
1629}
@ RATE_CREATURE_NORMAL_SPELLDAMAGE
Definition WorldConfig.h:473
@ RATE_CREATURE_ELITE_ELITE_SPELLDAMAGE
Definition WorldConfig.h:474
@ RATE_CREATURE_ELITE_RAREELITE_SPELLDAMAGE
Definition WorldConfig.h:475
@ RATE_CREATURE_ELITE_WORLDBOSS_SPELLDAMAGE
Definition WorldConfig.h:476
@ RATE_CREATURE_ELITE_RARE_SPELLDAMAGE
Definition WorldConfig.h:477

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().

◆ GetSummonerGUID()

ObjectGuid Creature::GetSummonerGUID ( ) const

Helper to get the creature's summoner GUID, if it is a summon.

3978{
3979 if (TempSummon const* temp = ToTempSummon())
3980 return temp->GetSummonerGUID();
3981
3982 LOG_DEBUG("entities.unit", "Creature::GetSummonerGUID() called by creature that is not a summon. Creature: {} ({})", GetEntry(), GetName());
3983 return ObjectGuid::Empty;
3984}

References ObjectGuid::Empty, Object::GetEntry(), WorldObject::GetName(), LOG_DEBUG, and Unit::ToTempSummon().

Referenced by npc_inner_demon::CanAIAttack(), npc_inner_demon::CanBeSeen(), npc_inner_demon::CanReceiveDamage(), npc_inner_demon::JustDied(), npc_collapsing_star::JustSummoned(), and npc_algalon_worm_hole::JustSummoned().

◆ GetTextRepeatGroup()

CreatureTextRepeatIds const & Creature::GetTextRepeatGroup ( uint8  textGroup)
3865{
3866 static CreatureTextRepeatIds const emptyIds;
3867
3868 CreatureTextRepeatGroup::const_iterator groupItr = m_textRepeat.find(textGroup);
3869 if (groupItr != m_textRepeat.end())
3870 return groupItr->second;
3871
3872 return emptyIds;
3873}
std::vector< uint8 > CreatureTextRepeatIds
Definition Creature.h:43

References m_textRepeat, and textGroup.

Referenced by CreatureTextMgr::SendChat().

◆ 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)
3278{
3279 if (!vItem->maxcount)
3280 return vItem->maxcount;
3281
3282 VendorItemCounts::iterator itr = m_vendorItemCounts.begin();
3283 for (; itr != m_vendorItemCounts.end(); ++itr)
3284 if (itr->itemId == vItem->item)
3285 break;
3286
3287 if (itr == m_vendorItemCounts.end())
3288 return vItem->maxcount;
3289
3290 VendorItemCount* vCount = &*itr;
3291
3292 time_t ptime = GameTime::GetGameTime().count();
3293
3294 if (time_t(vCount->lastIncrementTime + vItem->incrtime) <= ptime)
3295 {
3296 ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(vItem->item);
3297
3298 uint32 diff = uint32((ptime - vCount->lastIncrementTime) / vItem->incrtime);
3299 if ((vCount->count + diff * pProto->BuyCount) >= vItem->maxcount)
3300 {
3301 m_vendorItemCounts.erase(itr);
3302 return vItem->maxcount;
3303 }
3304
3305 vCount->count += diff * pProto->BuyCount;
3306 vCount->lastIncrementTime = ptime;
3307 }
3308
3309 return vCount->count;
3310}
Definition ItemTemplate.h:619
uint32 BuyCount
Definition ItemTemplate.h:629
Definition CreatureData.h:487
time_t lastIncrementTime
Definition CreatureData.h:492
uint32 count
Definition CreatureData.h:491

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
3273{
3274 return sObjectMgr->GetNpcVendorItemList(GetEntry());
3275}

References Object::GetEntry(), and sObjectMgr.

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

◆ GetWanderDistance()

float Creature::GetWanderDistance ( ) const
inline

◆ GetWaypointPath()

◆ HasFlagsExtra()

◆ hasInvolvedQuest()

bool Creature::hasInvolvedQuest ( uint32  quest_id) const
overridevirtual

Reimplemented from Object.

1841{
1842 QuestRelationBounds qir = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(GetEntry());
1843 for (QuestRelations::const_iterator itr = qir.first; itr != qir.second; ++itr)
1844 {
1845 if (itr->second == quest_id)
1846 return true;
1847 }
1848 return false;
1849}
std::pair< QuestRelations::const_iterator, QuestRelations::const_iterator > QuestRelationBounds
Definition ObjectMgr.h:531

References Object::GetEntry(), and sObjectMgr.

◆ HasLootMode()

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

References m_LootMode.

◆ hasLootRecipient()

◆ HasMechanicTemplateImmunity()

bool Creature::HasMechanicTemplateImmunity ( uint64  mask) const
2258{
2259 if (GetOwnerGUID().IsPlayer())
2260 return false;
2261
2262 if (CreatureImmunities const* immunities = sSpellMgr->GetCreatureImmunities(_creatureImmunitiesId))
2263 return (immunities->Mechanic.to_ullong() & mask) != 0;
2264
2265 // no custom immunity entry => no mechanic immunity
2266 return false;
2267}
int32 _creatureImmunitiesId
Definition Creature.h:506
ObjectGuid GetOwnerGUID() const override
Definition Unit.h:719
Definition SpellMgr.h:573

References _creatureImmunitiesId, Unit::GetOwnerGUID(), Object::IsPlayer(), and sSpellMgr.

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

◆ hasQuest()

bool Creature::hasQuest ( uint32  quest_id) const
overridevirtual

Reimplemented from Object.

1830{
1831 QuestRelationBounds qr = sObjectMgr->GetCreatureQuestRelationBounds(GetEntry());
1832 for (QuestRelations::const_iterator itr = qr.first; itr != qr.second; ++itr)
1833 {
1834 if (itr->second == quest_id)
1835 return true;
1836 }
1837 return false;
1838}

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.

3111{
3112 uint8 i;
3113 for (i = 0; i < MAX_CREATURE_SPELLS; ++i)
3114 if (spellID == m_spells[i])
3115 break;
3116 return i < MAX_CREATURE_SPELLS; //broke before end of iteration of known spells
3117}

References m_spells, and MAX_CREATURE_SPELLS.

Referenced by AddSpellCooldown(), and WorldSession::HandleCastSpellOpcode().

◆ HasSpellCooldown()

◆ HasSpellFocus()

bool Creature::HasSpellFocus ( Spell const *  focusSpell = nullptr) const
3645{
3646 if (isDead()) // dead creatures cannot focus
3647 {
3648 return false;
3649 }
3650
3651 return focusSpell ? (focusSpell == _spellFocusInfo.Spell) : (_spellFocusInfo.Spell || _spellFocusInfo.Delay);
3652}
struct Creature::@231 _spellFocusInfo
uint32 Delay
Definition Creature.h:152
Definition Spell.h:298
bool isDead() const
Definition Unit.h:1814

References _spellFocusInfo, Unit::isDead(), and Spell::Spell().

Referenced by IsMovementPreventedByCasting(), and SelectVictim().

◆ HasSwimmingFlagOutOfCombat()

bool Creature::HasSwimmingFlagOutOfCombat ( ) const
inline

◆ HasWeapon()

bool Creature::HasWeapon ( WeaponAttackType  type) const
overridevirtual

Implements Unit.

3393{
3394 if (type == OFF_ATTACK)
3395 {
3396 switch (_dualWieldMode)
3397 {
3399 return true;
3401 return false;
3403 default:
3404 break;
3405 }
3406 }
3407
3408 const uint8 slot = uint8(type);
3409 ItemEntry const* item = sItemStore.LookupEntry(GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + slot));
3410 return (item && item->ClassID == ITEM_CLASS_WEAPON);
3411}
DBCStorage< ItemEntry > sItemStore(Itemfmt)
@ ITEM_CLASS_WEAPON
Definition ItemTemplate.h:293
@ UNIT_VIRTUAL_ITEM_SLOT_ID
Definition UpdateFields.h:116
uint32 GetUInt32Value(uint16 index) const
Definition Object.cpp:303
DualWieldMode _dualWieldMode
Definition Unit.h:2093
Definition DBCStructure.h:1179
uint32 ClassID
Definition DBCStructure.h:1181

References Unit::_dualWieldMode, AUTO, ItemEntry::ClassID, DISABLED, ENABLED, Object::GetUInt32Value(), ITEM_CLASS_WEAPON, OFF_ATTACK, sItemStore, and UNIT_VIRTUAL_ITEM_SLOT_ID.

Referenced by CalculateMinMaxDamage(), and HasWeaponForAttack().

◆ HasWeaponForAttack()

bool Creature::HasWeaponForAttack ( WeaponAttackType  type) const
inlineoverridevirtual

Reimplemented from Unit.

195{ return (Unit::HasWeaponForAttack(type) && HasWeapon(type)); }
virtual bool HasWeaponForAttack(WeaponAttackType type) const
Definition Unit.h:1002

References HasWeapon(), and Unit::HasWeaponForAttack().

Referenced by CalculateMinMaxDamage().

◆ InitEntry()

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

change the entry of creature until respawn

483{
484 CreatureTemplate const* normalInfo = sObjectMgr->GetCreatureTemplate(Entry);
485 if (!normalInfo)
486 {
487 LOG_ERROR("sql.sql", "Creature::InitEntry creature entry {} does not exist.", Entry);
488 return false;
489 }
490
491 // get difficulty 1 mode entry
492 // Xinef: Skip for pets!
493 CreatureTemplate const* cinfo = normalInfo;
494 for (uint8 diff = uint8(GetMap()->GetSpawnMode()); diff > 0 && !IsPet();)
495 {
496 // we already have valid Map pointer for current creature!
497 if (normalInfo->DifficultyEntry[diff - 1])
498 {
499 cinfo = sObjectMgr->GetCreatureTemplate(normalInfo->DifficultyEntry[diff - 1]);
500 if (cinfo)
501 break; // template found
502
503 // check and reported at startup, so just ignore (restore normalInfo)
504 cinfo = normalInfo;
505 }
506
507 // for instances heroic to normal, other cases attempt to retrieve previous difficulty
508 if (diff >= RAID_DIFFICULTY_10MAN_HEROIC && GetMap()->IsRaid())
509 diff -= 2; // to normal raid difficulty cases
510 else
511 --diff;
512 }
513
514 SetEntry(Entry); // normal entry always
515 m_creatureInfo = cinfo; // map mode related always
516 CachedScriptIdEntry = 0; // force GetScriptId() to re-resolve for this (re)init
517
518 // equal to player Race field, but creature does not have race
520
521 // known valid are: CLASS_WARRIOR, CLASS_PALADIN, CLASS_ROGUE, CLASS_MAGE
523
524 // Cancel load if no model defined
525 if (!(cinfo->GetFirstValidModel()))
526 {
527 LOG_ERROR("sql.sql", "Creature (Entry: {}) has no model defined in table `creature_template_model`, can't load. ", Entry);
528 return false;
529 }
530
531 CreatureModel model = *ObjectMgr::ChooseDisplayId(cinfo, data);
532 CreatureModelInfo const* mInfo = sObjectMgr->GetCreatureModelRandomGender(&model, cinfo);
533 if (!mInfo) // Cancel load if no model defined
534 {
535 LOG_ERROR("sql.sql", "Creature (Entry: {}) has no model {} defined in table `creature_template_model`, can't load. ", Entry, model.CreatureDisplayID);
536 return false;
537 }
538
542
543 // Load creature equipment
544 if (!data)
545 {
546 LoadEquipment(); // use default from the template
547 }
548 else if (data->equipmentId == 0)
549 {
550 LoadEquipment(0); // 0 means no equipment for creature table
551 }
552 else
553 {
554 m_originalEquipmentId = data->equipmentId;
555 LoadEquipment(data->equipmentId);
556 }
557
558 SetName(normalInfo->Name); // at normal entry always
559
561
563 SetSpeed(MOVE_RUN, cinfo->speed_run);
566
568
571
572 // checked at loading
576
577 for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
579
581
582 return true;
583}
@ CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK
Definition CreatureData.h:57
@ RANDOM_MOTION_TYPE
Definition MotionMaster.h:40
@ MOVE_WALK
Definition UnitDefines.h:356
@ UNIT_FIELD_BYTES_0
Definition UpdateFields.h:95
@ UNIT_MOD_CAST_SPEED
Definition UpdateFields.h:137
@ UNIT_FIELD_HOVERHEIGHT
Definition UpdateFields.h:173
void LoadEquipment(int8 id=1, bool force=false)
Definition Creature.cpp:1807
static CreatureModel const * ChooseDisplayId(CreatureTemplate const *cinfo, CreatureData const *data=nullptr)
Definition ObjectMgr.cpp:1644
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition Object.cpp:748
void SetFloatValue(uint16 index, float value)
Definition Object.cpp:735
void SetEntry(uint32 entry)
Definition Object.h:124
void Initialize()
Definition ThreatManager.cpp:248
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition Unit.cpp:11114
virtual void SetDualWieldMode(DualWieldMode mode)
Definition Unit.h:994
void SetName(std::string const &newname)
Definition Object.h:536
uint32 CreatureDisplayID
Definition CreatureData.h:180
float DisplayScale
Definition CreatureData.h:181
float speed_run
Definition CreatureData.h:202
std::string Name
Definition CreatureData.h:192
uint32 spells[MAX_CREATURE_SPELLS]
Definition CreatureData.h:224
CreatureModel const * GetFirstValidModel() const
Definition Creature.cpp:142
float speed_swim
Definition CreatureData.h:203
uint32 MovementType
Definition CreatureData.h:230
uint32 unit_class
Definition CreatureData.h:213
float speed_walk
Definition CreatureData.h:201
float HoverHeight
Definition CreatureData.h:232
float speed_flight
Definition CreatureData.h:204

References _nativeObjectScale, CachedScriptIdEntry, ObjectMgr::ChooseDisplayId(), CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK, CreatureModel::CreatureDisplayID, CreatureTemplate::DifficultyEntry, CreatureModel::DisplayScale, ENABLED, Entry, CreatureData::equipmentId, GetCreatureTemplate(), CreatureTemplate::GetFirstValidModel(), WorldObject::GetMap(), Unit::GetThreatMgr(), CreatureTemplate::HasFlagsExtra(), CreatureTemplate::HoverHeight, IDLE_MOTION_TYPE, ThreatManager::Initialize(), 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(), Unit::SetDisplayId(), Unit::SetDualWieldMode(), Object::SetEntry(), Object::SetFloatValue(), WorldObject::SetName(), Unit::SetNativeDisplayId(), 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 ( )

Check if the creature has the specified ReactState.

2250{
2251 if ((IsTotem() || IsTrigger() || IsCritter() || IsSpiritService()) && GetAIName() != "SmartAI" && !GetScriptId())
2253 else
2255}
@ REACT_PASSIVE
Definition Unit.h:574
bool IsTrigger() const
Definition Creature.h:79
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition Creature.h:99
bool IsCritter() const
Definition Unit.h:839
bool IsSpiritService() const
Definition Unit.h:830

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

Referenced by spell_gen_feign_death_all_flags::HandleEffectRemove(), spell_gen_feign_death_no_dyn_flag::HandleEffectRemove(), spell_gen_feign_death_no_prevent_emotes::HandleEffectRemove(), Respawn(), and UpdateEntry().

◆ IsAlwaysDetectableFor()

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

Reimplemented from WorldObject.

1907{
1909 {
1910 return true;
1911 }
1912
1913 if (IsAIEnabled && AI()->CanAlwaysBeDetectable(seer))
1914 {
1915 return true;
1916 }
1917
1918 return false;
1919}
bool IsAlwaysDetectableFor(WorldObject const *seer) const override
Definition Unit.cpp:10898

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

◆ IsAvoidingAOE()

bool Creature::IsAvoidingAOE ( ) const
inline

◆ isCanInteractWithBattleMaster()

bool Creature::isCanInteractWithBattleMaster ( Player *  player,
bool  msg 
) const
1260{
1261 if (!IsBattleMaster())
1262 return false;
1263
1264 BattlegroundTypeId bgTypeId = sBattlegroundMgr->GetBattleMasterBG(GetEntry());
1265 if (!msg)
1266 return player->GetBGAccessByLevel(bgTypeId);
1267
1268 if (!player->GetBGAccessByLevel(bgTypeId))
1269 {
1270 ClearGossipMenuFor(player);
1271 switch (bgTypeId)
1272 {
1273 case BATTLEGROUND_AV:
1274 SendGossipMenuFor(player, 7616, this);
1275 break;
1276 case BATTLEGROUND_WS:
1277 SendGossipMenuFor(player, 7599, this);
1278 break;
1279 case BATTLEGROUND_AB:
1280 SendGossipMenuFor(player, 7642, this);
1281 break;
1282 case BATTLEGROUND_EY:
1283 case BATTLEGROUND_NA:
1284 case BATTLEGROUND_BE:
1285 case BATTLEGROUND_AA:
1286 case BATTLEGROUND_RL:
1287 case BATTLEGROUND_SA:
1288 case BATTLEGROUND_DS:
1289 case BATTLEGROUND_RV:
1290 SendGossipMenuFor(player, 10024, this);
1291 break;
1292 default:
1293 break;
1294 }
1295 return false;
1296 }
1297 return true;
1298}
#define sBattlegroundMgr
Definition BattlegroundMgr.h:190
void SendGossipMenuFor(Player *player, uint32 npcTextID, ObjectGuid const &guid)
Definition ScriptedGossip.cpp:45
void ClearGossipMenuFor(Player *player)
Definition ScriptedGossip.cpp:22
BattlegroundTypeId
Definition SharedDefines.h:3735
@ BATTLEGROUND_AA
Definition SharedDefines.h:3742
@ BATTLEGROUND_WS
Definition SharedDefines.h:3738
@ BATTLEGROUND_EY
Definition SharedDefines.h:3743
@ BATTLEGROUND_AV
Definition SharedDefines.h:3737
@ BATTLEGROUND_BE
Definition SharedDefines.h:3741
@ BATTLEGROUND_RV
Definition SharedDefines.h:3747
@ BATTLEGROUND_NA
Definition SharedDefines.h:3740
@ BATTLEGROUND_DS
Definition SharedDefines.h:3746
@ BATTLEGROUND_SA
Definition SharedDefines.h:3745
@ BATTLEGROUND_AB
Definition SharedDefines.h:3739
@ BATTLEGROUND_RL
Definition SharedDefines.h:3744
bool GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const
Definition Player.cpp:12611
bool IsBattleMaster() const
Definition Unit.h:815

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().

◆ IsCivilian()

◆ IsCombatMovementAllowed()

◆ IsDamageEnoughForLootingAndReward()

◆ IsDungeonBoss()

◆ isElite()

bool Creature::isElite ( ) const
inline
115 {
116 if (IsPet())
117 return false;
118
120 return rank != CREATURE_ELITE_NORMAL && rank != CREATURE_ELITE_RARE;
121 }
uint32 rank
Definition CreatureData.h:206

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

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

◆ IsEngaged()

◆ IsEvadingAttacks()

bool Creature::IsEvadingAttacks ( ) const
inline

◆ IsFormationLeader()

bool Creature::IsFormationLeader ( ) const
397{
398 if (!m_formation)
399 return false;
400
401 return m_formation->GetLeader() == this;
402}
Creature * GetLeader() const
Definition CreatureGroups.h:104

References CreatureGroup::GetLeader(), and m_formation.

Referenced by WaypointMovementGenerator< Creature >::StartMove().

◆ IsFormationLeaderMoveAllowed()

bool Creature::IsFormationLeaderMoveAllowed ( ) const
416{
417 if (!m_formation)
418 return true;
419
421}
bool CanLeaderStartMoving() const
Definition CreatureGroups.cpp:433

References CreatureGroup::CanLeaderStartMoving(), and m_formation.

Referenced by WaypointMovementGenerator< Creature >::StartMove().

◆ IsFreeToMove()

bool Creature::IsFreeToMove ( )
973{
975 // Do not reposition ourself when we are not allowed to move
977 (GetMotionMaster()->GetCurrentMovementGeneratorType() != CHASE_MOTION_TYPE ||
978 moveFlags & MOVEMENTFLAG_SPLINE_ENABLED))
979 {
980 return false;
981 }
982
983 return true;
984}
@ MOVEMENTFLAG_SPLINE_ENABLED
Definition UnitDefines.h:399
bool IsCombatMovementAllowed() const
Definition Creature.h:456
bool IsMovementPreventedByCasting() const override
Definition Creature.cpp:3710
bool CanFreeMove() const
Definition Unit.h:1744
bool isMoving() const
Definition Unit.h:1728
MovementInfo m_movementInfo
Definition Object.h:711
uint32 GetMovementFlags() const
Definition Object.h:349

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

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

◆ IsGuard()

bool Creature::IsGuard ( ) const
inline
@ CREATURE_FLAG_EXTRA_GUARD
Definition CreatureData.h:61

References CREATURE_FLAG_EXTRA_GUARD, and HasFlagsExtra().

Referenced by GuardAI::Permissible().

◆ IsImmunedToSpell()

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

Reimplemented from Unit.

2309{
2310 if (!spellInfo)
2311 return false;
2312
2313 if (spellInfo->HasAttribute(SPELL_ATTR0_CU_BYPASS_MECHANIC_IMMUNITY))
2314 {
2315 return false;
2316 }
2317
2318 // Xinef: this should exclude self casts...
2319 // Spells that don't have effectMechanics.
2320 if (spellInfo->Mechanic > MECHANIC_NONE && HasMechanicTemplateImmunity(1ULL << spellInfo->Mechanic))
2321 return true;
2322
2323 // The above helper uses the creature_immunities table rather than a
2324 // simple mask on creature_template. We can't rely on the old mask field
2325 // (which has been removed) because it no longer exists and did not always
2326 // match the runtime immunity set stored in m_spellImmune.
2327 bool immunedToAllEffects = true;
2328 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
2329 if (spellInfo->Effects[i].IsEffect() && !IsImmunedToSpellEffect(spellInfo, i))
2330 {
2331 immunedToAllEffects = false;
2332 break;
2333 }
2334 if (immunedToAllEffects)
2335 return true;
2336
2337 return Unit::IsImmunedToSpell(spellInfo, spell);
2338}
#define MAX_SPELL_EFFECTS
Definition DBCStructure.h:1673
@ MECHANIC_NONE
Definition SharedDefines.h:1313
@ SPELL_ATTR0_CU_BYPASS_MECHANIC_IMMUNITY
Definition SpellInfo.h:209
bool HasMechanicTemplateImmunity(uint64 mask) const
Definition Creature.cpp:2257
bool IsImmunedToSpellEffect(SpellInfo const *spellInfo, uint32 index, WorldObject const *caster=nullptr) const override
Definition Creature.cpp:2340
virtual bool IsImmunedToSpell(SpellInfo const *spellInfo, Spell const *spell=nullptr)
Definition Unit.cpp:9888

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

◆ IsImmunedToSpellEffect()

bool Creature::IsImmunedToSpellEffect ( SpellInfo const *  spellInfo,
uint32  index,
WorldObject const *  caster = nullptr 
) const
overridevirtual

Reimplemented from Unit.

Reimplemented in Totem.

2341{
2342 // Xinef: this should exclude self casts...
2343 if (spellInfo->Effects[index].Mechanic > MECHANIC_NONE
2344 && !spellInfo->HasAttribute(SPELL_ATTR0_CU_BYPASS_MECHANIC_IMMUNITY)
2345 && HasMechanicTemplateImmunity(1ULL << spellInfo->Effects[index].Mechanic))
2346 return true;
2347
2348 if (GetCreatureTemplate()->type == CREATURE_TYPE_MECHANICAL && spellInfo->Effects[index].Effect == SPELL_EFFECT_HEAL)
2349 return true;
2350
2351 return Unit::IsImmunedToSpellEffect(spellInfo, index, caster);
2352}
@ SPELL_EFFECT_HEAL
Definition SharedDefines.h:776
@ CREATURE_TYPE_MECHANICAL
Definition SharedDefines.h:2630
virtual bool IsImmunedToSpellEffect(SpellInfo const *spellInfo, uint32 index, WorldObject const *caster=nullptr) const
Definition Unit.cpp:9899

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

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

◆ IsImmuneToKnockback()

bool Creature::IsImmuneToKnockback ( ) const
3384{
3385 if (GetOwnerGUID().IsPlayer())
3386 return false;
3387
3388 CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(GetEntry());
3390}
@ CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK
Definition CreatureData.h:76

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

◆ IsInEvadeMode()

bool Creature::IsInEvadeMode ( ) const
inline
@ UNIT_STATE_EVADE
Definition UnitDefines.h:194

References Unit::HasUnitState(), and UNIT_STATE_EVADE.

Referenced by CreatureAI::_EnterEvadeMode(), npc_escortAI::AssistPlayerInCombatAgainst(), Unit::Attack(), CanAssistTo(), CanCreatureAttack(), Map::CreatureRelocation(), boss_sindragosa::boss_sindragosaAI::DamageTaken(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), boss_hydross_the_unstable::DoAction(), Spell::DoSpellHitOnUnit(), CreatureAI::DoZoneInCombat(), npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode(), npc_pet_mage_mirror_image::EnterEvadeMode(), Vehicle::InstallAccessory(), IsEvadingAttacks(), npc_escortAI::JustExitedCombat(), boss_professor_putricide::boss_professor_putricideAI::JustSummoned(), boss_rotface::boss_rotfaceAI::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::KilledUnit(), CreatureGroup::MemberEvaded(), SmartAI::OnCharmed(), Spell::prepare(), boss_krik_thir::boss_krik_thirAI::Reset(), boss_drakkari_colossus::boss_drakkari_colossusAI::Reset(), boss_auriaya::Reset(), SetCannotReachTarget(), instance_scarlet_monastery::instance_scarlet_monastery_InstanceMapScript::SetData(), npc_tirion_fordring_tft::npc_tirion_fordringAI::sGossipSelect(), boss_prince_keleseth_icc::boss_prince_kelesethAI::SpellHit(), boss_prince_taldaram_icc::boss_prince_taldaramAI::SpellHit(), boss_prince_valanar_icc::boss_prince_valanarAI::SpellHit(), Update(), SimpleCharmedAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), and Player::UpdateCharmedAI().

◆ IsInvisibleDueToDespawn()

bool Creature::IsInvisibleDueToDespawn ( ) const
overrideprotectedvirtual

Reimplemented from WorldObject.

1888{
1890 return true;
1891
1892 if (IsAlive() || isDying() || m_corpseRemoveTime > GameTime::GetGameTime().count())
1893 return false;
1894
1895 return true;
1896}
bool isDying() const
Definition Unit.h:1813
virtual bool IsInvisibleDueToDespawn() const
Definition Object.h:823

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

◆ IsLootRewardDisabled()

bool Creature::IsLootRewardDisabled ( ) const
inline
381{ return DisableLootReward; }

References DisableLootReward.

Referenced by Player::isAllowedToLoot(), and Unit::Kill().

◆ IsMoveInLineOfSightDisabled()

bool Creature::IsMoveInLineOfSightDisabled ( )
inline

◆ IsMoveInLineOfSightStrictlyDisabled()

◆ IsMovementPreventedByCasting()

bool Creature::IsMovementPreventedByCasting ( ) const
overridevirtual

Reimplemented from Unit.

3711{
3713 // first check if currently a movement allowed channel is active and we're not casting
3714 if (spell && spell->getState() != SPELL_STATE_FINISHED && spell->IsChannelActive() && spell->GetSpellInfo()->IsActionAllowedChannel())
3715 {
3716 return false;
3717 }
3718
3719 if (HasSpellFocus())
3720 {
3721 return true;
3722 }
3723
3725 {
3726 return true;
3727 }
3728
3729 return false;
3730}
@ SPELL_STATE_FINISHED
Definition Spell.h:239
@ UNIT_STATE_CASTING
Definition UnitDefines.h:188
@ CURRENT_CHANNELED_SPELL
Definition Unit.h:565
bool HasSpellFocus(Spell const *focusSpell=nullptr) const
Definition Creature.cpp:3644
bool IsActionAllowedChannel() const
Definition SpellInfo.cpp:1306
SpellInfo const * GetSpellInfo() const
Definition Spell.h:601
uint32 getState() const
Definition Spell.h:496
bool IsChannelActive() const
Definition Spell.h:572
Spell * m_currentSpells[CURRENT_MAX_SPELL]
Definition Unit.h:2187

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 FormationMovementGenerator::DoInitialize(), FormationMovementGenerator::DoUpdate(), RandomMovementGenerator< T >::DoUpdate(), ChaseMovementGenerator< T >::DoUpdate(), FollowMovementGenerator< T >::DoUpdate(), WaypointMovementGenerator< Creature >::IsAllowedToMove(), IsFreeToMove(), SmartAI::OnSpellFailed(), SmartAI::SetCurrentRangeMode(), and PetAI::UpdateAI().

◆ IsNotReachableAndNeedRegen()

bool Creature::IsNotReachableAndNeedRegen ( ) const
3757{
3759}
bool IsEvadeRegen() const
Definition CombatManager.h:128

References CanNotReachTarget(), Unit::GetCombatManager(), and CombatManager::IsEvadeRegen().

Referenced by Update().

◆ IsRacialLeader()

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

References GetCreatureTemplate(), and CreatureTemplate::RacialLeader.

Referenced by Player::RewardHonor().

◆ isRegeneratingHealth()

bool Creature::isRegeneratingHealth ( )
inline

◆ IsReputationRewardDisabled()

bool Creature::IsReputationRewardDisabled ( ) const
inline

◆ IsRespawnCompatibilityMode()

bool Creature::IsRespawnCompatibilityMode ( ) const
inline

◆ IsRooted()

bool Creature::IsRooted ( ) const
inline
88{ return GetMovementTemplate().IsRooted(); }
bool IsRooted() const
Definition CreatureData.h:146

References GetMovementTemplate(), and CreatureMovementData::IsRooted().

Referenced by SmartScript::ProcessAction(), and UpdateEntry().

◆ IsSpellProhibited()

bool Creature::IsSpellProhibited ( SpellSchoolMask  idSchoolMask) const
2982{
2983 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
2984 {
2985 if (idSchoolMask & (1 << i))
2986 {
2988 {
2989 return true;
2990 }
2991 }
2992 }
2993
2994 return false;
2995}

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

Referenced by CanCastSpell(), Spell::CheckCast(), SmartAI::IsMainSpellPrevented(), and npc_pet_dk_ebon_gargoyle::UpdateAI().

◆ isTappedBy()

bool Creature::isTappedBy ( Player const *  player) const
1385{
1386 if (player->GetGUID() == m_lootRecipient)
1387 return true;
1388
1389 Group const* playerGroup = player->GetGroup();
1390 if (!playerGroup || playerGroup != GetLootRecipientGroup()) // if we dont have a group we arent the recipient
1391 return false; // if creature doesnt have group bound it means it was solo killed by someone else
1392
1393 return true;
1394}
Group * GetLootRecipientGroup() const
Definition Creature.cpp:1316
Definition Group.h:178

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

Referenced by Unit::PatchValuesUpdate().

◆ IsTextOnCooldown()

bool Creature::IsTextOnCooldown ( uint8  textGroup) const
3883{
3884 auto itr = m_textCooldowns.find(textGroup);
3885 if (itr == m_textCooldowns.end())
3886 return false;
3887
3888 return GameTime::GetGameTime().count() < itr->second;
3889}
std::unordered_map< uint8, uint32 > m_textCooldowns
Definition Creature.h:557

References GameTime::GetGameTime(), m_textCooldowns, and textGroup.

Referenced by CreatureTextMgr::SendChat().

◆ IsTrigger()

◆ IsUpdateNeeded()

bool Creature::IsUpdateNeeded ( )
overridevirtual

Reimplemented from WorldObject.

3997{
3999 return true;
4000
4001 if (GetMap()->isCellMarked(GetCurrentCell().GetCellCoord().GetId()))
4002 return true;
4003
4004 if (IsInCombat())
4005 return true;
4006
4007 if (!GetObjectVisibilityContainer().GetVisiblePlayersMap().empty())
4008 return true;
4009
4010 if (ToTempSummon())
4011 return true;
4012
4013 if (GetMotionMaster()->HasMovementGeneratorType(WAYPOINT_MOTION_TYPE))
4014 return true;
4015
4017 return true;
4018
4019 if (m_formation && m_formation->GetLeader() != this)
4020 return true;
4021
4022 return false;
4023}
Cell const & GetCurrentCell() const
Definition Object.h:429
virtual bool IsUpdateNeeded()
Definition Object.cpp:3254
ObjectVisibilityContainer & GetObjectVisibilityContainer()
Definition Object.h:744

References MovableMapObject::GetCurrentCell(), CreatureGroup::GetLeader(), WorldObject::GetMap(), Unit::GetMotionMaster(), WorldObject::GetObjectVisibilityContainer(), Unit::HasUnitState(), Unit::IsInCombat(), WorldObject::IsUpdateNeeded(), m_formation, Unit::ToTempSummon(), UNIT_STATE_EVADE, and WAYPOINT_MOTION_TYPE.

◆ isVendorWithIconSpeak()

bool Creature::isVendorWithIconSpeak ( ) const
1689{
1691}
@ UNIT_NPC_FLAG_VENDOR
Definition UnitDefines.h:329
uint32 npcflag
Definition CreatureData.h:383
std::string IconName
Definition CreatureData.h:194

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  allowDuplicate = false 
)
1694{
1695 if (!allowDuplicate)
1696 {
1697 // If an alive instance of this spawnId is already found, skip creation
1698 // If only dead instance(s) exist, despawn them and spawn a new (maybe also dead) version
1699 const auto creatureBounds = map->GetCreatureBySpawnIdStore().equal_range(spawnId);
1700 std::vector <Creature*> despawnList;
1701
1702 if (creatureBounds.first != creatureBounds.second)
1703 {
1704 for (auto itr = creatureBounds.first; itr != creatureBounds.second; ++itr)
1705 {
1706 if (itr->second->IsAlive())
1707 {
1708 LOG_DEBUG("maps", "Would have spawned {} but {} already exists", spawnId, creatureBounds.first->second->GetGUID().ToString());
1709 return false;
1710 }
1711 else
1712 {
1713 despawnList.push_back(itr->second);
1714 LOG_DEBUG("maps", "Despawned dead instance of spawn {} ({})", spawnId, itr->second->GetGUID().ToString());
1715 }
1716 }
1717
1718 for (Creature* despawnCreature : despawnList)
1719 {
1720 despawnCreature->AddObjectToRemoveList();
1721 }
1722 }
1723 }
1724
1725 CreatureData const* data = sObjectMgr->GetCreatureData(spawnId);
1726 if (!data)
1727 {
1728 LOG_ERROR("sql.sql", "Creature (SpawnId: {}) not found in table `creature`, can't load. ", spawnId);
1729 return false;
1730 }
1731
1732 // xinef: this has to be assigned before Create function, properly loads equipment id from DB
1733 m_creatureData = data;
1734 m_spawnId = spawnId;
1735
1736 // Set respawn compatibility mode based on spawn group flags
1737 SpawnGroupTemplateData const* groupData = sObjectMgr->GetSpawnGroupData(data->spawnGroupId);
1739 || !groupData || (groupData->flags & SPAWNGROUP_FLAG_COMPATIBILITY_MODE);
1740
1741 // Add to world
1742 uint32 entry = GetRandomId(data->id, data->id2, data->id3);
1743
1744 if (!Create(map->GenerateLowGuid<HighGuid::Unit>(), map, data->phaseMask, entry, 0, data->posX, data->posY, data->posZ, data->orientation, data))
1745 return false;
1746
1747 //We should set first home position, because then AI calls home movement
1748 SetHomePosition(data->posX, data->posY, data->posZ, data->orientation);
1749
1751
1754
1756 if (m_respawnTime) // respawn on Update
1757 {
1759 if (CanFly())
1760 {
1761 float tz = map->GetHeight(GetPhaseMask(), data->posX, data->posY, data->posZ, true, MAX_FALL_DISTANCE);
1762 if (data->posZ - tz > 0.1f && Acore::IsValidMapCoord(tz))
1763 {
1764 Relocate(data->posX, data->posY, tz);
1765 }
1766 }
1767 }
1768
1769 uint32 curhealth;
1770
1771 if (!m_regenHealth)
1772 {
1773 curhealth = data->curhealth;
1774 if (curhealth)
1775 {
1776 curhealth = uint32(curhealth * _GetHealthMod(GetCreatureTemplate()->rank));
1777 if (curhealth < 1)
1778 curhealth = 1;
1779 }
1780 SetPower(POWER_MANA, data->curmana);
1781 }
1782 else
1783 {
1784 curhealth = GetMaxHealth();
1786 }
1787
1788 SetHealth(m_deathState == DeathState::Alive ? curhealth : 0);
1789
1790 // SelectLevel() sized the player damage requirement against full health, before curhealth was known
1792
1793 // checked at creature_template loading
1795
1796 if (addToMap && !GetMap()->AddToMap(this))
1797 return false;
1798 return true;
1799}
#define MAX_FALL_DISTANCE
Definition GridTerrainData.h:28
@ POWER_MANA
Definition SharedDefines.h:257
@ SPAWNGROUP_FLAG_COMPATIBILITY_MODE
Definition SpawnData.h:45
@ CONFIG_RESPAWN_FORCE_COMPATIBILITY_MODE
Definition WorldConfig.h:403
void ResetPlayerDamageReq()
Definition Creature.cpp:3942
bool Create(ObjectGuid::LowType guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 vehId, float x, float y, float z, float ang, CreatureData const *data=nullptr)
Definition Creature.cpp:1166
static float _GetHealthMod(int32 Rank)
Definition Creature.cpp:1574
uint32 GetRandomId(uint32 id1, uint32 id2, uint32 id3)
Definition Creature.cpp:3815
float GetHeight(float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
Definition Map.cpp:1188
time_t GetCreatureRespawnTime(ObjectGuid::LowType dbGuid) const
Definition Map.h:416
ObjectGuid::LowType GenerateLowGuid()
Definition Map.h:530
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition Unit.cpp:12108
uint32 GetMaxHealth() const
Definition Unit.h:1123
DeathState m_deathState
Definition Unit.h:2174
void SetHealth(uint32 val)
Definition Unit.cpp:12020
uint32 GetMaxPower(Powers power) const
Definition Unit.h:1150
bool IsValidMapCoord(float c)
Definition GridDefines.h:210
float wander_distance
Definition CreatureData.h:378
uint32 spawntimesecs
Definition CreatureData.h:377
uint32 id
Definition CreatureData.h:372
uint8 movementType
Definition CreatureData.h:382
uint32 id2
Definition CreatureData.h:373
uint32 curhealth
Definition CreatureData.h:380
uint32 curmana
Definition CreatureData.h:381
uint32 id3
Definition CreatureData.h:374
float posX
Definition SpawnData.h:71
float posY
Definition SpawnData.h:72
uint32 phaseMask
Definition SpawnData.h:70
float orientation
Definition SpawnData.h:74
uint32 spawnGroupId
Definition SpawnData.h:78
float posZ
Definition SpawnData.h:73
Definition SpawnData.h:58
SpawnGroupFlags flags
Definition SpawnData.h:62

References _GetHealthMod(), _respawnCompatibilityMode, Alive, CanFly(), CONFIG_RESPAWN_FORCE_COMPATIBILITY_MODE, Create(), CreatureData::curhealth, CreatureData::curmana, Dead, SpawnGroupTemplateData::flags, Map::GenerateLowGuid(), Map::GetCreatureBySpawnIdStore(), Map::GetCreatureRespawnTime(), GetCreatureTemplate(), Map::GetHeight(), WorldObject::GetMap(), Unit::GetMaxHealth(), Unit::GetMaxPower(), WorldObject::GetPhaseMask(), GetRandomId(), CreatureData::id, 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, SpawnData::orientation, SpawnData::phaseMask, SpawnData::posX, SpawnData::posY, SpawnData::posZ, POWER_MANA, Position::Relocate(), ResetPlayerDamageReq(), Unit::SetHealth(), SetHomePosition(), Unit::SetPower(), sObjectMgr, SPAWNGROUP_FLAG_COMPATIBILITY_MODE, SpawnData::spawnGroupId, CreatureData::spawntimesecs, sWorld, Unit, and CreatureData::wander_distance.

Referenced by ObjectMgr::AddCreData(), MotionTransport::CreateNPCPassenger(), GameEventMgr::GameEventSpawn(), npc_commandscript::HandleNpcAddCommand(), npc_commandscript::HandleNpcLoadCommand(), wp_commandscript::HandleWpModifyCommand(), wp_commandscript::HandleWpShowCommand(), LoadFromDB(), Map::ProcessCreatureRespawn(), Map::SpawnGroupSpawn(), and UpdateCreatureHalaa().

◆ 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.

2779{
2780 CreatureAddon const* cainfo = GetCreatureAddon();
2781 if (!cainfo)
2782 return false;
2783
2784 if (cainfo->mount != 0)
2785 Mount(cainfo->mount);
2786
2787 if (cainfo->bytes1 != 0)
2788 {
2789 // 0 StandState
2790 // 1 FreeTalentPoints Pet only, so always 0 for default creature
2791 // 2 StandFlags
2792 // 3 StandMiscFlags
2793
2795 //SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_PET_TALENTS, uint8((cainfo->bytes1 >> 8) & 0xFF));
2799
2805 if (CanHover())
2807 }
2808
2809 if (cainfo->bytes2 != 0)
2810 {
2811 // 0 SheathState
2812 // 1 Bytes2Flags
2813 // 2 UnitRename Pet only, so always 0 for default creature
2814 // 3 ShapeshiftForm Must be determined/set by shapeshift spell/aura
2815
2816 SetByteValue(UNIT_FIELD_BYTES_2, 0, uint8(cainfo->bytes2 & 0xFF));
2817 //SetByteValue(UNIT_FIELD_BYTES_2, 1, uint8((cainfo->bytes2 >> 8) & 0xFF));
2818 //SetByteValue(UNIT_FIELD_BYTES_2, 2, uint8((cainfo->bytes2 >> 16) & 0xFF));
2820 //SetByteValue(UNIT_FIELD_BYTES_2, 3, uint8((cainfo->bytes2 >> 24) & 0xFF));
2822 }
2823
2825
2826 // Check if visibility distance different
2828 {
2830 }
2831
2832 //Load Path
2833 if (cainfo->path_id != 0)
2834 m_path_id = cainfo->path_id;
2835
2836 if (!cainfo->auras.empty())
2837 {
2838 for (std::vector<uint32>::const_iterator itr = cainfo->auras.begin(); itr != cainfo->auras.end(); ++itr)
2839 {
2840 SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(*itr);
2841 if (!AdditionalSpellInfo)
2842 {
2843 LOG_ERROR("sql.sql", "Creature ({}) has wrong spell {} defined in `auras` field.", GetGUID().ToString(), *itr);
2844 continue;
2845 }
2846
2847 // skip already applied aura
2848 if (HasAura(*itr))
2849 {
2850 if (!reload)
2851 LOG_ERROR("sql.sql", "Creature ({}) has duplicate aura (spell {}) in `auras` field.", GetGUID().ToString(), *itr);
2852
2853 continue;
2854 }
2855
2856 AddAura(*itr, this);
2857 LOG_DEBUG("entities.unit", "Spell: {} added to creature ({})", *itr, GetGUID().ToString());
2858 }
2859 }
2860
2861 return true;
2862}
@ MOVEMENTFLAG_HOVER
Definition UnitDefines.h:402
@ UNIT_BYTES_1_OFFSET_ANIM_TIER
Definition UnitDefines.h:29
@ UNIT_BYTES_1_OFFSET_PET_TALENTS
Definition UnitDefines.h:27
@ UNIT_BYTES_1_OFFSET_STAND_STATE
Definition UnitDefines.h:26
@ UNIT_BYTES_1_OFFSET_VIS_FLAG
Definition UnitDefines.h:28
@ UNIT_NPC_EMOTESTATE
Definition UpdateFields.h:140
@ UNIT_FIELD_BYTES_1
Definition UpdateFields.h:131
@ UNIT_FIELD_BYTES_2
Definition UpdateFields.h:161
bool CanHover() const
Definition Creature.h:87
CreatureAddon const * GetCreatureAddon() const
Definition Creature.cpp:2765
Aura * AddAura(uint32 spellId, Unit *target)
Definition Unit.cpp:14825
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5798
void Mount(uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
Definition Unit.cpp:10303
void AddUnitMovementFlag(uint32 f)
Definition Unit.h:778
void SetUInt32Value(uint16 index, uint32 value)
Definition Unit.cpp:17078
void SetVisibilityDistanceOverride(VisibilityDistanceType type)
Definition Object.cpp:1117
std::vector< uint32 > auras
Definition CreatureData.h:437
uint32 mount
Definition CreatureData.h:433
uint32 emote
Definition CreatureData.h:436
uint32 path_id
Definition CreatureData.h:432
VisibilityDistanceType visibilityDistanceType
Definition CreatureData.h:438
uint32 bytes1
Definition CreatureData.h:434
uint32 bytes2
Definition CreatureData.h:435

References Unit::AddAura(), Unit::AddUnitMovementFlag(), CreatureAddon::auras, CreatureAddon::bytes1, CreatureAddon::bytes2, CanHover(), CreatureAddon::emote, GetCreatureAddon(), Object::GetGUID(), Unit::HasAura(), LOG_DEBUG, LOG_ERROR, m_path_id, CreatureAddon::mount, Unit::Mount(), MOVEMENTFLAG_HOVER, Normal, CreatureAddon::path_id, Object::SetByteValue(), Unit::SetUInt32Value(), WorldObject::SetVisibilityDistanceOverride(), sSpellMgr, 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::EnterEvadeMode(), npc_pos_freed_slave::npc_pos_freed_slaveAI::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 
)
1808{
1809 if (id == 0)
1810 {
1811 if (force)
1812 {
1813 for (uint8 i = 0; i < MAX_EQUIPMENT_ITEMS; ++i)
1815 m_equipmentId = 0;
1816 }
1817 return;
1818 }
1819
1820 EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(GetEntry(), id);
1821 if (!einfo)
1822 return;
1823
1824 m_equipmentId = id;
1825 for (uint8 i = 0; i < 3; ++i)
1827}
#define MAX_EQUIPMENT_ITEMS
Definition CreatureData.h:36
Definition CreatureData.h:360
uint32 ItemEntry[MAX_EQUIPMENT_ITEMS]
Definition CreatureData.h:361

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

Referenced by boss_thekal::CheckPhaseTransition(), boss_leotheras_the_blind::DemonTime(), boss_twinemperorsAI::DoAction(), boss_leotheras_the_blind::DoAction(), boss_illidan_stormrage::DoAction(), spell_marli_transform::HandleApply(), spell_boss_magus_telestra_summon_telestra_clones_aura::HandleApply(), spell_marli_transform::HandleRemove(), spell_boss_magus_telestra_summon_telestra_clones_aura::HandleRemove(), spell_death_knight_initiate_visual::HandleScriptEffect(), InitEntry(), boss_swamplord_muselek::JustEngagedWith(), boss_pathaleon_the_calculator::JustEngagedWith(), npc_highlord_darion_mograine::JustRespawned(), npc_koltira_deathweaver::MovementInform(), boss_illidan_stormrage::MovementInform(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), spell_illidan_demon_transform1_aura::OnPeriodic(), spell_illidan_demon_transform2_aura::OnPeriodic(), boss_mr_smite::boss_mr_smiteAI::Reset(), boss_thekal::Reset(), boss_ingvar_the_plunderer::Reset(), boss_illidan_stormrage::Reset(), boss_pathaleon_the_calculator::Reset(), Respawn(), ScriptedAI::SetEquipmentSlots(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_partygoer_pather::UpdateAI(), npc_partygoer::UpdateAI(), npc_forest_frog::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), and npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI().

◆ LoadFromDB()

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

References LoadCreatureFromDB().

Referenced by GridObjectLoader::LoadCreatures().

◆ LoadPath()

◆ LoadSparringPct()

void Creature::LoadSparringPct ( )
2865{
2866 ObjectGuid::LowType spawnId = GetSpawnId();
2867 auto const& sparringData = sObjectMgr->GetSparringData();
2868
2869 auto itr = sparringData.find(spawnId);
2870 if (itr != sparringData.end() && !itr->second.empty())
2871 {
2872 _sparringPct = itr->second[0];
2873 }
2874}
uint32 LowType
Definition ObjectGuid.h:125

References _sparringPct, GetSpawnId(), and sObjectMgr.

Referenced by Create(), setDeathState(), and UpdateEntry().

◆ LoadTemplateImmunities()

void Creature::LoadTemplateImmunities ( int32  creatureImmunitiesId)
2270{
2271 // uint32 max used for "spell id", the immunity system will not perform SpellInfo checks against invalid spells
2272 // used so we know which immunities were loaded from template
2273 static uint32 constexpr placeholderSpellId = std::numeric_limits<uint32>::max();
2274
2275 auto applyCreatureImmunities = [this](CreatureImmunities const* immunities, bool apply)
2276 {
2277 if (!immunities)
2278 return;
2279 for (std::size_t i = 0; i < immunities->School.size(); ++i)
2280 if (immunities->School[i])
2281 ApplySpellImmune(placeholderSpellId, IMMUNITY_SCHOOL, 1 << i, apply);
2282 for (std::size_t i = 0; i < immunities->DispelType.size(); ++i)
2283 if (immunities->DispelType[i])
2284 ApplySpellImmune(placeholderSpellId, IMMUNITY_DISPEL, i, apply);
2285 for (std::size_t i = 0; i < immunities->Mechanic.size(); ++i)
2286 if (immunities->Mechanic[i])
2287 ApplySpellImmune(placeholderSpellId, IMMUNITY_MECHANIC, i, apply);
2288 for (SpellEffects effect : immunities->Effect)
2289 ApplySpellImmune(placeholderSpellId, IMMUNITY_EFFECT, effect, apply);
2290 for (AuraType aura : immunities->Aura)
2291 ApplySpellImmune(placeholderSpellId, IMMUNITY_STATE, aura, apply);
2292 };
2293
2294 // unapply old template if any
2295 if (CreatureImmunities const* oldImmunities = sSpellMgr->GetCreatureImmunities(_creatureImmunitiesId))
2296 applyCreatureImmunities(oldImmunities, false);
2297
2298 // apply requested immunities
2299 if (CreatureImmunities const* newImmunities = sSpellMgr->GetCreatureImmunities(creatureImmunitiesId))
2300 {
2301 _creatureImmunitiesId = creatureImmunitiesId;
2302 applyCreatureImmunities(newImmunities, true);
2303 }
2304 else
2306}
SpellEffects
Definition SharedDefines.h:766
@ IMMUNITY_STATE
Definition SharedDefines.h:1399
@ IMMUNITY_EFFECT
Definition SharedDefines.h:1398
@ IMMUNITY_MECHANIC
Definition SharedDefines.h:1403
@ IMMUNITY_SCHOOL
Definition SharedDefines.h:1400
@ IMMUNITY_DISPEL
Definition SharedDefines.h:1402
AuraType
Definition SpellAuraDefines.h:62
Definition SpellAuras.h:88
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
Definition Unit.cpp:10247
void apply(T *val)
Definition ByteConverter.h:40
std::bitset< MAX_MECHANIC > Mechanic
Definition SpellMgr.h:576
std::bitset< MAX_SPELL_SCHOOL > School
Definition SpellMgr.h:574
std::bitset< DISPEL_MAX > DispelType
Definition SpellMgr.h:575

References _creatureImmunitiesId, Unit::ApplySpellImmune(), CreatureImmunities::Aura, CreatureImmunities::DispelType, CreatureImmunities::Effect, IMMUNITY_DISPEL, IMMUNITY_EFFECT, IMMUNITY_MECHANIC, IMMUNITY_SCHOOL, IMMUNITY_STATE, CreatureImmunities::Mechanic, CreatureImmunities::School, and sSpellMgr.

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

◆ LowerPlayerDamageReq()

void Creature::LowerPlayerDamageReq ( uint32  unDamage,
bool  damagedByPlayer = true,
uint8  attackerLevel = 0 
)
3929{
3930 if (_playerDamageReq)
3931 _playerDamageReq > unDamage ? _playerDamageReq -= unDamage : _playerDamageReq = 0;
3932
3933 if (!_damagedByPlayer)
3934 {
3935 _damagedByPlayer = damagedByPlayer;
3936 }
3937
3938 if (attackerLevel > _highestPlayerAttackerLevel)
3939 _highestPlayerAttackerLevel = attackerLevel;
3940}

References _damagedByPlayer, _highestPlayerAttackerLevel, 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_kologarn::DamageTaken(), Unit::DealDamage(), boss_yoggsaron::DoAction(), boss_ichoron::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::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(), npc_target_dummy::Reset(), boss_xt002::SetData(), boss_viscidus::SummonedCreatureDies(), and npc_boneguard_footman::npc_boneguard_footmanAI::UpdateAI().

◆ ModifyThreatPercentTemp()

void Creature::ModifyThreatPercentTemp ( Unit *  victim,
int32  percent,
Milliseconds  duration 
)
3908{
3909 if (victim)
3910 {
3911 float currentThreat = GetThreatMgr().GetThreat(victim);
3912
3913 if (percent != 0.0f)
3914 {
3915 GetThreatMgr().ModifyThreatByPercent(victim, percent);
3916 }
3917
3918 TemporaryThreatModifierEvent* pEvent = new TemporaryThreatModifierEvent(*this, victim->GetGUID(), currentThreat);
3919 m_Events.AddEventAtOffset(pEvent, duration);
3920 }
3921}
Definition Creature.h:598
void ModifyThreatByPercent(Unit *target, int32 percent)
Definition ThreatManager.h:150
float GetThreat(Unit const *who, bool includeOffline=false) const
Definition ThreatManager.cpp:308

References EventProcessor::AddEventAtOffset(), Object::GetGUID(), ThreatManager::GetThreat(), Unit::GetThreatMgr(), WorldObject::m_Events, and ThreatManager::ModifyThreatByPercent().

◆ Motion_Initialize()

void Creature::Motion_Initialize ( )
1140{
1141 if (!m_formation)
1143 else if (m_formation->GetLeader() == this)
1144 {
1145 m_formation->FormationReset(false, true);
1147 }
1148 else if (m_formation->IsFormed())
1149 {
1150 // If the leader is already moving, start following immediately
1151 // instead of waiting for the next waypoint signal.
1152 if (Creature* leader = m_formation->GetLeader())
1153 {
1154 if (leader->IsAlive() && !leader->movespline->Finalized())
1155 {
1157 return;
1158 }
1159 }
1160 GetMotionMaster()->MoveIdle(); //wait the order of leader
1161 }
1162 else
1164}
void FormationReset(bool dismiss, bool initMotionMaster)
Definition CreatureGroups.cpp:386
bool IsFormed() const
Definition CreatureGroups.h:108
void LeaderStartedMoving()
Definition CreatureGroups.cpp:410
void Initialize()
Definition MotionMaster.cpp:76
void MoveIdle()
Definition MotionMaster.cpp:235

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

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

◆ PauseMovementForInteraction()

void Creature::PauseMovementForInteraction ( )
3178{
3179 if (uint32 pause = GetMovementTemplate().GetInteractionPauseTimer())
3180 {
3181 uint8 pauseSlot = MOTION_SLOT_IDLE;
3182
3183 if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE) == POINT_MOTION_TYPE)
3184 pauseSlot = MOTION_SLOT_ACTIVE;
3185 else if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == POINT_MOTION_TYPE)
3186 pauseSlot = MOTION_SLOT_CONTROLLED;
3187
3188 PauseMovement(pause, pauseSlot);
3189 }
3190}
@ MOTION_SLOT_CONTROLLED
Definition MotionMaster.h:66
@ MOTION_SLOT_ACTIVE
Definition MotionMaster.h:65
@ POINT_MOTION_TYPE
Definition MotionMaster.h:48
virtual void PauseMovement(uint32 timer=0, uint8 slot=0)
Disable the unit movement by clearing UNIT_STATE_MOVING and stopping the spline.
Definition Unit.cpp:12728

References Unit::GetMotionMaster(), GetMovementTemplate(), MOTION_SLOT_ACTIVE, MOTION_SLOT_CONTROLLED, MOTION_SLOT_IDLE, Unit::PauseMovement(), and POINT_MOTION_TYPE.

Referenced by WorldSession::HandleBattlemasterHelloOpcode(), WorldSession::HandleGossipHelloOpcode(), WorldSession::HandleQuestgiverHelloOpcode(), and WorldSession::SendListInventory().

◆ ProhibitSpellSchool()

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

Reimplemented from Unit.

2971{
2972 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
2973 {
2974 if (idSchoolMask & (1 << i))
2975 {
2976 m_ProhibitSchoolTime[i] = GameTime::GetGameTimeMS().count() + unTimeMs;
2977 }
2978 }
2979}

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

◆ reachWithSpellAttack()

SpellInfo const * Creature::reachWithSpellAttack ( Unit *  victim)
2355{
2356 if (!victim)
2357 return nullptr;
2358
2359 for (uint32 i = 0; i < MAX_CREATURE_SPELLS; ++i)
2360 {
2361 if (!m_spells[i])
2362 continue;
2363 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]);
2364 if (!spellInfo)
2365 {
2366 LOG_ERROR("entities.unit", "WORLD: unknown spell id {}", m_spells[i]);
2367 continue;
2368 }
2369
2370 bool bcontinue = true;
2371 for (uint32 j = 0; j < MAX_SPELL_EFFECTS; j++)
2372 {
2373 if ((spellInfo->Effects[j].Effect == SPELL_EFFECT_SCHOOL_DAMAGE) ||
2374 (spellInfo->Effects[j].Effect == SPELL_EFFECT_INSTAKILL) ||
2375 (spellInfo->Effects[j].Effect == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) ||
2376 (spellInfo->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH)
2377 )
2378 {
2379 bcontinue = false;
2380 break;
2381 }
2382 }
2383 if (bcontinue)
2384 continue;
2385
2386 if (spellInfo->ManaCost > GetPower(POWER_MANA))
2387 continue;
2388 float range = spellInfo->GetMaxRange(false);
2389 float minrange = spellInfo->GetMinRange(false);
2390 float dist = GetDistance(victim);
2391 if (dist > range || dist < minrange)
2392 continue;
2394 continue;
2396 continue;
2397 return spellInfo;
2398 }
2399 return nullptr;
2400}
@ SPELL_EFFECT_HEALTH_LEECH
Definition SharedDefines.h:775
@ SPELL_EFFECT_ENVIRONMENTAL_DAMAGE
Definition SharedDefines.h:773
@ SPELL_EFFECT_SCHOOL_DAMAGE
Definition SharedDefines.h:768
@ SPELL_EFFECT_INSTAKILL
Definition SharedDefines.h:767
@ SPELL_PREVENTION_TYPE_SILENCE
Definition SharedDefines.h:1558
@ SPELL_PREVENTION_TYPE_PACIFY
Definition SharedDefines.h:1559
@ UNIT_FLAG_PACIFIED
Definition UnitDefines.h:274
uint32 PreventionType
Definition SpellInfo.h:414
float GetMaxRange(bool positive=false, WorldObject *caster=nullptr, Spell *spell=nullptr) const
Definition SpellInfo.cpp:2764
float GetMinRange(bool positive=false) const
Definition SpellInfo.cpp:2755
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition SpellInfo.h:417
uint32 ManaCost
Definition SpellInfo.h:387
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:1304

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)
2403{
2404 if (!victim)
2405 return nullptr;
2406
2407 for (uint32 i = 0; i < MAX_CREATURE_SPELLS; ++i)
2408 {
2409 if (!m_spells[i])
2410 continue;
2411 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]);
2412 if (!spellInfo)
2413 {
2414 LOG_ERROR("entities.unit", "WORLD: unknown spell id {}", m_spells[i]);
2415 continue;
2416 }
2417
2418 bool bcontinue = true;
2419 for (uint32 j = 0; j < MAX_SPELL_EFFECTS; j++)
2420 {
2421 if ((spellInfo->Effects[j].Effect == SPELL_EFFECT_HEAL))
2422 {
2423 bcontinue = false;
2424 break;
2425 }
2426 }
2427 if (bcontinue)
2428 continue;
2429
2430 if (spellInfo->ManaCost > GetPower(POWER_MANA))
2431 continue;
2432
2433 float range = spellInfo->GetMaxRange(true);
2434 float minrange = spellInfo->GetMinRange(true);
2435 float dist = GetDistance(victim);
2436
2437 if (dist > range || dist < minrange)
2438 continue;
2440 continue;
2442 continue;
2443 return spellInfo;
2444 }
2445 return nullptr;
2446}

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)
3465{
3466 if (!_isMissingSwimmingFlagOutOfCombat || recheck)
3468
3469 // Check if the creature has UNIT_FLAG_SWIMMING and add it if it's missing
3470 // Creatures must be able to chase a target in water if they can enter water
3473}
@ UNIT_FLAG_SWIMMING
Definition UnitDefines.h:272
bool CanEnterWater() const override
Definition Creature.cpp:3456

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

Referenced by AtEngage().

◆ Regenerate()

void Creature::Regenerate ( Powers  power)
protected
987{
988 uint32 curValue = GetPower(power);
989 uint32 maxValue = GetMaxPower(power);
990
991 // Xinef: implement power regeneration flag
993 return;
994
995 if (!m_regenPower)
996 {
997 return;
998 }
999
1000 if (curValue >= maxValue)
1001 return;
1002
1003 float addvalue = 0.0f;
1004
1005 switch (power)
1006 {
1007 case POWER_FOCUS:
1008 {
1009 // For hunter pets.
1010 addvalue = 24 * sWorld->getRate(RATE_POWER_FOCUS);
1011 break;
1012 }
1013 case POWER_ENERGY:
1014 {
1015 // For deathknight's ghoul.
1016 addvalue = 20;
1017 break;
1018 }
1019 case POWER_MANA:
1020 {
1021 // Combat and any controlled creature
1023 {
1025 {
1026 addvalue = uint32((GetStat(STAT_SPIRIT) / (IsUnderLastManaUseEffect() ? 8.0f : 5.0f) + 17.0f));
1027 }
1028 else if (!IsUnderLastManaUseEffect())
1029 {
1030 float ManaIncreaseRate = sWorld->getRate(RATE_POWER_MANA);
1031 float Spirit = GetStat(STAT_SPIRIT);
1032
1033 addvalue = uint32((Spirit / 5.0f + 17.0f) * ManaIncreaseRate);
1034 }
1035 }
1036 else
1037 addvalue = maxValue / 3;
1038 break;
1039 }
1040 default:
1041 return;
1042 }
1043
1044 // Apply modifiers (if any).
1046
1048
1049 ModifyPower(power, int32(addvalue));
1050}
constexpr auto IN_MILLISECONDS
Definition Common.h:53
constexpr Milliseconds PET_FOCUS_REGEN_INTERVAL
Definition CreatureData.h:38
@ NPC_WATER_ELEMENTAL_TEMP
Definition PetDefines.h:105
@ NPC_IMP
Definition PetDefines.h:96
@ NPC_WATER_ELEMENTAL_PERM
Definition PetDefines.h:107
@ POWER_ENERGY
Definition SharedDefines.h:260
@ POWER_FOCUS
Definition SharedDefines.h:259
@ STAT_SPIRIT
Definition SharedDefines.h:250
@ SPELL_AURA_MOD_POWER_REGEN
Definition SpellAuraDefines.h:148
@ SPELL_AURA_MOD_POWER_REGEN_PERCENT
Definition SpellAuraDefines.h:173
@ UNIT_FLAG2_REGENERATE_POWER
Definition UnitDefines.h:306
@ RATE_POWER_MANA
Definition WorldConfig.h:405
@ RATE_POWER_FOCUS
Definition WorldConfig.h:410
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition Unit.cpp:10842
bool IsUnderLastManaUseEffect() const
Definition Unit.cpp:13331
float GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_value) const
Definition Unit.cpp:6156
bool HasUnitFlag2(UnitFlags2 flags) const
Definition Unit.h:759
int32 GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const
Definition Unit.cpp:6146

References CREATURE_REGEN_INTERVAL, Unit::GetCharmerOrOwnerGUID(), Object::GetEntry(), Unit::GetMaxPower(), Unit::GetOwnerGUID(), Unit::GetPower(), Unit::GetStat(), Unit::GetTotalAuraModifierByMiscValue(), Unit::GetTotalAuraMultiplierByMiscValue(), 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
1053{
1054 if (!isRegeneratingHealth())
1055 return;
1056
1057 uint32 curValue = GetHealth();
1058 uint32 maxValue = GetMaxHealth();
1059
1060 if (curValue >= maxValue)
1061 return;
1062
1063 uint32 addvalue = 0;
1064
1065 // Not only pet, but any controlled creature
1066 // Xinef: fix polymorph rapid regen
1068 addvalue = maxValue / 3;
1069 else //if (GetCharmerOrOwnerGUID())
1070 {
1071 float HealthIncreaseRate = sWorld->getRate(RATE_HEALTH);
1072 float Spirit = GetStat(STAT_SPIRIT);
1073
1074 if (GetPower(POWER_MANA) > 0)
1075 addvalue = uint32(Spirit * 0.25 * HealthIncreaseRate);
1076 else
1077 addvalue = uint32(Spirit * 0.80 * HealthIncreaseRate);
1078 }
1079
1080 // Apply modifiers (if any).
1082
1084
1085 ModifyHealth(addvalue);
1086}
@ SPELL_AURA_MOD_HEALTH_REGEN_PERCENT
Definition SpellAuraDefines.h:151
@ SPELL_AURA_MOD_REGEN
Definition SpellAuraDefines.h:147
@ RATE_HEALTH
Definition WorldConfig.h:404
bool isRegeneratingHealth()
Definition Creature.h:327
int32 ModifyHealth(int32 val)
Definition Unit.cpp:10784
bool IsPolymorphed() const
Definition Unit.cpp:12816
uint32 GetHealth() const
Definition Unit.h:1122
float GetTotalAuraMultiplier(AuraType auratype) const
Definition Unit.cpp:6091

References CREATURE_REGEN_INTERVAL, Unit::GetCharmerOrOwnerGUID(), Unit::GetHealth(), Unit::GetMaxHealth(), Unit::GetPower(), Unit::GetStat(), Unit::GetTotalAuraModifier(), Unit::GetTotalAuraMultiplier(), 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)
3655{
3656 // focused to something else
3657 if (focusSpell != _focusSpell)
3658 return;
3659
3660 _focusSpell = nullptr;
3663
3664 if (focusSpell->GetSpellInfo()->HasAttribute(SPELL_ATTR5_AI_DOESNT_FACE_TARGET))
3666}
void Clear()
Definition ObjectGuid.h:141

References _focusSpell, _spellFocusTarget, ObjectGuid::Clear(), Unit::ClearUnitState(), Spell::GetSpellInfo(), 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 
)
424{
426 return;
427
429 {
433 if (!skipVisibility) // pussywizard
434 DestroyForVisiblePlayers(); // pussywizard: previous UpdateObjectVisibility()
435 loot.clear();
436 uint32 respawnDelay = m_respawnDelay;
437 if (IsAIEnabled)
438 AI()->CorpseRemoved(respawnDelay);
439
440 // Should get removed later, just keep "compatibility" with scripts
441 if (setSpawnTime)
442 {
443 m_respawnTime = GameTime::GetGameTime().count() + respawnDelay;
444 //SaveRespawnTime();
445 }
446
447 float x, y, z, o;
448 GetRespawnPosition(x, y, z, &o);
449 SetHomePosition(x, y, z, o);
450 SetPosition(x, y, z, o);
451
452 // xinef: relocate notifier
453 m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f);
454
455 // pussywizard: if corpse was removed during falling then the falling will continue after respawn, so stop falling is such case
456 if (IsFalling())
457 StopMoving();
458 }
459 else
460 {
461 // Dynamic spawn mode: save respawn time and remove the object entirely.
462 // A fresh creature will be spawned by ProcessRespawns() when the timer expires.
463 loot.clear();
464 uint32 respawnDelay = m_respawnDelay;
465 if (IsAIEnabled)
466 AI()->CorpseRemoved(respawnDelay);
467
468 // Always save respawn time in non-compat mode since the creature is being
469 // destroyed — ProcessRespawns() needs the entry to know when to recreate it.
470 // m_respawnTime was already set in setDeathState(JustDied).
471 if (setSpawnTime)
472 m_respawnTime = std::max<time_t>(GameTime::GetGameTime().count() + respawnDelay, m_respawnTime);
474
476 }
477}
virtual void CorpseRemoved(uint32 &)
== Triggered Actions Requested ==================
Definition CreatureAI.h:233
void GetRespawnPosition(float &x, float &y, float &z, float *ori=nullptr, float *dist=nullptr) const
Definition Creature.cpp:3129
void SaveRespawnTime() override
Definition Creature.cpp:2684
void SetPosition(float x, float y, float z, float o)
Definition Creature.cpp:3366
DeathState getDeathState()
Definition Unit.h:1806
void StopMoving()
Definition Unit.cpp:12709
Position m_last_notify_position
Definition Unit.h:2128
void RemoveAllAuras()
Definition Unit.cpp:5393
bool IsFalling() const
Definition Unit.cpp:15623
void AddObjectToRemoveList()
Definition Object.cpp:2239
void clear()
Definition LootMgr.h:343

References _respawnCompatibilityMode, WorldObject::AddObjectToRemoveList(), AI(), Loot::clear(), Corpse, CreatureAI::CorpseRemoved(), Dead, WorldObject::DestroyForVisiblePlayers(), 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(), SaveRespawnTime(), setDeathState(), SetHomePosition(), SetPosition(), and Unit::StopMoving().

Referenced by OPvPCapturePoint::DelCreature(), DisappearAndDie(), RespawnEvent::Execute(), ForcedDespawn(), 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(), ValithriaDespawner::operator()(), Respawn(), npc_simone::npc_simoneAI::RespawnPet(), and Update().

◆ RemoveFromWorld()

void Creature::RemoveFromWorld ( )
overridevirtual

Reimplemented from Object.

Reimplemented in TempSummon, Minion, Puppet, Pet, and TestCreature.

343{
344 if (IsInWorld())
345 {
346 sScriptMgr->OnCreatureRemoveWorld(this);
347
348 if (GetZoneScript())
350
351 if (m_formation)
352 sFormationMgr->RemoveCreatureFromGroup(m_formation, this);
353
354 if (Transport* transport = GetTransport())
355 transport->RemovePassenger(this, true);
356
358
359 if (m_spawnId)
360 Acore::Containers::MultimapErasePair(GetMap()->GetCreatureBySpawnIdStore(), m_spawnId, this);
361
363 }
364}
#define sFormationMgr
Definition CreatureGroups.h:136
Definition Transport.h:30
bool Remove(KEY_TYPE const &handle)
Definition TypeContainer.h:183
void RemoveFromWorld() override
Definition Unit.cpp:12224
virtual void OnCreatureRemove(Creature *)
Definition ZoneScript.h:35
void MultimapErasePair(M< K, V, Rest... > &multimap, K const &key, V const &value)
Definition Containers.h:236

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
249{ m_LootMode &= ~lootMode; }

References m_LootMode.

Referenced by boss_yoggsaron::boss_yoggsaron().

◆ RemoveSpellCooldown()

void Creature::RemoveSpellCooldown ( uint32  spell_id,
bool  update 
)
3095{
3096 m_CreatureSpellCooldowns.erase(spell_id);
3097
3098 if (update)
3099 {
3100 if (Player* playerOwner = GetCharmerOrOwnerPlayerOrPlayerItself())
3101 {
3102 WorldPacket data(SMSG_CLEAR_COOLDOWN, 4 + 8);
3103 data << uint32(spell_id);
3104 data << GetGUID();
3105 playerOwner->SendDirectMessage(&data);
3106 }
3107 }
3108}
@ SMSG_CLEAR_COOLDOWN
Definition Opcodes.h:508

References Unit::GetCharmerOrOwnerPlayerOrPlayerItself(), Object::GetGUID(), m_CreatureSpellCooldowns, and SMSG_CLEAR_COOLDOWN.

Referenced by Aura::_UnapplyForTarget(), and WorldSession::HandlePetActionHelper().

◆ ResetLootMode()

◆ ResetPickPocketLootTime()

void Creature::ResetPickPocketLootTime ( )
inline

References lootPickPocketRestoreTime.

Referenced by Respawn().

◆ ResetPlayerDamageReq()

◆ Respawn()

void Creature::Respawn ( bool  force = false)
Parameters
forceForce the respawn by killing the creature.
2044{
2045 if (force)
2046 {
2047 if (IsAlive())
2048 {
2050 }
2051 else if (getDeathState() != DeathState::Corpse)
2052 {
2054 }
2055 }
2056
2057 ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_RESPAWN, GetEntry());
2058
2059 if (!sConditionMgr->IsObjectMeetToConditions(this, conditions) && !force)
2060 {
2061 // Creature should not respawn, reset respawn timer. Conditions will be checked again the next time it tries to respawn.
2063 return;
2064 }
2065
2066 bool allowed = !IsAIEnabled || AI()->CanRespawn(); // First check if there are any scripts that prevent us respawning
2067 if (!allowed && !force) // Will be rechecked on next Update call
2068 return;
2069
2070 ObjectGuid dbtableHighGuid = ObjectGuid::Create<HighGuid::Unit>(m_creatureData ? m_creatureData->id : GetEntry(), m_spawnId);
2071 time_t linkedRespawntime = GetMap()->GetLinkedRespawnTime(dbtableHighGuid);
2072
2073 CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(GetEntry());
2074
2075 if (!linkedRespawntime || (cInfo && cInfo->HasFlagsExtra(CREATURE_FLAG_EXTRA_HARD_RESET)) || force) // Should respawn
2076 {
2078 {
2079 RemoveCorpse(false, false);
2080
2082 {
2083 if (m_spawnId)
2084 {
2086 CreatureData const* data = sObjectMgr->GetCreatureData(m_spawnId);
2087 // Respawn check if spawn has 2 entries
2088 if (data->id2)
2089 {
2090 uint32 entry = GetRandomId(data->id, data->id2, data->id3);
2091 UpdateEntry(entry, data, true); // Select Random Entry
2092 m_defaultMovementType = MovementGeneratorType(data->movementType); // Reload Movement Type
2093 LoadEquipment(data->equipmentId); // Reload Equipment
2094 AIM_Initialize(); // Reload AI
2095 }
2096 else
2097 {
2098 if (m_originalEntry != GetEntry())
2100 }
2101 }
2102
2103 LOG_DEBUG("entities.unit", "Respawning creature {} (SpawnId: {}, {})", GetName(), GetSpawnId(), GetGUID().ToString());
2104 m_respawnTime = 0;
2106 loot.clear();
2107 SelectLevel();
2108
2111
2112 // MDic - Acidmanifesto: Do not override transform auras
2114 {
2116 CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&display, GetCreatureTemplate());
2117 if (minfo) // Cancel load if no model defined
2118 {
2119 _nativeObjectScale = display.DisplayScale;
2120 SetDisplayId(display.CreatureDisplayID);
2121 SetNativeDisplayId(display.CreatureDisplayID);
2122 }
2123 }
2124
2126
2127 //Call AI respawn virtual function
2128 if (IsAIEnabled)
2129 {
2130 //reset the AI to be sure no dirty or uninitialized values will be used till next tick
2131 AI()->Reset();
2132 TriggerJustRespawned = true; //delay event to next tick so all creatures are created on the map before processing
2133 }
2134
2135 uint32 poolid = m_spawnId ? sPoolMgr->IsPartOfAPool<Creature>(m_spawnId) : 0;
2136 if (poolid)
2137 sPoolMgr->UpdatePool<Creature>(GetMap()->GetPoolData(), poolid, m_spawnId);
2138
2139 //Re-initialize reactstate that could be altered by movementgenerators
2141
2142 }
2144 // xinef: relocate notifier, fixes npc appearing in corpse position after forced respawn (instead of spawn)
2145 m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f);
2147 }
2148 else
2149 {
2150 // Non-compat mode: destroy and let ProcessRespawns() recreate
2151 if (IsAlive())
2152 return;
2153
2154 if (m_spawnId)
2155 {
2156 // Set respawn time to now so ProcessRespawns() picks it up
2157 if (force)
2159 else
2160 {
2161 time_t now = GameTime::GetGameTime().count();
2163 }
2164 }
2166 }
2167 }
2168 else // the master is dead
2169 {
2170 ObjectGuid targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid);
2171 if (targetGuid == dbtableHighGuid) // if linking self, never respawn (check delayed to next day)
2172 {
2174 }
2175 else
2176 {
2177 time_t now = GameTime::GetGameTime().count();
2178 m_respawnTime = (now > linkedRespawntime ? now : linkedRespawntime) + urand(5, MINUTE); // else copy time from master and add a little
2179 }
2180 SaveRespawnTime(); // also save to DB immediately
2181 }
2182}
constexpr auto DAY
Definition Common.h:49
constexpr auto MINUTE
Definition Common.h:47
#define sConditionMgr
Definition ConditionMgr.h:296
@ CONDITION_SOURCE_TYPE_CREATURE_RESPAWN
Definition ConditionMgr.h:155
std::list< Condition * > ConditionList
Definition ConditionMgr.h:240
@ CREATURE_FLAG_EXTRA_HARD_RESET
Definition CreatureData.h:77
#define sPoolMgr
Definition PoolMgr.h:216
@ SPELL_AURA_TRANSFORM
Definition SpellAuraDefines.h:119
virtual bool CanRespawn()
Definition CreatureAI.h:119
void SetRespawnTime(uint32 respawn)
Definition Creature.cpp:3897
void SelectLevel(bool changelevel=true)
Definition Creature.cpp:1511
void InitializeReactState()
Check if the creature has the specified ReactState.
Definition Creature.cpp:2249
void ResetPickPocketLootTime()
Definition Creature.h:240
time_t GetLinkedRespawnTime(ObjectGuid guid) const
Definition Map.cpp:3077
void ForceCreatureRespawn(ObjectGuid::LowType dbGuid)
Definition Map.cpp:2522
void SaveCreatureRespawnTime(ObjectGuid::LowType dbGuid, time_t &respawnTime)
Definition Map.cpp:2477
SpawnedPoolData & GetPoolData()
Definition Map.h:384
void InitDefault()
Definition MotionMaster.cpp:90
Definition ObjectGuid.h:121
virtual void Reset()
Definition UnitAI.h:211
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition Unit.h:1445
void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false) override
Definition Unit.cpp:15060
int8 equipmentId
Definition CreatureData.h:376

References _nativeObjectScale, _respawnCompatibilityMode, WorldObject::AddObjectToRemoveList(), AI(), AIM_Initialize(), CreatureAI::CanRespawn(), Loot::clear(), CONDITION_SOURCE_TYPE_CREATURE_RESPAWN, Corpse, CREATURE_FLAG_EXTRA_HARD_RESET, CreatureModel::CreatureDisplayID, DAY, Dead, CreatureModel::DisplayScale, CreatureData::equipmentId, Map::ForceCreatureRespawn(), Unit::GetAuraEffectsByType(), GetCreatureTemplate(), Unit::getDeathState(), Object::GetEntry(), GameTime::GetGameTime(), Object::GetGUID(), Map::GetLinkedRespawnTime(), WorldObject::GetMap(), Unit::GetMotionMaster(), WorldObject::GetName(), Unit::GetNativeDisplayId(), GetNativeObjectScale(), Map::GetPoolData(), GetRandomId(), GetSpawnId(), CreatureTemplate::HasFlagsExtra(), CreatureData::id, CreatureData::id2, CreatureData::id3, MotionMaster::InitDefault(), InitializeReactState(), Unit::IsAIEnabled, Unit::IsAlive(), JustDied, JustRespawned, LoadEquipment(), LOG_DEBUG, loot, m_creatureData, m_defaultMovementType, Unit::m_last_notify_position, m_originalEntry, m_respawnDelay, m_respawnedTime, m_respawnTime, m_spawnId, MINUTE, CreatureData::movementType, Position::Relocate(), RemoveCorpse(), Map::RemoveCreatureRespawnTime(), UnitAI::Reset(), ResetPickPocketLootTime(), Map::SaveCreatureRespawnTime(), SaveRespawnTime(), sConditionMgr, SelectLevel(), setDeathState(), Unit::SetDisplayId(), Unit::SetNativeDisplayId(), SetRespawnTime(), sObjectMgr, SPELL_AURA_TRANSFORM, sPoolMgr, Position::ToString(), TriggerJustRespawned, UpdateEntry(), Unit::UpdateObjectVisibility(), and urand().

Referenced by BattlegroundAV::AddAVCreature(), RespawnEvent::Execute(), npc_commandscript::HandleNpcMoveCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetWanderDistanceCommand(), misc_commandscript::HandleRespawnCommand(), 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::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::SetBossState(), instance_halls_of_reflection::SetData(), Battlefield::ShowNpc(), boss_warchief_kargath_bladefist::SummonedCreatureDies(), Update(), npc_escortAI::UpdateAI(), and InstanceScript::UpdateMinionState().

◆ ResumeChasingVictim()

◆ SaveRespawnTime()

◆ SaveToDB() [1/2]

void Creature::SaveToDB ( )
1397{
1398 // this should only be used when the creature has already been loaded
1399 // preferably after adding to map, because mapid may not be valid otherwise
1400 CreatureData const* data = sObjectMgr->GetCreatureData(m_spawnId);
1401 if (!data)
1402 {
1403 LOG_ERROR("entities.unit", "Creature::SaveToDB failed, cannot get creature data!");
1404 return;
1405 }
1406
1408 SaveToDB(mapId, data->spawnMask, GetPhaseMask());
1409}
void SaveToDB()
Definition Creature.cpp:1396
GameObjectTemplate const * GetGOInfo() const
Definition GameObject.h:141
MotionTransport * ToMotionTransport()
Definition GameObject.h:347
uint32 GetMapId() const
Definition Position.h:281
uint32 mapID
Definition GameObjectData.h:223
struct GameObjectTemplate::@237::@252 moTransport
uint8 spawnMask
Definition SpawnData.h:75

References GameObject::GetGOInfo(), WorldLocation::GetMapId(), WorldObject::GetPhaseMask(), WorldObject::GetTransport(), LOG_ERROR, m_spawnId, GameObjectTemplate::mapID, GameObjectTemplate::moTransport, SaveToDB(), sObjectMgr, SpawnData::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.

1412{
1413 // update in loaded data
1414 if (!m_spawnId)
1415 m_spawnId = sObjectMgr->GenerateCreatureSpawnId();
1416
1417 CreatureData& data = sObjectMgr->NewOrExistCreatureData(m_spawnId);
1418 data.spawnId = m_spawnId;
1419 uint32 displayId = GetNativeDisplayId();
1420 uint32 npcflag = GetNpcFlags();
1421 uint32 unit_flags = GetUnitFlags();
1422 uint32 dynamicflags = GetDynamicFlags();
1423
1424 // check if it's a custom model and if not, use 0 for displayId
1425 CreatureTemplate const* cinfo = GetCreatureTemplate();
1426 if (cinfo)
1427 {
1428 for (CreatureModel model : cinfo->Models)
1429 if (displayId && displayId == model.CreatureDisplayID)
1430 displayId = 0;
1431
1432 if (npcflag == cinfo->npcflag)
1433 npcflag = 0;
1434
1435 if (unit_flags == cinfo->unit_flags)
1436 unit_flags = 0;
1437
1438 if (dynamicflags == cinfo->dynamicflags)
1439 dynamicflags = 0;
1440 }
1441
1442 data.id = GetEntry();
1443 data.mapid = mapid;
1444 data.phaseMask = phaseMask;
1445 data.displayid = displayId;
1447 if (!GetTransport())
1448 {
1449 data.posX = GetPositionX();
1450 data.posY = GetPositionY();
1451 data.posZ = GetPositionZ();
1452 data.orientation = GetOrientation();
1453 }
1454 else
1455 {
1456 data.posX = GetTransOffsetX();
1457 data.posY = GetTransOffsetY();
1458 data.posZ = GetTransOffsetZ();
1460 }
1461
1463 // prevent add data integrity problems
1465 data.currentwaypoint = 0;
1466 data.curhealth = GetHealth();
1467 data.curmana = GetPower(POWER_MANA);
1468 // prevent add data integrity problems
1471 data.spawnMask = spawnMask;
1472 data.npcflag = npcflag;
1473 data.unit_flags = unit_flags;
1474 data.dynamicflags = dynamicflags;
1475
1476 // update in DB
1477 WorldDatabaseTransaction trans = WorldDatabase.BeginTransaction();
1478
1480 stmt->SetData(0, m_spawnId);
1481 trans->Append(stmt);
1482
1483 uint8 index = 0;
1484
1485 stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_CREATURE);
1486 stmt->SetData(index++, m_spawnId);
1487 stmt->SetData(index++, GetEntry());
1488 stmt->SetData(index++, uint16(mapid));
1489 stmt->SetData(index++, spawnMask);
1490 stmt->SetData(index++, GetPhaseMask());
1491 stmt->SetData(index++, int32(GetCurrentEquipmentId()));
1492 stmt->SetData(index++, GetPositionX());
1493 stmt->SetData(index++, GetPositionY());
1494 stmt->SetData(index++, GetPositionZ());
1495 stmt->SetData(index++, GetOrientation());
1496 stmt->SetData(index++, m_respawnDelay);
1497 stmt->SetData(index++, m_wanderDistance);
1498 stmt->SetData(index++, 0);
1499 stmt->SetData(index++, GetHealth());
1500 stmt->SetData(index++, GetPower(POWER_MANA));
1501 stmt->SetData(index++, uint8(GetDefaultMovementType()));
1502 stmt->SetData(index++, npcflag);
1503 stmt->SetData(index++, unit_flags);
1504 stmt->SetData(index++, dynamicflags);
1505 trans->Append(stmt);
1506
1507 WorldDatabase.CommitTransaction(trans);
1508 sScriptMgr->OnCreatureSaveToDB(this);
1509}
@ WORLD_INS_CREATURE
Definition WorldDatabase.h:94
Models
Definition boss_black_knight.cpp:79
uint8 GetCurrentEquipmentId()
Definition Creature.h:198
MovementGeneratorType GetDefaultMovementType() const override
-------—End of Pet responses methods-------—
Definition Creature.h:90
NPCFlags GetNpcFlags() const
Clears emote state (looping emote)
Definition Unit.h:768
UnitFlags GetUnitFlags() const
Definition Unit.h:752
uint32 GetDynamicFlags() const override
Definition Unit.h:774
float GetTransOffsetX() const
Definition Object.h:702
float GetTransOffsetY() const
Definition Object.h:703
float GetTransOffsetZ() const
Definition Object.h:704
float GetTransOffsetO() const
Definition Object.h:705
uint32 dynamicflags
Definition CreatureData.h:385
uint32 displayid
Definition CreatureData.h:375
uint32 unit_flags
Definition CreatureData.h:384
uint32 currentwaypoint
Definition CreatureData.h:379
uint32 unit_flags
Definition CreatureData.h:214
uint32 npcflag
Definition CreatureData.h:200
uint32 dynamicflags
Definition CreatureData.h:216
ObjectGuid::LowType spawnId
Definition SpawnData.h:68
uint16 mapid
Definition SpawnData.h:69

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::id, IDLE_MOTION_TYPE, m_respawnDelay, m_spawnId, m_wanderDistance, SpawnData::mapid, CreatureTemplate::Models, CreatureData::movementType, CreatureTemplate::npcflag, CreatureData::npcflag, SpawnData::orientation, SpawnData::phaseMask, SpawnData::posX, SpawnData::posY, SpawnData::posZ, POWER_MANA, RANDOM_MOTION_TYPE, PreparedStatementBase::SetData(), sObjectMgr, SpawnData::spawnId, SpawnData::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 ( )
377{
378 if (IsSummon())
379 {
380 return;
381 }
382
384 if (!spawnId)
385 {
386 return;
387 }
388
389 CreatureGroupInfoType::const_iterator frmdata = sFormationMgr->CreatureGroupMap.find(spawnId);
390 if (frmdata != sFormationMgr->CreatureGroupMap.end())
391 {
392 sFormationMgr->AddCreatureToGroup(frmdata->second.leaderGUID, this);
393 }
394}

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)
1512{
1513 CreatureTemplate const* cInfo = GetCreatureTemplate();
1514
1515 uint32 rank = IsPet() ? 0 : cInfo->rank;
1516
1517 // level
1518 uint8 minlevel = std::min(cInfo->maxlevel, cInfo->minlevel);
1519 uint8 maxlevel = std::max(cInfo->maxlevel, cInfo->minlevel);
1520 uint8 level = minlevel == maxlevel ? minlevel : urand(minlevel, maxlevel);
1521
1522 sScriptMgr->OnBeforeCreatureSelectLevel(cInfo, this, level);
1523
1524 if (changelevel)
1525 SetLevel(level);
1526
1527 CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(level, cInfo->unit_class);
1528
1529 // health
1530 float healthmod = _GetHealthMod(rank);
1531
1532 uint32 basehp = std::max<uint32>(1, stats->GenerateHealth(cInfo));
1533 uint32 health = uint32(basehp * healthmod);
1534
1535 SetCreateHealth(health);
1536 SetMaxHealth(health);
1537 SetHealth(health);
1539
1540 // mana
1541 uint32 mana = stats->GenerateMana(cInfo);
1542
1543 SetCreateMana(mana);
1544 SetMaxPower(POWER_MANA, mana); //MAX Mana
1545 SetPower(POWER_MANA, mana);
1546
1548
1551
1552 // damage
1553
1554 float basedamage = stats->GenerateBaseDamage(cInfo);
1555
1556 float weaponBaseMinDamage = basedamage;
1557 float weaponBaseMaxDamage = basedamage * 1.5;
1558
1559 SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, weaponBaseMinDamage);
1560 SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, weaponBaseMaxDamage);
1561
1562 SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, weaponBaseMinDamage);
1563 SetBaseWeaponDamage(OFF_ATTACK, MAXDAMAGE, weaponBaseMaxDamage);
1564
1565 SetBaseWeaponDamage(RANGED_ATTACK, MINDAMAGE, weaponBaseMinDamage);
1566 SetBaseWeaponDamage(RANGED_ATTACK, MAXDAMAGE, weaponBaseMaxDamage);
1567
1570
1571 sScriptMgr->OnCreatureSelectLevel(cInfo, this);
1572}
@ UNIT_MOD_ATTACK_POWER
Definition Unit.h:173
@ UNIT_MOD_HEALTH
Definition Unit.h:158
@ UNIT_MOD_MANA
Definition Unit.h:159
@ UNIT_MOD_ATTACK_POWER_RANGED
Definition Unit.h:174
void SetCreateHealth(uint32 val)
Definition Unit.h:1142
void SetBaseWeaponDamage(WeaponAttackType attType, WeaponDamageRange damageRange, float value, uint8 damageIndex=0)
Definition Unit.h:1226
void SetMaxPower(Powers power, uint32 val)
Definition Unit.cpp:12159
void SetCreateMana(uint32 val)
Definition Unit.h:1163
void SetLevel(uint8 lvl, bool showLevelChange=true)
Definition Unit.cpp:12002
void SetMaxHealth(uint32 val)
Definition Unit.cpp:12070
void SetStatFlatModifier(UnitMods unitMod, UnitModifierFlatType modifierType, float val)
Definition Unit.cpp:11670
Definition CreatureData.h:298
uint32 RangedAttackPower
Definition CreatureData.h:303
uint32 AttackPower
Definition CreatureData.h:302
float GenerateBaseDamage(CreatureTemplate const *info) const
Definition CreatureData.h:332
uint32 GenerateMana(CreatureTemplate const *info) const
Definition CreatureData.h:318
uint32 GenerateHealth(CreatureTemplate const *info) const
Definition CreatureData.h:313
uint8 minlevel
Definition CreatureData.h:196
uint8 maxlevel
Definition CreatureData.h:197

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::SetPower(), Unit::SetStatFlatModifier(), 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(), Respawn(), and UpdateEntry().

◆ SelectNearestTarget()

Unit * Creature::SelectNearestTarget ( float  dist = 0,
bool  playerOnly = false 
) const

Select nearest hostile unit within the given distance (regardless of threat list).

2452{
2453 if (dist == 0.0f)
2454 {
2456 }
2457
2458 Unit* target = nullptr;
2459
2460 Acore::NearestHostileUnitCheck u_check(this, dist, playerOnly);
2461 Acore::UnitLastSearcher<Acore::NearestHostileUnitCheck> searcher(this, target, u_check);
2462 Cell::VisitObjects(this, searcher, dist);
2463 return target;
2464}
#define MAX_VISIBILITY_DISTANCE
Definition ObjectDefines.h:30
Definition GridNotifiers.h:1218
Definition GridNotifiers.h:429

References MAX_VISIBILITY_DISTANCE, and Cell::VisitObjects().

Referenced by boss_twinemperorsAI::DoAction(), SmartScript::GetTargets(), npc_onyxian_whelp::IsSummonedBy(), 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_grand_champion::boss_grand_championAI::MovementInform(), npc_swarm_scarab::Reset(), npc_nerubian_burrower::Reset(), npc_fel_infernal::Reset(), npc_mistress_of_pain::Reset(), boss_skarvald_the_constructor::Reset(), boss_dalronn_the_controller::Reset(), npc_heated_battle::npc_heated_battleAI::Reset(), boss_alar::ScheduleMainSpellAttack(), npc_memory::npc_memoryAI::UpdateAI(), boss_malygos::UpdateAI(), npc_storm_beacon_spawn::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), npc_pet_gen_target_following_bomb::UpdateAI(), and npc_living_poison::UpdateAI().

◆ SelectNearestTargetInAttackDistance()

Unit * Creature::SelectNearestTargetInAttackDistance ( float  dist) const

Select nearest hostile unit within the given attack distance (i.e. distance is ignored if > than ATTACK_DISTANCE), regardless of threat list.

2470{
2471 if (dist < ATTACK_DISTANCE)
2472 dist = ATTACK_DISTANCE;
2473 if (dist > MAX_SEARCHER_DISTANCE)
2474 dist = MAX_SEARCHER_DISTANCE;
2475
2476 Unit* target = nullptr;
2479 Cell::VisitObjects(this, searcher, std::max(dist, ATTACK_DISTANCE));
2480
2481 return target;
2482}
#define ATTACK_DISTANCE
Definition ObjectDefines.h:25
#define MAX_SEARCHER_DISTANCE
Definition ObjectDefines.h:32
Definition GridNotifiers.h:1247

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

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

◆ SelectVictim()

Unit * Creature::SelectVictim ( )
11315{
11316 // function provides main threat functionality
11317 // next-victim-selection algorithm and evade mode are called
11318 // threat list sorting etc.
11319
11320 Unit* target = nullptr;
11321
11322 if (CanHaveThreatList())
11324 else if (!HasReactState(REACT_PASSIVE))
11325 {
11326 // we have player pet probably
11327 target = getAttackerForHelper();
11328 if (!target && IsSummon())
11329 if (Unit* owner = ToTempSummon()->GetOwner())
11330 {
11331 if (owner->IsInCombat())
11332 target = owner->getAttackerForHelper();
11333 if (!target)
11334 for (ControlSet::const_iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr)
11335 if ((*itr)->IsInCombat())
11336 {
11337 target = (*itr)->getAttackerForHelper();
11338 if (target)
11339 break;
11340 }
11341 }
11342 }
11343 else
11344 return nullptr;
11345
11346 if (target && _IsTargetAcceptable(target) && CanCreatureAttack(target))
11347 {
11348 if (!HasSpellFocus())
11349 SetInFront(target);
11350 return target;
11351 }
11352
11353 // Don't evade if another unit has us on their threat list — evading would
11354 // end the bidirectional combat reference and remove us from their threat list,
11355 // causing them to lose their target (e.g. an NPC fighting a guardian whose
11356 // CanAIAttack rejects the NPC).
11358 return nullptr;
11359
11360 if (GetVehicle())
11361 return nullptr;
11362
11363 // pussywizard: not sure why it's here
11364 // pussywizard: can't evade when having invisibility aura with duration? o_O
11366 if (!iAuras.empty())
11367 {
11368 for (Unit::AuraEffectList::const_iterator itr = iAuras.begin(); itr != iAuras.end(); ++itr)
11369 if ((*itr)->GetBase()->IsPermanent())
11370 {
11372 break;
11373 }
11374 return nullptr;
11375 }
11376
11377 // Last chance: creature group
11378 if (CreatureGroup* group = GetFormation())
11379 {
11380 if (Unit* groupTarget = group->GetNewTargetForMember(this))
11381 {
11382 SetInFront(groupTarget);
11383 return groupTarget;
11384 }
11385 }
11386
11387 // enter in evade mode in other case
11388 AI()->EnterEvadeMode();
11389
11390 return nullptr;
11391}
@ SPELL_AURA_MOD_INVISIBILITY
Definition SpellAuraDefines.h:81
@ EVADE_REASON_NO_HOSTILES
Definition CreatureAI.h:88
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Definition CreatureAI.cpp:235
auto const & GetThreatenedByMeList() const
Definition ThreatManager.h:141
Vehicle * GetVehicle() const
Definition Unit.h:1948
std::vector< AuraEffect * > AuraEffectList
Definition Unit.h:686
ThreatManager m_threatManager
Definition Unit.h:2220

References _IsTargetAcceptable(), AI(), CanCreatureAttack(), Unit::CanHaveThreatList(), CreatureAI::EnterEvadeMode(), CreatureAI::EVADE_REASON_NO_HOSTILES, Unit::getAttackerForHelper(), Unit::GetAuraEffectsByType(), ThreatManager::GetCurrentVictim(), GetFormation(), Unit::GetOwner(), ThreatManager::GetThreatenedByMeList(), Unit::GetVehicle(), HasReactState(), HasSpellFocus(), Unit::IsSummon(), Unit::m_threatManager, REACT_PASSIVE, Unit::SetInFront(), SPELL_AURA_MOD_INVISIBILITY, and Unit::ToTempSummon().

Referenced by StartMovementEvent::Execute(), boss_urom::boss_uromAI::JustSummoned(), boss_gyth::JustSummoned(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_rimefang::npc_rimefangAI::MovementInform(), 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)
2485{
2486 WorldPacket data(SMSG_AI_REACTION, 12);
2487
2488 data << GetGUID();
2489 data << uint32(reactionType);
2490
2491 ((WorldObject*)this)->SendMessageToSet(&data, true);
2492
2493 LOG_DEBUG("network", "WORLD: Sent SMSG_AI_REACTION, type {}.", reactionType);
2494}
Definition Object.h:482
@ SMSG_AI_REACTION
Definition Opcodes.h:346

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.

2878{
2880 data << (uint32)GetAreaId();
2881 sWorldSessionMgr->SendGlobalMessage(&data, nullptr, (attacker->GetTeamId() == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE));
2882}
@ TEAM_ALLIANCE
Definition SharedDefines.h:748
@ TEAM_HORDE
Definition SharedDefines.h:749
#define sWorldSessionMgr
Definition WorldSessionMgr.h:118
TeamId GetTeamId(bool original=false) const
Definition Player.h:2140
uint32 GetAreaId() const
Definition Object.cpp:3186
@ SMSG_ZONE_UNDER_ATTACK
Definition Opcodes.h:626

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

Referenced by GuardAI::JustDied(), and SmartScript::ProcessAction().

◆ SetAssistanceTimer()

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

References m_assistanceTimer.

Referenced by Unit::Attack().

◆ SetCanDualWield()

◆ SetCannotReachTarget()

void Creature::SetCannotReachTarget ( ObjectGuid const &  target = ObjectGuid::Empty)
3733{
3734 if (cannotReach == m_cannotReachTarget)
3735 return;
3736
3737 m_cannotReachTarget = cannotReach;
3738
3739 if (cannotReach)
3740 {
3741 LOG_DEBUG("entities.unit", "Creature::SetCannotReachTarget() called with target {}. Details: {}", cannotReach.ToString(), GetDebugInfo());
3744 }
3745 else
3746 {
3748 }
3749}
void StopEvade()
Definition CombatManager.cpp:461
void StartEvadeTimer()
Definition CombatManager.h:129
std::string GetDebugInfo() const override
Definition Creature.cpp:3986

References Unit::GetCombatManager(), GetDebugInfo(), IsInEvadeMode(), LOG_DEBUG, m_cannotReachTarget, CombatManager::StartEvadeTimer(), CombatManager::StopEvade(), and ObjectGuid::ToString().

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

◆ SetCombatMovement()

void Creature::SetCombatMovement ( bool  allowMovement)
3973{
3974 _isCombatMovementAllowed = allowMovement;
3975}

References _isCombatMovementAllowed.

Referenced by boss_victor_nefarius::BeginEvent(), boss_acidmaw::boss_acidmawAI::boss_acidmawAI(), boss_alar::boss_alar(), boss_blight_worm::boss_blight_wormAI::boss_blight_wormAI(), boss_cthun::boss_cthun(), boss_dorothee::boss_dorothee(), boss_eye_of_cthun::boss_eye_of_cthun(), boss_murmur::boss_murmur(), boss_omor_the_unscarred::boss_omor_the_unscarred(), boss_ouro::boss_ouro(), boss_yoggsaron_constrictor_tentacle::boss_yoggsaron_constrictor_tentacle(), boss_yoggsaron_corruptor_tentacle::boss_yoggsaron_corruptor_tentacle(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacle(), boss_jedoga_shadowseeker::DamageTaken(), boss_illidan_stormrage::DoAction(), npc_toxic_slime::InitializeAI(), boss_freya::JustEngagedWith(), npc_escortAI::JustRespawned(), FollowerAI::JustRespawned(), npc_flame_of_azzinoth::JustSummoned(), boss_zuljin::MovementInform(), boss_ayamiss::MovementInform(), boss_felmyst::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), npc_andorhal_tower::npc_andorhal_towerAI::npc_andorhal_towerAI(), npc_blessed_banner::npc_blessed_bannerAI::npc_blessed_bannerAI(), npc_buru_egg::npc_buru_egg(), npc_claw_tentacle::npc_claw_tentacle(), npc_expedition_trapper::npc_expedition_trapper(), npc_eye_tentacle::npc_eye_tentacle(), npc_giant_claw_tentacle::npc_giant_claw_tentacle(), npc_giant_eye_tentacle::npc_giant_eye_tentacle(), npc_guardian_pavilion::npc_guardian_pavilionAI::npc_guardian_pavilionAI(), npc_tiger_matriarch_credit::npc_tiger_matriarch_creditAI::npc_tiger_matriarch_creditAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::npc_tournament_training_dummyAI(), npc_warmage_coldarra::npc_warmage_coldarraAI::npc_warmage_coldarraAI(), npc_warmage_violetstand::npc_warmage_violetstand(), boss_jeklik::PathEndReached(), boss_quartermaster_zigris::Reset(), boss_felmyst::Reset(), npc_sunblade_scout::Reset(), boss_zuljin::Reset(), npc_amanishi_scout::Reset(), boss_ayamiss::Reset(), boss_algalon_the_observer::Reset(), boss_freya::Reset(), boss_razorscale::Reset(), boss_illidan_stormrage::Reset(), boss_felmyst::ScheduleGroundAbilities(), boss_quartermaster_zigris::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_algalon_the_observer::UpdateAI(), and boss_razorscale::UpdateAI().

◆ SetCombatPulseDelay()

void Creature::SetCombatPulseDelay ( uint32  delay)
inline
301 {
302 m_combatPulseDelay = delay;
303 if (m_combatPulseTime == 0 || m_combatPulseTime > delay)
304 m_combatPulseTime = delay;
305 }

References m_combatPulseDelay, and m_combatPulseTime.

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

◆ SetCorpseDelay()

void Creature::SetCorpseDelay ( uint32  delay)
inline
73{ m_corpseDelay = delay; }

References m_corpseDelay.

Referenced by boss_brutallus::boss_brutallus(), npc_raging_flames::InitializeAI(), npc_pallid_horror::InitializeAI(), npc_flame_of_azzinoth::IsSummonedBy(), npc_highlord_darion_mograine::JustDied(), npc_hor_raging_ghoul::JustDied(), npc_hor_risen_witch_doctor::JustDied(), npc_hor_lumbering_abomination::JustDied(), boss_kologarn::JustDied(), npc_mindless_ghoul::npc_mindless_ghoulAI::JustDied(), boss_hazzarah::JustSummoned(), npc_minion_spawner::JustSummoned(), npc_anubarak_spike::npc_anubarak_spike(), npc_frost_sphere::npc_frost_sphere(), npc_highlord_darion_mograine::npc_highlord_darion_mograine(), npc_mindless_ghoul::npc_mindless_ghoulAI::npc_mindless_ghoulAI(), instance_ulduar::instance_ulduar_InstanceMapScript::OnCreatureCreate(), instance_black_temple::instance_black_temple_InstanceMapScript::OnCreatureCreate(), FrostwingGauntletRespawner::operator()(), ValithriaDespawner::operator()(), npc_varian_wrynn::npc_varian_wrynnAI::Reset(), npc_jaina_proudmoore_bfu::npc_jaina_proudmoore_bfuAI::Reset(), npc_thrall_bfu::npc_thrall_bfuAI::Reset(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::Reset(), npc_swarm_scarab::Reset(), npc_nerubian_burrower::Reset(), npc_lk_wicked_spirit::npc_lk_wicked_spiritAI::Reset(), npc_valithria_cloud::npc_valithria_cloudAI::Reset(), npc_argent_captainAI::Reset(), npc_freya_ward_summon::Reset(), boss_kologarn::Reset(), npc_heated_battle::npc_heated_battleAI::Reset(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::Reset(), npc_cultist_engineer::Reset(), and boss_svala::boss_svalaAI::UpdateAI().

◆ SetCorpseRemoveTime()

◆ SetCurrentEquipmentId()

void Creature::SetCurrentEquipmentId ( uint8  id)
inline
199{ m_equipmentId = id; }

References m_equipmentId.

◆ setDeathState()

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

A creature can be in 4 different states: Alive, JustDied, Corpse, and JustRespawned. The cycle follows the next order:

  • Alive: The creature is alive and has spawned in the world
  • JustDied: The creature has just died. This is the state just before his body appeared
  • Corpse: The creature has been removed from the world, and this corpse has been spawned
  • JustRespawned: The creature has just respawned. Follow when the corpse disappears and the respawn timer is finished
Parameters
stateSpecify one of 4 states above
despawnDespawn the creature immediately, without waiting for any movement to finish

Reimplemented from Unit.

Reimplemented in Minion, and Pet.

1973{
1974 Unit::setDeathState(state, despawn);
1975
1976 if (state == DeathState::JustDied)
1977 {
1979 uint32 dynamicRespawnDelay = GetMap()->ApplyDynamicModeRespawnScaling(this, m_respawnDelay);
1980 m_respawnTime = GameTime::GetGameTime().count() + dynamicRespawnDelay + m_corpseDelay;
1981
1982 // always save boss respawn time at death to prevent crash cheating
1983 if (GetMap()->IsDungeon() || isWorldBoss() || GetCreatureTemplate()->rank >= CREATURE_ELITE_ELITE)
1985
1986 SetTarget(); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState)
1988
1989 Dismount(); // if creature is mounted on a virtual mount, remove it at death
1990
1992 {
1993 SetNoSearchAssistance(false);
1994 }
1995
1996 //Dismiss group if is leader
1997 if (m_formation && m_formation->GetLeader() == this)
1998 m_formation->FormationReset(true, false);
1999
2000 bool needsFalling = !despawn && (IsFlying() || IsHovering()) && !IsUnderWater();
2001 SetHover(false);
2002 SetDisableGravity(false);
2003
2004 if (needsFalling)
2005 GetMotionMaster()->MoveFall(0, true);
2006
2008 }
2009 else if (state == DeathState::JustRespawned)
2010 {
2011 SetFullHealth();
2012 SetLootRecipient(nullptr);
2015 CreatureTemplate const* cinfo = GetCreatureTemplate();
2016 // Xinef: npc run by default
2017 //SetWalk(true);
2018
2019 // pussywizard:
2022
2024
2028
2030
2032 LoadCreaturesAddon(true);
2034
2035 if (GetCreatureData() && GetPhaseMask() != GetCreatureData()->phaseMask)
2036 SetPhaseMask(GetCreatureData()->phaseMask, false);
2037 }
2038}
SpellSchools
Definition SharedDefines.h:270
@ MOVEMENTFLAG_FALLING
Definition UnitDefines.h:384
NPCFlags
Non Player Character flags.
Definition UnitDefines.h:320
@ UNIT_NPC_FLAG_NONE
Definition UnitDefines.h:321
@ UNIT_STATE_ALL_STATE
Definition UnitDefines.h:227
@ UNIT_STATE_NO_ENVIRONMENT_UPD
Definition UnitDefines.h:201
bool HasSearchedAssistance()
Definition Creature.h:275
void SetLootRecipient(Unit *unit, bool withGroup=true)
Definition Creature.cpp:1323
void SetCannotReachTarget(ObjectGuid const &target=ObjectGuid::Empty)
Definition Creature.cpp:3732
void SetMeleeDamageSchool(SpellSchools school)
Definition Creature.h:163
uint32 ApplyDynamicModeRespawnScaling(WorldObject const *obj, uint32 respawnDelay) const
Definition Map.cpp:1758
void MoveFall(uint32 id=0, bool addFlagForNPC=false)
The unit will fall. Used when in the air. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:782
virtual void setDeathState(DeathState s, bool despawn=false)
Definition Unit.cpp:11182
void SetFullHealth()
Definition Unit.h:1140
void SetHover(bool enable)
Definition Unit.cpp:16354
bool HasUnitMovementFlag(uint32 f) const
Definition Unit.h:780
virtual bool IsUnderWater() const
Definition Unit.cpp:4323
void RemoveUnitMovementFlag(uint32 f)
Definition Unit.h:779
void SetDisableGravity(bool disable)
Definition Unit.cpp:16208
void ReplaceAllNpcFlags(NPCFlags flags)
Definition Unit.h:772
uint32 dmgschool
Definition CreatureData.h:207

References Alive, Map::ApplyDynamicModeRespawnScaling(), 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(), JustDied, JustRespawned, LoadCreaturesAddon(), LoadSparringPct(), m_corpseDelay, m_corpseRemoveTime, m_formation, m_respawnDelay, m_respawnTime, Motion_Initialize(), MotionMaster::MoveFall(), MOVEMENTFLAG_FALLING, CreatureTemplate::npcflag, Unit::RemoveUnitMovementFlag(), Unit::ReplaceAllNpcFlags(), ResetPlayerDamageReq(), SaveRespawnTime(), SetCannotReachTarget(), Unit::setDeathState(), Unit::SetDisableGravity(), Unit::SetFullHealth(), Unit::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(), 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(), boss_freya_summons::ReviveWithAllies(), Minion::setDeathState(), Pet::setDeathState(), npc_argent_captainAI::SpellHit(), npc_escortAI::UpdateAI(), npc_clintar_spirit::npc_clintar_spiritAI::UpdateAI(), and npc_injured_patient::npc_injured_patientAI::UpdateAI().

◆ SetDefaultMovementType()

◆ SetDetectionDistance()

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

References m_detectionDistance.

Referenced by UpdateEntry().

◆ SetDisplayFromModel()

void Creature::SetDisplayFromModel ( uint32  modelIdx)
3611{
3612 if (CreatureModel const* model = GetCreatureTemplate()->GetModelByIdx(modelIdx))
3613 SetDisplayId(model->CreatureDisplayID, model->DisplayScale);
3614}

References GetCreatureTemplate(), and Unit::SetDisplayId().

◆ SetFormation()

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

References m_formation.

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

◆ SetGossipMenuId()

void Creature::SetGossipMenuId ( uint32  gossipMenuId)
inline

◆ SetHomePosition() [1/2]

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

References m_homePosition, and Position::Relocate().

Referenced by at_hol_hall_of_watchers::_OnTrigger(), Battleground::AddCreature(), AtEngage(), boss_loatheb::boss_loathebAI::boss_loathebAI(), MotionTransport::CreateNPCPassenger(), npc_mistress_nagmara::DoAction(), npc_rocknot::DoAction(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::DoAction(), boss_taldaram::DoAction(), npc_icc_spire_frostwyrm::DoAction(), boss_algalon_the_observer::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), WaypointMovementGenerator< Creature >::DoUpdate(), FormationMovementGenerator::DoUpdate(), boss_nightbane::EnterEvadeMode(), boss_ayamiss::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), boss_algalon_the_observer::FailEncounter(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::GoSiphon(), WorldSession::HandleBattlemasterHelloOpcode(), WorldSession::HandleGossipHelloOpcode(), spell_item_toxic_wasteling::HandleJump(), WorldSession::HandleQuestgiverHelloOpcode(), boss_eck::InitializeAI(), boss_flame_leviathan::InitializeAI(), violet_hold_trashAI::InitializeAI(), npc_azure_saboteur::InitializeAI(), boss_aeonus::IsSummonedBy(), npc_simone::npc_simoneAI::JustDied(), boss_mandokir::boss_mandokirAI::JustEngagedWith(), boss_urom::boss_uromAI::JustEngagedWith(), boss_flame_leviathan::JustEngagedWith(), npc_rocknot::JustRespawned(), boss_kelthuzad::boss_kelthuzadAI::JustSummoned(), npc_daphne_stilwell::npc_daphne_stilwellAI::JustSummoned(), npc_hor_lich_king::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), boss_algalon_the_observer::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), npc_plague_cauldron_ghoul::Land(), LightOfDawnStartMarch(), LoadCreatureFromDB(), boss_nalorakk::MoveInLineOfSight(), npc_aged_dying_ancient_kodo::MoveInLineOfSight(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::MoveInLineOfSight(), boss_mandokir::boss_mandokirAI::MovementInform(), npc_enslaved_proto_drake::MovementInform(), npc_akama_illidan::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_spinestalker::npc_spinestalkerAI::MovementInform(), npc_rimefang::npc_rimefangAI::MovementInform(), npc_akama_shade::MovementInform(), npc_omen::npc_omenAI::MovementInform(), npc_gunship_boarding_addAI::MovementInform(), npc_expedition_defender::MovementInform(), boss_ghazan::MovementInform(), npc_escortAI::MovementInform(), SmartAI::MovepointReached(), npc_ulduar_snow_mound::PassengerBoarded(), SmartScript::ProcessAction(), RemoveCorpse(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::Reposition(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::Reposition(), npc_mistress_nagmara::Reset(), npc_rocknot::Reset(), boss_arlokk::boss_arlokkAI::Reset(), boss_jeklik::Reset(), npc_simone::npc_simoneAI::RespawnPet(), WorldSession::SendListInventory(), gunship_npc_AI::SetData(), npc_phalanx::SetDoorHome(), NPCStaveQuestAI::SetHomePosition(), Battlefield::SpawnCreature(), boss_urom::boss_uromAI::SpellHit(), boss_majordomo::SpellHit(), instance_ulduar::instance_ulduar_InstanceMapScript::StartLeviathanOutroSequence(), Map::SummonCreature(), npc_highlord_darion_mograine::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::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(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_rocknot::UpdateEscortAI(), UpdateHomePosition(), MotionTransport::UpdatePassengerPositions(), and npc_rocknot::WaypointReached().

◆ SetHomePosition() [2/2]

void Creature::SetHomePosition ( Position const &  pos)
inline

◆ SetInCombatWithZone()

void Creature::SetInCombatWithZone ( )

Set in combat all units in the dungeon/raid. Affect only units with IsAIEnabled.

2888{
2889 if (IsAIEnabled)
2890 AI()->DoZoneInCombat();
2891}
void DoZoneInCombat(Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
Definition CreatureAI.cpp:117

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

Referenced by boss_yoggsaron_sara::DamageTaken(), boss_dorothee::DoAction(), boss_roar::DoAction(), boss_strawman::DoAction(), boss_tinhead::DoAction(), boss_falric::DoAction(), boss_marwyn::DoAction(), npc_ghostly_priest::DoAction(), npc_phantom_mage::DoAction(), npc_shadowy_mercenary::DoAction(), npc_spectral_footman::DoAction(), npc_tortured_rifleman::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), npc_living_constellation::DoAction(), boss_the_lurker_below::DoAction(), boss_broggok::DoAction(), boss_grand_warlock_nethekurse::DoAction(), boss_krik_thir::boss_krik_thirAI::DoAction(), boss_leotheras_the_blind::DoAction(), boss_drakkari_colossus::boss_drakkari_colossusAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), boss_yoggsaron::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_illidan_stormrage::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_kelidan_the_breaker::DoAction(), boss_yoggsaron_immortal_guardian::EngageFromStasis(), npc_little_ooze::npc_little_oozeAI::EnterEvadeMode(), npc_big_ooze::npc_big_oozeAI::EnterEvadeMode(), boss_algalon_the_observer::EnterEvadeMode(), RestoreFight::Execute(), spell_teron_gorefiend_shadowy_construct::HandleEffectApply(), spell_mutate_explode_bug::HandleOnHit(), spell_the_lich_king_vile_spirit_move_target_search::HandleScript(), spell_putricide_mutated_transformation::HandleSummon(), boss_yoggsaron_sara::InitFight(), boss_kiljaeden::InitializeAI(), boss_glob_of_viscidus::InitializeAI(), npc_corrupted_totem::IsSummonedBy(), npc_living_inferno::npc_living_infernoAI::IsSummonedBy(), npc_parasitic_shadowfiend::IsSummonedBy(), npc_blade_of_azzinoth::IsSummonedBy(), npc_flame_of_azzinoth::IsSummonedBy(), boss_yoggsaron_constrictor_tentacle::IsSummonedBy(), npc_amanishi_scout::JustEngagedWith(), boss_headless_horseman::JustEngagedWith(), boss_twilight_halion::boss_twilight_halionAI::JustEngagedWith(), boss_faction_championsAI::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::JustEngagedWith(), boss_volkhan::JustEngagedWith(), boss_algalon_the_observer::JustEngagedWith(), boss_flame_leviathan::JustEngagedWith(), boss_freya::JustEngagedWith(), boss_svala::boss_svalaAI::JustEngagedWith(), npc_frozen_orb::npc_frozen_orbAI::JustEngagedWith(), boss_olm_the_summoner::JustEngagedWith(), boss_kiggler_the_crazed::JustEngagedWith(), boss_blindeye_the_seer::JustEngagedWith(), boss_krosh_firehand::JustEngagedWith(), boss_harbinger_skyriss::JustEngagedWith(), boss_thaddius_summon::boss_thaddius_summonAI::JustEngagedWith(), boss_the_lich_king::boss_the_lich_kingAI::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::JustEngagedWith(), boss_loatheb::boss_loathebAI::JustEngagedWith(), boss_maexxna::boss_maexxnaAI::JustEngagedWith(), boss_patchwerk::boss_patchwerkAI::JustEngagedWith(), boss_thaddius::boss_thaddiusAI::JustEngagedWith(), boss_steelbreaker::JustEngagedWith(), boss_runemaster_molgeim::JustEngagedWith(), boss_stormcaller_brundir::JustEngagedWith(), boss_fathomlord_karathress::JustEngagedWith(), boss_anubrekhan::JustSummoned(), boss_grobbulus::boss_grobbulusAI::JustSummoned(), boss_loatheb::boss_loathebAI::JustSummoned(), boss_maexxna::boss_maexxnaAI::JustSummoned(), brann_bronzebeard::JustSummoned(), boss_muru::JustSummoned(), npc_ouro_spawner::JustSummoned(), npc_dirt_mound::JustSummoned(), boss_dalronn_the_controller::JustSummoned(), boss_urom::boss_uromAI::JustSummoned(), npc_hor_lich_king::JustSummoned(), boss_curator::JustSummoned(), npc_demonic_vapor_trail::JustSummoned(), npc_kiljaeden_controller::JustSummoned(), npc_amanishi_tempest::JustSummoned(), boss_hazzarah::JustSummoned(), boss_anetheron::JustSummoned(), npc_hive_zara_larva::JustSummoned(), boss_novos::JustSummoned(), boss_professor_putricide::boss_professor_putricideAI::JustSummoned(), boss_gothik::boss_gothikAI::JustSummoned(), boss_noth::boss_nothAI::JustSummoned(), boss_magus_telestra::JustSummoned(), npc_creature_generator_akama::JustSummoned(), boss_fathomlord_karathress::JustSummoned(), boss_fathomguard_sharkkis::JustSummoned(), boss_fathomguard_tidalvess::JustSummoned(), boss_morogrim_tidewalker::JustSummoned(), boss_omor_the_unscarred::JustSummoned(), boss_vazruden_the_herald::JustSummoned(), boss_high_astromancer_solarian::JustSummoned(), boss_nethermancer_sepethrea::JustSummoned(), boss_muru::MoveInLineOfSight(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::MoveInLineOfSight(), boss_kaelthas::MoveInLineOfSight(), boss_captain_skarloc::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(), instance_karazhan::instance_karazhan_InstanceMapScript::OnCreatureCreate(), npc_ulduar_snow_mound::PassengerBoarded(), boss_nightbane::PathEndReached(), npc_sanguine_spirit::Reset(), boss_julianne::Reset(), boss_entropius::Reset(), boss_headless_horseman_head::Reset(), npc_twilight_summon::Reset(), boss_twilight_halion::boss_twilight_halionAI::Reset(), boss_yoggsaron_guardian_of_ys::Reset(), boss_yoggsaron_crusher_tentacle::Reset(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::SetData(), npc_argent_captainAI::SpellHit(), advisor_baseAI::SpellHit(), spell_putricide_ooze_channel::StartAttack(), Update(), boss_mandokir::boss_mandokirAI::UpdateAI(), npc_phantom_hallucination::UpdateAI(), npc_hor_lich_king::UpdateAI(), npc_vengeful_shade::npc_vengeful_shadeAI::UpdateAI(), npc_little_ooze::npc_little_oozeAI::UpdateAI(), npc_big_ooze::npc_big_oozeAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_algalon_the_observer::UpdateAI(), boss_flame_leviathan::UpdateAI(), boss_mimiron::UpdateAI(), boss_anzu::UpdateAI(), and npc_onyx_flamecaller::npc_onyx_flamecallerAI::WaypointReached().

◆ SetLastLeashExtensionTimePtr()

void Creature::SetLastLeashExtensionTimePtr ( std::shared_ptr< time_t > const &  timer)
3769{
3771}

References m_lastLeashExtensionTime.

Referenced by Unit::Attack(), and AssistDelayEvent::Execute().

◆ SetLootMode()

◆ SetLootRecipient()

void Creature::SetLootRecipient ( Unit *  unit,
bool  withGroup = true 
)
1324{
1325 // set the player whose group should receive the right
1326 // to loot the creature after it dies
1327 // should be set to nullptr after the loot disappears
1328
1329 if (!unit)
1330 {
1335 return;
1336 }
1337
1339 if (!player) // normal creature, no player involved
1340 return;
1341
1342 m_lootRecipient = player->GetGUID();
1343
1344 Map* map = GetMap();
1345 if (map && map->IsDungeon() && (isWorldBoss() || IsDungeonBoss()))
1346 {
1348 }
1349
1350 if (withGroup)
1351 {
1352 if (Group* group = player->GetGroup())
1353 {
1354 m_lootRecipientGroup = group->GetGUID().GetCounter();
1355
1356 if (map && map->IsDungeon() && (isWorldBoss() || IsDungeonBoss()))
1357 {
1358 Map::PlayerList const& PlayerList = map->GetPlayers();
1359 for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
1360 {
1361 if (Player* groupMember = i->GetSource())
1362 {
1363 if (groupMember->IsGameMaster() || groupMember->IsSpectator())
1364 {
1365 continue;
1366 }
1367
1368 if (groupMember->GetGroup() == group)
1369 {
1370 AddAllowedLooter(groupMember->GetGUID());
1371 }
1372 }
1373 }
1374 }
1375 }
1376 }
1377 else
1379
1381}
@ UNIT_DYNFLAG_LOOTABLE
Definition SharedDefines.h:3354
bool IsDungeonBoss() const
Definition Creature.cpp:3374
Definition LinkedList.h:139
Definition MapRefMgr.h:26
iterator begin()
Definition MapRefMgr.h:36
iterator end()
Definition MapRefMgr.h:37
Definition Map.h:168
bool IsDungeon() const
Definition Map.h:299
PlayerList const & GetPlayers() const
Definition Map.h:335
virtual void RemoveDynamicFlag(uint32 flag)
Definition Object.h:132
virtual void SetDynamicFlag(uint32 flag)
Definition Object.h:131
Group * GetGroup()
Definition Player.h:2518
void ResetAllowedLooters()
Definition Object.cpp:3229
void AddAllowedLooter(ObjectGuid guid)
Definition Object.cpp:3219

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::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_escortAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::HealReceived(), boss_razorgore::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::Reset(), Player::SendLoot(), setDeathState(), and boss_algalon_the_observer::UpdateAI().

◆ SetLootRewardDisabled()

void Creature::SetLootRewardDisabled ( bool  disable)
inline
380{ DisableLootReward = disable; }

References DisableLootReward.

◆ SetMeleeDamageSchool()

void Creature::SetMeleeDamageSchool ( SpellSchools  school)
inline

◆ SetNoCallAssistance()

◆ SetNoCallForHelp()

void Creature::SetNoCallForHelp ( bool  val)
inline

◆ SetNoSearchAssistance()

void Creature::SetNoSearchAssistance ( bool  val)
inline

◆ SetObjectScale()

void Creature::SetObjectScale ( float  scale)
overridevirtual

Reimplemented from Object.

3592{
3593 Unit::SetObjectScale(scale);
3594
3595 float combatReach = DEFAULT_WORLD_OBJECT_SIZE;
3596
3597 if (CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelInfo(GetDisplayId()))
3598 {
3599 SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, (IsPet() ? 1.0f : minfo->bounding_radius) * scale);
3600 if (minfo->combat_reach > 0)
3601 combatReach = minfo->combat_reach;
3602 }
3603
3604 if (IsPet())
3605 combatReach = DEFAULT_COMBAT_REACH;
3606
3607 SetFloatValue(UNIT_FIELD_COMBATREACH, combatReach * scale);
3608}
#define DEFAULT_WORLD_OBJECT_SIZE
Definition ObjectDefines.h:44
#define DEFAULT_COMBAT_REACH
Definition ObjectDefines.h:45
@ UNIT_FIELD_COMBATREACH
Definition UpdateFields.h:123
@ UNIT_FIELD_BOUNDINGRADIUS
Definition UpdateFields.h:122
virtual void SetObjectScale(float scale)
Definition Object.h:127
uint32 GetDisplayId() const
Definition Unit.h:1996

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 npc_frost_sphere::DamageTaken(), npc_crystalline_frayer::EnterSeedPod(), wp_commandscript::HandleWpShowCommand(), Guardian::InitStatsForLevel(), npc_crystalline_frayer::LeaveSeedPod(), npc_memory::npc_memoryAI::npc_memoryAI(), npc_crystalline_frayer::Reset(), boss_freya_nature_bomb::Reset(), boss_sartharion::SendLavaWaves(), npc_soh_fire_trigger::SpellHit(), npc_simon_bunny::npc_simon_bunnyAI::StartGame(), and npc_memory::npc_memoryAI::UpdateAI().

◆ SetOriginalEntry()

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

References m_originalEntry.

Referenced by CreateFromProto().

◆ SetPickPocketLootTime()

void Creature::SetPickPocketLootTime ( )
3846{
3848}
time_t const & GetRespawnTime() const
Definition Creature.h:290
uint32 GetCorpseDelay() const
Definition Creature.h:75

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

Referenced by Player::SendLoot().

◆ SetPosition() [1/2]

void Creature::SetPosition ( float  x,
float  y,
float  z,
float  o 
)

◆ SetPosition() [2/2]

void Creature::SetPosition ( Position const &  pos)
inline
345{ SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); }

References Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), and SetPosition().

Referenced by SetPosition().

◆ SetReactState()

void Creature::SetReactState ( ReactStates  state)
inline

A creature can have 3 ReactStates : Agressive, Passive, Neutral.

  • Agressive : The creature will attack any non friend units in sight
  • Passive : The creature will not attack anyone
  • Neutral : The creature will attack only if attacked
99{ m_reactState = state; }

References m_reactState.

Referenced by npc_phalanx::Activate(), boss_halion::boss_halionAI::AttackStart(), boss_faction_championsAI::boss_faction_championsAI(), boss_flame_leviathan_seat::boss_flame_leviathan_seat(), 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_jaraxxus(), boss_jarien::boss_jarien(), boss_jormungarAI::boss_jormungarAI(), boss_kiljaeden::boss_kiljaeden(), boss_nalorakk::boss_nalorakk(), 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::CheckPhaseTransition(), boss_garfrost::boss_garfrostAI::DamageTaken(), boss_professor_putricide::boss_professor_putricideAI::DamageTaken(), boss_jedoga_shadowseeker::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), boss_thaddius_summon::boss_thaddius_summonAI::DamageTaken(), boss_algalon_the_observer::DamageTaken(), npc_auriaya_feral_defender::DamageTaken(), boss_freya::DamageTaken(), boss_hodir::DamageTaken(), npc_ulduar_leviathan_mkii::DamageTaken(), npc_ulduar_vx001::DamageTaken(), npc_ulduar_aerial_command_unit::DamageTaken(), boss_razorscale::DamageTaken(), npc_ulduar_arachnopod_destroyer::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), boss_alar::DamageTaken(), boss_taerar::boss_taerarAI::DamageTaken(), boss_thekal::DamageTaken(), boss_felblood_kaelthas::DamageTaken(), boss_taldaram::DamageTaken(), boss_viscidus::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), boss_shade_of_aran::DamageTaken(), boss_kiljaeden::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_bug_trio::DamageTaken(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::Deactivate(), boss_xt002::DisposeHeart(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::DoAction(), boss_thekal::DoAction(), boss_archimonde::DoAction(), boss_bug_trio::DoAction(), boss_twinemperorsAI::DoAction(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::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(), brann_bronzebeard::DoAction(), boss_algalon_the_observer::DoAction(), npc_living_constellation::DoAction(), boss_the_lurker_below::DoAction(), boss_broggok::DoAction(), boss_felblood_kaelthas::DoAction(), boss_leotheras_the_blind::DoAction(), boss_kalecgos::DoAction(), npc_living_mojo::npc_living_mojoAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), npc_ulduar_aerial_command_unit::DoAction(), boss_skadi::boss_skadiAI::DoAction(), boss_illidan_stormrage::DoAction(), npc_akama_illidan::DoAction(), npc_maiev_illidan::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_kelidan_the_breaker::DoAction(), boss_nazan::DoAction(), boss_skeram::DoTeleport(), Spell::EffectSummonPet(), Spell::EffectSummonType(), boss_ouro::Emerge(), boss_the_lich_king::boss_the_lich_kingAI::EnterEvadeMode(), boss_zuljin::EnterPhase(), npc_crystalline_frayer::EnterSeedPod(), RestoreAttack::Execute(), OrcMoveEvent::Execute(), RestoreFight::Execute(), UtherBatteredHiltEvent::Execute(), StartMovementEvent::Execute(), VileSpiritActivateEvent::Execute(), SACActivateEvent::Execute(), SACDeactivateEvent::Execute(), boss_xt002::ExposeHeart(), AssistanceDistractMovementGenerator::Finalize(), npc_pet_dk_ebon_gargoyle::FlyAway(), boss_volkhan::GoToAnvil(), spell_mc_play_dead_aura::HandleEffectApply(), spell_uldaman_stoned_aura::HandleEffectApply(), spell_gen_feign_death_all_flags::HandleEffectApply(), spell_gen_feign_death_no_dyn_flag::HandleEffectApply(), spell_gen_feign_death_no_prevent_emotes::HandleEffectApply(), spell_mc_play_dead_aura::HandleEffectRemove(), spell_uldaman_stoned_aura::HandleEffectRemove(), boss_ragnaros::HandleEmerge(), spell_chapter2_persuasive_strike::HandleHit(), spell_mutate_explode_bug::HandleOnHit(), WorldSession::HandlePetActionHelper(), spell_item_draenic_pale_ale::HandleSummon(), Battlefield::HideNpc(), npc_jenny::Initialize(), npc_wounded_skirmisher::Initialize(), npc_frozen_core::Initialize(), boss_felmyst::InitializeAI(), boss_kiljaeden::InitializeAI(), npc_scarlet_ghoul::InitializeAI(), npc_general_andorov::InitializeAI(), boss_eck::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_sister_svalna::boss_sister_svalnaAI::InitializeAI(), boss_sapphiron::boss_sapphironAI::InitializeAI(), npc_lord_arete::npc_lord_areteAI::InitializeAI(), npc_oathbound_warder::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_plague_cauldron_ghoul::IsSummonedBy(), npc_parasitic_shadowfiend::IsSummonedBy(), npc_blade_of_azzinoth::IsSummonedBy(), npc_flame_of_azzinoth::IsSummonedBy(), npc_maiev_illidan::IsSummonedBy(), npc_lk_wicked_spirit::npc_lk_wicked_spiritAI::JustDied(), npc_sunblade_scout::JustEngagedWith(), npc_amanishi_scout::JustEngagedWith(), boss_venoxis::JustEngagedWith(), boss_freya::JustEngagedWith(), boss_moroes::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_warchief_kargath_bladefist::JustEngagedWith(), boss_high_astromancer_solarian::JustEngagedWith(), boss_sister_svalna::boss_sister_svalnaAI::JustReachedHome(), npc_akama_illidan::JustReachedHome(), npc_lk_wicked_spirit::npc_lk_wicked_spiritAI::JustRespawned(), advisor_baseAI::JustRespawned(), npc_highlord_darion_mograine::JustSummoned(), boss_skeram::JustSummoned(), boss_majordomo::JustSummoned(), boss_vexallus::JustSummoned(), boss_hazzarah::JustSummoned(), boss_jindo::JustSummoned(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustSummoned(), boss_novos::JustSummoned(), boss_bronjahm::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_gothik::boss_gothikAI::JustSummoned(), npc_flame_of_azzinoth::JustSummoned(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::JustSummoned(), boss_lady_vashj::JustSummoned(), boss_kaelthas::JustSummoned(), boss_terestian_illhoof::JustSummoned(), boss_ick::boss_ickAI::KilledUnit(), npc_plague_cauldron_ghoul::Land(), npc_crystalline_frayer::LeaveSeedPod(), Pet::LoadPetFromDB(), boss_nalorakk::MoveInLineOfSight(), npc_shattered_hand_scout::MoveInLineOfSight(), boss_hadronox::MovementInform(), boss_zuljin::MovementInform(), boss_ayamiss::MovementInform(), boss_bug_trio::MovementInform(), boss_grand_champion::boss_grand_championAI::MovementInform(), boss_icehowl::boss_icehowlAI::MovementInform(), boss_garfrost::boss_garfrostAI::MovementInform(), boss_eck::MovementInform(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::MovementInform(), boss_four_horsemen::boss_four_horsemenAI::MovementInform(), boss_illidan_stormrage::MovementInform(), boss_lady_vashj::MovementInform(), boss_nazan::MovementInform(), boss_felmyst::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_rimefang::npc_rimefangAI::MovementInform(), boss_kaelthas::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), gunship_npc_AI::MovementInform(), npc_gunship_boarding_addAI::MovementInform(), boss_razorscale::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), boss_warchief_kargath_bladefist::MovementInform(), MotionMaster::MoveSeekAssistance(), npc_anubarak_spike::npc_anubarak_spike(), npc_arcanite_dragonling::npc_arcanite_dragonling(), npc_argent_soldier::npc_argent_soldierAI::npc_argent_soldierAI(), npc_batrider::npc_batrider(), 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_dusk::npc_dusk(), npc_expedition_trapper::npc_expedition_trapper(), 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_herald_of_the_lich_king::npc_herald_of_the_lich_king(), npc_hive_zara_larva::npc_hive_zara_larva(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::npc_icc_ice_sphereAI(), npc_ice_tomb::npc_ice_tombAI::npc_ice_tombAI(), npc_living_constellation::npc_living_constellation(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::npc_lk_spirit_bombAI(), npc_memory::npc_memoryAI::npc_memoryAI(), npc_mimirons_inferno::npc_mimirons_inferno(), npc_minion_spawner::npc_minion_spawner(), npc_necrotic_shard::npc_necrotic_shard(), npc_nexus_lord::npc_nexus_lord(), npc_pet_gen_valkyr_guardian::npc_pet_gen_valkyr_guardian(), npc_pilgrims_bounty_chair::npc_pilgrims_bounty_chair(), npc_plague_cauldron_bunny::npc_plague_cauldron_bunny(), 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_scion_of_eternity::npc_scion_of_eternity(), npc_snobold_vassal::npc_snobold_vassalAI::npc_snobold_vassalAI(), npc_suppresser::npc_suppresserAI::npc_suppresserAI(), npc_taldaram_flamesphere::npc_taldaram_flamesphere(), npc_target_trigger::npc_target_trigger(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::npc_the_lich_king_controllerAI(), npc_toxic_slime::npc_toxic_slime(), npc_ulduar_hodir_druid::npc_ulduar_hodir_druid(), npc_ulduar_hodir_mage::npc_ulduar_hodir_mage(), npc_ulduar_hodir_priest::npc_ulduar_hodir_priest(), npc_ulduar_hodir_shaman::npc_ulduar_hodir_shaman(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::npc_valkyr_shadowguardAI(), npc_zafod_boombox::npc_zafod_boomboxAI::npc_zafod_boomboxAI(), NullCreatureAI::NullCreatureAI(), spell_halion_twilight_phasing_aura::OnApply(), instance_blackrock_depths::OnCreatureCreate(), instance_zulfarrak::instance_zulfarrak_InstanceMapScript::OnCreatureCreate(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::OnCreatureCreate(), instance_halls_of_reflection::OnCreatureCreate(), boss_shade_of_aran::OnPowerUpdate(), spell_halion_twilight_phasing_aura::OnRemove(), npc_ulduar_arachnopod_destroyer::PassengerBoarded(), PassiveAI::PassiveAI(), boss_nightbane::PathEndReached(), boss_jeklik::PathEndReached(), brann_bronzebeard::PathEndReached(), npc_akama_illidan::PathEndReached(), boss_nefarian::PathEndReached(), PossessedAI::PossessedAI(), npc_dark_iron_attack_generator::PrepareEvent(), PretendToDie(), boss_alar::PretendToDie(), SmartScript::ProcessAction(), npc_phalanx::Reset(), boss_lord_valthalak::Reset(), boss_nefarian::Reset(), boss_vaelastrasz::Reset(), boss_ragnaros::Reset(), boss_mr_smite::boss_mr_smiteAI::Reset(), npc_chesspiece::Reset(), boss_midnight::Reset(), boss_moroes::Reset(), boss_nightbane::Reset(), npc_sanguine_spirit::Reset(), boss_kalecgos::Reset(), boss_muru::Reset(), boss_entropius::Reset(), npc_dark_fiend::Reset(), npc_sunblade_scout::Reset(), boss_nalorakk::Reset(), npc_amanishi_scout::Reset(), boss_jeklik::Reset(), boss_renataki::boss_renatakiAI::Reset(), boss_thekal::Reset(), boss_venoxis::Reset(), npc_brew_bubble::Reset(), npc_hallows_end_soh::Reset(), npc_love_in_air_snivel::Reset(), boss_archimonde::Reset(), boss_onyxia::Reset(), npc_belnistrasz::npc_belnistraszAI::Reset(), boss_ayamiss::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(), boss_jedoga_shadowseeker::Reset(), boss_taldaram::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::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(), boss_the_lich_king::boss_the_lich_kingAI::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_crystalline_frayer::Reset(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::Reset(), boss_volkhan::Reset(), brann_bronzebeard::Reset(), boss_algalon_the_observer::Reset(), boss_stormcaller_brundir::Reset(), boss_freya_elder_stonebark::Reset(), boss_freya_elder_brightleaf::Reset(), boss_freya_elder_ironbranch::Reset(), boss_freya_summons::Reset(), npc_ulduar_iron_construct::Reset(), npc_ulduar_leviathan_mkii::Reset(), npc_expedition_engineer::Reset(), npc_razorscale_spawner::Reset(), npc_razorscale_devouring_flame::Reset(), npc_razorscale_dark_rune_watcher::Reset(), npc_razorscale_dark_rune_guardian::Reset(), npc_razorscale_dark_rune_sentinel::Reset(), boss_thorim_sif::Reset(), boss_xt002::Reset(), npc_scrapbot::Reset(), npc_pummeller::Reset(), npc_boombot::Reset(), boss_skadi::boss_skadiAI::Reset(), boss_skadi_grauf::boss_skadi_graufAI::Reset(), npc_imprisoned_beryl_sorcerer::npc_imprisoned_beryl_sorcererAI::Reset(), npc_venture_co_straggler::npc_venture_co_stragglerAI::Reset(), boss_talon_king_ikiss::Reset(), npc_voidtraveler::Reset(), npc_akama_illidan::Reset(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::Reset(), boss_shade_of_akama::Reset(), boss_lady_vashj::Reset(), boss_leotheras_the_blind::Reset(), boss_the_lurker_below::Reset(), boss_warlord_kalithresh::Reset(), boss_broggok::Reset(), boss_kelidan_the_breaker::Reset(), boss_vazruden_the_herald::Reset(), boss_magtheridon::Reset(), boss_alar::Reset(), boss_high_astromancer_solarian::Reset(), npc_ancestral_wolf::npc_ancestral_wolfAI::Reset(), npc_wounded_blood_elf::npc_wounded_blood_elfAI::Reset(), npc_bessy::npc_bessyAI::Reset(), npc_enslaved_netherwing_drake::Reset(), npc_pet_dk_ebon_gargoyle::Reset(), emerald_dragonAI::Reset(), npc_cultist_engineer::Reset(), Resurrect(), boss_warbringer_omrogg::ScheduleBurningPhase(), boss_magtheridon::ScheduleCombatEvents(), boss_felmyst::ScheduleGroundAbilities(), boss_warbringer_omrogg::ScheduleNonBurningPhase(), boss_the_lurker_below::SchedulerPhaseOne(), boss_laj::ScheduleTasks(), Unit::SetCharmedBy(), npc_hadronox_crusherPackAI::SetData(), npc_ulduar_leviathan_mkii::SetData(), npc_ulduar_aerial_command_unit::SetData(), gunship_npc_AI::SetData(), npc_gunship_boarding_addAI::SetData(), CreatureAI::SetGazeOn(), boss_thorim_start_npcs::SetGUID(), BfGraveyard::SetSpirit(), Battlefield::ShowNpc(), boss_viscidus::SoftReset(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), npc_ulduar_iron_construct::SpellHit(), npc_ulduar_leviathan_mkii::SpellHit(), npc_ulduar_aerial_command_unit::SpellHit(), boss_attumen::SpellHit(), npc_ulduar_vx001::SpellHit(), npc_venture_co_straggler::npc_venture_co_stragglerAI::SpellHit(), advisor_baseAI::SpellHit(), npc_enslaved_netherwing_drake::SpellHit(), boss_volkhan::SpellHitTarget(), boss_devourer_of_souls::SpellHitTarget(), boss_ick::boss_ickAI::SpellHitTarget(), npc_wounded_blood_elf::npc_wounded_blood_elfAI::sQuestAccept(), npc_phalanx::StartActivation(), boss_noth::boss_nothAI::StartBalconyPhase(), instance_violet_hold::instance_violet_hold_InstanceMapScript::StartBossEncounter(), boss_lord_valthalak::StartFighting(), boss_heigan::StartFightPhase(), boss_noth::boss_nothAI::StartGroundPhase(), boss_thorim_start_npcs::StartMockBattle(), boss_lord_valthalak::StartTalking(), boss_ouro::Submerge(), boss_jedoga_shadowseeker::SummonedCreatureDies(), boss_vaelastrasz::UpdateAI(), boss_ragnaros::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_scarlet_ghoul::UpdateAI(), npc_highlord_darion_mograine::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_hadronox::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), npc_memory::npc_memoryAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_jormungarAI::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_sister_svalna::boss_sister_svalnaAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_malygos::UpdateAI(), boss_krystallus::boss_krystallusAI::UpdateAI(), boss_algalon_the_observer::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), npc_auriaya_feral_defender::UpdateAI(), boss_mimiron::UpdateAI(), boss_razorscale::UpdateAI(), npc_razorscale_dark_rune_watcher::UpdateAI(), npc_razorscale_dark_rune_guardian::UpdateAI(), npc_razorscale_dark_rune_sentinel::UpdateAI(), boss_xt002::UpdateAI(), npc_lurgglbr::npc_lurgglbrAI::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), boss_taerar::boss_taerarAI::UpdateAI(), CreatureAI::UpdateVictimWithGaze(), npc_arthas::npc_arthasAI::WaypointReached(), and npc_general_andorov::WaypointReached().

◆ SetRegeneratingHealth()

void Creature::SetRegeneratingHealth ( bool  enable)
inline
328{ m_regenHealth = enable; }

References m_regenHealth.

Referenced by boss_yoggsaron_brain::boss_yoggsaron_brain(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::DamageTaken(), boss_felblood_kaelthas::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), boss_kiljaeden::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_yoggsaron_brain::DamageTaken(), npc_twilight_volunteer::DoAction(), brann_bronzebeard::DoAction(), boss_kalecgos::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), npc_crystalline_frayer::EnterSeedPod(), gunship_npc_AI::gunship_npc_AI(), npc_frozen_core::Initialize(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustSummoned(), npc_crystalline_frayer::LeaveSeedPod(), boss_grand_champion::boss_grand_championAI::MovementInform(), npc_expedition_defender::npc_expedition_defender(), 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(), brann_bronzebeard::PathEndReached(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::Reset(), boss_the_lich_king::boss_the_lich_kingAI::Reset(), npc_crystalline_frayer::Reset(), brann_bronzebeard::Reset(), boss_stormcaller_brundir::Reset(), npc_ulduar_vx001::Reset(), npc_xt002_heart::Reset(), npc_sorlof::Reset(), npc_blessed_banner::npc_blessed_bannerAI::Reset(), npc_sorlof::SetData(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::SetData(), and boss_stormcaller_brundir::UpdateAI().

◆ SetRegeneratingPower()

void Creature::SetRegeneratingPower ( bool  enable)
inline
329{ m_regenPower = enable; }

References m_regenPower.

Referenced by boss_moam::Reset().

◆ SetReputationRewardDisabled()

void Creature::SetReputationRewardDisabled ( bool  disable)
inline

◆ SetRespawnDelay()

◆ SetRespawnTime()

◆ SetSwim()

bool Creature::SetSwim ( bool  enable)
overridevirtual

Reimplemented from Unit.

3428{
3429 if (!Unit::SetSwim(enable))
3430 return false;
3431
3433 data << GetPackGUID();
3434 SendMessageToSet(&data, true);
3435 return true;
3436}
PackedGuid const & GetPackGUID() const
Definition Object.h:122
virtual bool SetSwim(bool enable)
Definition Unit.cpp:16243
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition Object.cpp:2178
@ SMSG_SPLINE_MOVE_STOP_SWIM
Definition Opcodes.h:810
@ SMSG_SPLINE_MOVE_START_SWIM
Definition Opcodes.h:809

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

Referenced by SmartAI::SetSwim(), and UpdateMovementFlags().

◆ SetTarget()

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

Implements Unit.

3617{
3618 if (_focusSpell)
3619 _spellFocusTarget = guid;
3620 else
3622}

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

Referenced by boss_malygos::AttackStart(), ClearTarget(), boss_garfrost::boss_garfrostAI::DamageTaken(), boss_kiljaeden::DamageTaken(), ConfusedMovementGenerator< T >::DoFinalize(), boss_ouro::Emerge(), RestoreAttack::Execute(), boss_kaelthas::ExecuteMiddleEvent(), 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::JustSummoned(), boss_bug_trio::MovementInform(), boss_garfrost::boss_garfrostAI::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::MovementInform(), boss_kaelthas::MovementInform(), npc_arthas::OnGossipSelect(), boss_leotheras_the_blind::Reset(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::Reset(), boss_kiljaeden::ScheduleBasicAbilities(), boss_magtheridon::ScheduleCombatEvents(), boss_felmyst::ScheduleGroundAbilities(), boss_the_lurker_below::SchedulerPhaseOne(), setDeathState(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_valkyr_battle_maiden::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), boss_cthun::UpdateAI(), boss_malygos::UpdateAI(), and npc_ulduar_vx001::UpdateAI().

◆ SetTextCooldown()

void Creature::SetTextCooldown ( uint8  textGroup,
uint32  cooldownMs 
)
3892{
3894 GameTime::GetGameTime().count() + ((cooldownMs + 999) / 1000);
3895}

References GameTime::GetGameTime(), m_textCooldowns, and textGroup.

Referenced by CreatureTextMgr::SendChat().

◆ SetTextRepeatId()

void Creature::SetTextRepeatId ( uint8  textGroup,
uint8  id 
)
3856{
3858 if (std::find(repeats.begin(), repeats.end(), id) == repeats.end())
3859 repeats.push_back(id);
3860 else
3861 LOG_ERROR("sql.sql", "CreatureTextMgr: TextGroup {} for Creature({}) {}, id {} already added", uint32(textGroup), GetName(), GetGUID().ToString(), uint32(id));
3862}

References Object::GetGUID(), WorldObject::GetName(), LOG_ERROR, m_textRepeat, textGroup, and Position::ToString().

Referenced by CreatureTextMgr::SendChat().

◆ SetTransportHomePosition() [1/2]

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

◆ SetTransportHomePosition() [2/2]

void Creature::SetTransportHomePosition ( Position const &  pos)
inline

◆ SetWalk()

bool Creature::SetWalk ( bool  enable)
overridevirtual

Enable or disable the creature's walk mode by removing: MOVEMENTFLAG_WALKING. Infom also the client.

Reimplemented from Unit.

3417{
3418 if (!Unit::SetWalk(enable))
3419 return false;
3420
3422 data << GetPackGUID();
3423 SendMessageToSet(&data, false);
3424 return true;
3425}
virtual bool SetWalk(bool enable)
Definition Unit.cpp:16194
@ SMSG_SPLINE_MOVE_SET_RUN_MODE
Definition Opcodes.h:811
@ SMSG_SPLINE_MOVE_SET_WALK_MODE
Definition Opcodes.h:812

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

Referenced by boss_bjarngrim::boss_bjarngrim(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), npc_rocknot::DoAction(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::DoAction(), 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(), brann_bronzebeard::DoAction(), npc_brann_bronzebeard_algalon::DoAction(), npc_arthas::npc_arthasAI::DoAction(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::DoAction(), npc_maiev_illidan::DoAction(), npc_akama_shade::DoAction(), npc_taretha::npc_tarethaAI::DoAction(), UtherBatteredHiltEvent::Execute(), boss_kaelthas::ExecuteMiddleEvent(), npc_lord_arete::npc_lord_areteAI::InitializeAI(), npc_pallid_horror::InitializeAI(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::IsSummonedBy(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::IsSummonedBy(), npc_kservant::npc_kservantAI::IsSummonedBy(), boss_shade_of_aran::JustEngagedWith(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::JustReachedHome(), npc_highlord_darion_mograine::JustRespawned(), boss_bjarngrim::JustRespawned(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), npc_kalecgos_kj::JustSummoned(), npc_icc_gauntlet_controller::npc_icc_gauntlet_controllerAI::JustSummoned(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::JustSummoned(), npc_akama_shade::JustSummoned(), boss_lady_vashj::JustSummoned(), npc_pallid_horror::JustSummoned(), npc_rinji::npc_rinjiAI::JustSummoned(), npc_maghar_captive::npc_maghar_captiveAI::JustSummoned(), LightOfDawnStartMarch(), npc_custodian_of_time::npc_custodian_of_timeAI::MoveInLineOfSight(), npc_brann_bronzebeard_algalon::MovementInform(), boss_mandokir::boss_mandokirAI::MovementInform(), boss_captain_skarloc::MovementInform(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::MovementInform(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::MovementInform(), brann_bronzebeard::MovementInform(), npc_akama_illidan::MovementInform(), boss_kaelthas::MovementInform(), npc_cameron::MoveTheChildren(), npc_sorlof::MoveToNextNode(), npc_hor_leader_second::npc_hor_leader_secondAI::MoveToNextStopPoint(), npc_ancestral_wolf::npc_ancestral_wolfAI::npc_ancestral_wolfAI(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::npc_marzon_silent_bladeAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::npc_valkyr_shadowguardAI(), npc_chesspiece::OnCharmed(), instance_halls_of_reflection::OnCreatureCreate(), npc_thrall_bfu::OnGossipSelect(), npc_deathstalker_erland::OnQuestAccept(), npc_mikhail::OnQuestAccept(), npc_prospector_remtravel::OnQuestAccept(), npc_kaya_flathoof::OnQuestAccept(), npc_gilthares::OnQuestAccept(), npc_wizzlecrank_shredder::OnQuestAccept(), npc_lakota_windsong::OnQuestAccept(), npc_paoka_swiftmountain::OnQuestAccept(), npc_ame::OnQuestAccept(), npc_ranshalla::OnQuestAccept(), npc_lurgglbr::OnQuestAccept(), npc_mootoo_the_younger::OnQuestAccept(), npc_engineer_helice::OnQuestAccept(), npc_maghar_captive::OnQuestAccept(), npc_bessy::OnQuestAccept(), npc_maxx_a_million_escort::OnQuestAccept(), npc_isla_starmane::OnQuestAccept(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::ReorderInstance(), npc_chesspiece::Reset(), boss_arlokk::boss_arlokkAI::Reset(), npc_dark_iron_guzzler::Reset(), npc_onyx_flamecaller::npc_onyx_flamecallerAI::Reset(), npc_kinetic_bomb::npc_kinetic_bombAI::Reset(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::Reset(), npc_hodirs_fury::Reset(), npc_mimirons_inferno::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::Reset(), npc_akama_shade::Reset(), boss_kaelthas::Reset(), npc_dream_fog::npc_dream_fogAI::ScheduleEvents(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SendSaurfangCampWorkerOut(), npc_argent_soldier::npc_argent_soldierAI::SetData(), npc_kurenai_captive::npc_kurenai_captiveAI::SetGUID(), npc_tirion_fordring_tft::npc_tirion_fordringAI::sGossipSelect(), npc_mistress_nagmara::sGossipSelect(), npc_injured_patient::npc_injured_patientAI::SpellHit(), npc_professor_phizzlethorpe::npc_professor_phizzlethorpeAI::sQuestAccept(), npc_ranger_lilatha::sQuestAccept(), npc_rinji::npc_rinjiAI::sQuestAccept(), npc_corporal_keeshan::npc_corporal_keeshanAI::sQuestAccept(), npc_muglash::npc_muglashAI::sQuestAccept(), npc_wounded_blood_elf::npc_wounded_blood_elfAI::sQuestAccept(), npc_phalanx::StartActivation(), npc_rocknot::StartAleEvent(), npc_barnes::npc_barnesAI::StartEvent(), npc_clintar_spirit::npc_clintar_spiritAI::StartEvent(), npc_thrall_bfu::npc_thrall_bfuAI::SummonedCreatureDies(), boss_majordomo::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(), npc_highlord_darion_mograine::UpdateAI(), npc_valkyr_battle_maiden::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_twilight_volunteer::UpdateAI(), npc_xerestrasza::npc_xerestraszaAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::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(), npc_brann_bronzebeard_algalon::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), npc_commander_eligor_dawnbringer::npc_commander_eligor_dawnbringerAI::UpdateAI(), npc_crusade_recruit::npc_crusade_recruitAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_grimstone::UpdateEscortAI(), npc_magwin::npc_magwinAI::UpdateEscortAI(), npc_jenny::UpdateFollowerAI(), npc_dusk::WaypointReached(), npc_arthas::npc_arthasAI::WaypointReached(), npc_professor_phizzlethorpe::npc_professor_phizzlethorpeAI::WaypointReached(), npc_ranger_lilatha::WaypointReached(), npc_rinji::npc_rinjiAI::WaypointReached(), npc_corporal_keeshan::npc_corporal_keeshanAI::WaypointReached(), npc_daphne_stilwell::npc_daphne_stilwellAI::WaypointReached(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::WaypointReached(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), npc_taretha::npc_tarethaAI::WaypointReached(), npc_magwin::npc_magwinAI::WaypointReached(), npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI::WaypointReached(), npc_mootoo_the_younger::npc_mootoo_the_youngerAI::WaypointReached(), npc_emily::npc_emilyAI::WaypointReached(), npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached(), npc_maghar_captive::npc_maghar_captiveAI::WaypointReached(), npc_kurenai_captive::npc_kurenai_captiveAI::WaypointReached(), npc_isla_starmane::npc_isla_starmaneAI::WaypointReached(), and npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI::WaypointStart().

◆ SetWanderDistance()

void Creature::SetWanderDistance ( float  dist)
inline

◆ SignalFormationMovement()

void Creature::SignalFormationMovement ( )

◆ Update()

void Creature::Update ( uint32  time)
overridevirtual

Reimplemented from WorldObject.

Reimplemented in Pet, TempSummon, Puppet, and Totem.

711{
713 {
714 TriggerJustRespawned = false;
715
716 // Skip for temp summons: InitializeAI already reset them, and JustRespawned would clobber state set synchronously during SUMMON.
717 if (!IsSummon())
718 {
721 AI()->JustRespawned();
722 }
723 }
724
725 switch (m_deathState)
726 {
728 // Must not be called, see Creature::setDeathState JUST_RESPAWNED -> ALIVE promoting.
729 LOG_ERROR("entities.unit", "Creature ({}) in wrong state: DeathState::JustRespawned (4)", GetGUID().ToString());
730 break;
732 // Must not be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting.
733 LOG_ERROR("entities.unit", "Creature ({}) in wrong state: DeathState::JustDead (1)", GetGUID().ToString());
734 break;
735 case DeathState::Dead:
736 {
737 time_t now = GameTime::GetGameTime().count();
738 if (m_respawnTime <= now)
739 {
740 Respawn();
741 }
742 break;
743 }
745 {
746 Unit::Update(diff);
747 // deathstate changed on spells update, prevent problems
749 break;
750
752 {
753 if (m_groupLootTimer <= diff)
754 {
755 Group* group = sGroupMgr->GetGroupByGUID(lootingGroupLowGUID);
756 if (group)
757 group->EndRoll(&loot);
760 }
761 else
762 {
763 m_groupLootTimer -= diff;
764 }
765 }
766 else if (m_corpseRemoveTime <= GameTime::GetGameTime().count())
767 {
768 RemoveCorpse(false);
769 LOG_DEBUG("entities.unit", "Removing corpse... {} ", GetUInt32Value(OBJECT_FIELD_ENTRY));
770 }
771 break;
772 }
774 {
775 Unit::Update(diff);
776
777 // creature can be dead after Unit::Update call
778 // CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly)
779 if (!IsAlive())
780 break;
781
782 // Swim / fly / hover flags are only refreshed inside UpdatePositionData(), which
783 // Map::CreatureRelocation() throttles for a plain wandering creature. Drive them here: as
784 // soon as it comes to rest, or once it has moved far enough that its liquid / floor state
785 // could have changed. (Creatures in combat, changing grid cell, or zone-wide visible
786 // re-derive immediately in CreatureRelocation and never reach this.)
789 {
790 UpdatePositionData(); // -> ProcessTerrainStatusUpdate() -> UpdateMovementFlags() re-baselines m_lastMovementFlagsPos
791 }
792
793 GetThreatMgr().Update(diff);
794
795 // if creature is charmed, switch to charmed AI
796 if (NeedChangeAI)
797 {
799 NeedChangeAI = false;
800 IsAIEnabled = true;
801
802 // xinef: update combat state, if npc is not in combat - return to spawn correctly by calling EnterEvadeMode
803 SelectVictim();
804 }
805
806 // if periodic combat pulse is enabled and we are both in combat and in a dungeon, do this now
807 if (m_combatPulseDelay > 0 && IsInCombat() && GetMap()->IsDungeon())
808 {
809 if (diff > m_combatPulseTime)
811 else
812 m_combatPulseTime -= diff;
813
814 if (m_combatPulseTime == 0)
815 {
816 if (AI())
817 AI()->DoZoneInCombat();
818 else
821 }
822 }
823
824 // periodic check to see if the creature has passed an evade boundary
825 if (IsAIEnabled && !IsInEvadeMode() && IsEngaged())
826 {
827 if (diff >= m_boundaryCheckTime)
828 {
829 AI()->CheckInRoom();
830 m_boundaryCheckTime = 2500;
831 }
832 else
833 m_boundaryCheckTime -= diff;
834 }
835
836 Unit* owner = GetCharmerOrOwner();
837 if (IsCharmed() && !IsWithinDistInMap(owner, GetMap()->GetVisibilityRange(), true, false, false))
838 {
840 }
841
842 if (Unit* victim = GetVictim())
843 {
844 // If we are closer than 50% of the combat reach we are going to reposition the victim
845 if (diff >= m_moveBackwardsMovementTime)
846 {
847 float MaxRange = GetCollisionRadius() + GetVictim()->GetCollisionRadius();
848
849 if (IsInDist(victim, MaxRange))
851
853 }
854 else
856
857 // Circling the target
858 if (diff >= m_moveCircleMovementTime)
859 {
860 AI()->MoveCircleChecks();
862 }
863 else
865
866 // Periodically check if able to move, if not, extend leash timer
867 if (diff >= m_extendLeashTime)
868 {
872 }
873 else
874 m_extendLeashTime -= diff;
875 }
876
877 // Call for assistance if not disabled
879 {
880 if (m_assistanceTimer <= diff)
881 {
883 {
884 SetNoCallAssistance(false);
886 }
888 }
889 else
890 {
891 m_assistanceTimer -= diff;
892 }
893 }
894
895 if (!IsInEvadeMode() && IsAIEnabled)
896 {
897 // do not allow the AI to be changed during update
898 m_AI_locked = true;
899 i_AI->UpdateAI(diff);
900 m_AI_locked = false;
901 }
902
903 // creature can be dead after UpdateAI call
904 // CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly)
905 if (!IsAlive())
906 break;
907
908 m_regenTimer -= diff;
909 if (m_regenTimer <= 0)
910 {
911 if (!IsInEvadeMode())
912 {
913 // regenerate health if not in combat or if polymorphed)
914 if (!IsInCombat() || IsPolymorphed())
917 {
918 // regenerate health if cannot reach the target and the setting is set to do so.
919 // this allows to disable the health regen of raid bosses if pathfinding has issues for whatever reason
920 if (sWorld->getBoolConfig(CONFIG_REGEN_HP_CANNOT_REACH_TARGET_IN_RAID) || !GetMap()->IsRaid())
921 {
923 LOG_DEBUG("entities.unit", "RegenerateHealth() enabled because Creature cannot reach the target. Detail: {}", GetDebugInfo());
924 }
925 else
926 LOG_DEBUG("entities.unit", "RegenerateHealth() disabled even if the Creature cannot reach the target. Detail: {}", GetDebugInfo());
927 }
928 }
929
930 if (getPowerType() == POWER_ENERGY)
932 else
934
936 }
937
938 // Evade timer is now handled by CombatManager::Update() which calls UnitAI::EvadeTimerExpired()
939 break;
940 }
941 default:
942 break;
943 }
944
946 {
947 // pussywizard:
948 if (GetOwnerGUID().IsPlayer())
949 {
950 if (m_transportCheckTimer <= diff)
951 {
954 if (newTransport != GetTransport())
955 {
956 if (GetTransport())
957 GetTransport()->RemovePassenger(this, true);
958 if (newTransport)
959 newTransport->AddPassenger(this, true);
961 //SendMovementFlagUpdate();
962 }
963 }
964 else
965 m_transportCheckTimer -= diff;
966 }
967
968 sScriptMgr->OnCreatureUpdate(this, diff);
969 }
970}
constexpr float CREATURE_MOVEMENT_FLAGS_REFRESH_DIST_SQ
Definition Creature.cpp:63
@ UNIT_STATE_LOST_CONTROL
Definition UnitDefines.h:219
@ OBJECT_FIELD_ENTRY
Definition UpdateFields.h:27
@ CONFIG_REGEN_HP_CANNOT_REACH_TARGET_IN_RAID
Definition WorldConfig.h:128
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_PERIOD
Definition WorldConfig.h:243
void MoveCircleChecks()
Definition CreatureAI.cpp:439
virtual void JustRespawned()
Definition CreatureAI.h:184
virtual bool CheckInRoom()
Definition CreatureAI.cpp:610
void MoveBackwardsChecks()
Definition CreatureAI.cpp:461
void SetInCombatWithZone()
Set in combat all units in the dungeon/raid. Affect only units with IsAIEnabled.
Definition Creature.cpp:2887
Position LastMovementFlagsPos
Definition Creature.h:514
void Respawn(bool force=false)
Definition Creature.cpp:2043
void RegenerateHealth()
Definition Creature.cpp:1052
void CallAssistance(Unit *target=nullptr)
Definition Creature.cpp:2496
static constexpr uint32 MOVE_BACKWARDS_CHECK_INTERVAL
Definition Creature.h:419
bool CanPeriodicallyCallForAssistance() const
Definition Creature.cpp:3798
uint32 m_moveCircleMovementTime
Definition Creature.h:421
uint32 m_moveBackwardsMovementTime
Definition Creature.h:422
static constexpr uint32 MOVE_CIRCLE_CHECK_INTERVAL
Definition Creature.h:418
Unit * SelectVictim()
Definition Unit.cpp:11314
bool IsNotReachableAndNeedRegen() const
Definition Creature.cpp:3756
void Regenerate(Powers power)
Definition Creature.cpp:986
uint32 m_extendLeashTime
Definition Creature.h:423
static constexpr uint32 EXTEND_LEASH_CHECK_INTERVAL
Definition Creature.h:420
void EndRoll(Loot *loot)
Definition Group.cpp:1576
Transport * GetTransportForPos(uint32 phase, float x, float y, float z, WorldObject *worldobject=nullptr)
Definition Map.cpp:1161
void Update(uint32 tdiff)
Definition ThreatManager.cpp:253
virtual void RemovePassenger(WorldObject *passenger, bool withAll=false)=0
virtual void AddPassenger(WorldObject *passenger, bool withAll=false)=0
virtual void UpdateAI(uint32)=0
Use to start attacking a target. Called just before JustEngagedWith()
bool NeedChangeAI
Definition Unit.h:2119
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:16856
bool IsDuringRemoveFromWorld() const
Definition Unit.h:709
void UpdateCharmAI()
Definition Unit.cpp:12319
Vehicle * m_vehicleKit
Definition Unit.h:2226
void StopMovingOnCurrentPos()
Definition Unit.cpp:12748
void Update(uint32 time) override
Definition Unit.cpp:510
void RemoveCharmAuras()
Definition Unit.cpp:8123
void Reset(bool evading=false)
Definition Vehicle.cpp:143
bool IsPositionDataUpdatePending() const
Definition Object.h:670
void UpdatePositionData()
Definition Object.cpp:1188
bool IsInDist(float x, float y, float z, float dist) const
Definition Position.h:221
float GetExactDistSq(float x, float y, float z) const
Definition Position.h:174

References _respawnCompatibilityMode, Transport::AddPassenger(), AI(), Alive, CallAssistance(), CanPeriodicallyCallForAssistance(), CreatureAI::CheckInRoom(), CONFIG_CREATURE_FAMILY_ASSISTANCE_PERIOD, CONFIG_REGEN_HP_CANNOT_REACH_TARGET_IN_RAID, Corpse, CREATURE_MOVEMENT_FLAGS_REFRESH_DIST_SQ, CREATURE_REGEN_INTERVAL, Dead, CreatureAI::DoZoneInCombat(), Group::EndRoll(), EXTEND_LEASH_CHECK_INTERVAL, Unit::GetCharmerOrOwner(), Unit::GetCollisionRadius(), Unit::getDeathState(), GetDebugInfo(), Position::GetExactDistSq(), GameTime::GetGameTime(), Object::GetGUID(), WorldObject::GetMap(), Unit::GetOwnerGUID(), WorldObject::GetPhaseMask(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Unit::getPowerType(), Unit::GetThreatMgr(), WorldObject::GetTransport(), Map::GetTransportForPos(), Object::GetUInt32Value(), Unit::GetVictim(), WorldObject::GetVisibilityRange(), Unit::HasUnitState(), Unit::i_AI, IN_MILLISECONDS, Unit::IsAIEnabled, Unit::IsAlive(), Unit::IsCharmed(), Unit::IsDuringRemoveFromWorld(), IsEngaged(), Unit::IsInCombat(), Position::IsInDist(), IsInEvadeMode(), Object::IsInWorld(), Unit::isMoving(), IsNotReachableAndNeedRegen(), Object::IsPlayer(), Unit::IsPolymorphed(), WorldObject::IsPositionDataUpdatePending(), Unit::IsSummon(), WorldObject::IsWithinDistInMap(), JustDied, CreatureAI::JustRespawned(), JustRespawned, LastMovementFlagsPos, LOG_DEBUG, LOG_ERROR, loot, lootingGroupLowGUID, m_AI_locked, m_assistanceTimer, m_boundaryCheckTime, m_combatPulseDelay, m_combatPulseTime, m_corpseRemoveTime, Unit::m_deathState, m_extendLeashTime, m_groupLootTimer, m_moveBackwardsMovementTime, m_moveCircleMovementTime, Unit::m_regenTimer, m_respawnTime, m_transportCheckTimer, Unit::m_vehicleKit, 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(), SelectVictim(), SetInCombatWithZone(), SetNoCallAssistance(), sGroupMgr, sScriptMgr, Unit::StopMovingOnCurrentPos(), sWorld, Position::ToString(), TriggerJustRespawned, UNIT_STATE_LOST_CONTROL, ThreatManager::Update(), Unit::Update(), UnitAI::UpdateAI(), Unit::UpdateCharmAI(), UpdateLeashExtensionTime(), WorldObject::UpdatePositionData(), 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.

1040{
1044
1045 for (uint8 i = POWER_MANA; i < MAX_POWERS; ++i)
1047
1049
1050 return true;
1051}
Powers
Definition SharedDefines.h:256
@ MAX_POWERS
Definition SharedDefines.h:264
void UpdateAttackPowerAndDamage(bool ranged=false) override
Definition StatSystem.cpp:1084
void UpdateMaxPower(Powers power) override
Definition StatSystem.cpp:1076
void UpdateMaxHealth() override
Definition StatSystem.cpp:1070
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.

1065{
1066 float value = GetTotalAuraModValue(UNIT_MOD_ARMOR);
1067 SetArmor(int32(value));
1068}
@ UNIT_MOD_ARMOR
Definition Unit.h:166
float GetTotalAuraModValue(UnitMods unitMod) const
Definition Unit.cpp:11869
void SetArmor(int32 val)
Definition Unit.h:1172

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.

1085{
1087
1091
1092 if (ranged)
1093 {
1097 }
1098
1099 float baseAttackPower = GetFlatModifierValue(unitMod, BASE_VALUE) * GetPctModifierValue(unitMod, BASE_PCT);
1100 float attackPowerMod = GetFlatModifierValue(unitMod, TOTAL_VALUE);
1101 float attackPowerMultiplier = GetPctModifierValue(unitMod, TOTAL_PCT) - 1.0f;
1102
1103 SetInt32Value(index, uint32(baseAttackPower)); // UNIT_FIELD_(RANGED)_ATTACK_POWER
1104 SetInt32Value(indexMod, uint32(attackPowerMod)); // UNIT_FIELD_(RANGED)_ATTACK_POWER_MODS
1105 SetFloatValue(indexMulti, attackPowerMultiplier); // UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER
1106
1107 // automatically update weapon damage after attack power modification
1108 if (ranged)
1110 else
1111 {
1114 }
1115}
@ 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:635

References BASE_ATTACK, BASE_PCT, BASE_VALUE, Unit::GetFlatModifierValue(), Unit::GetPctModifierValue(), 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().

◆ UpdateCurrentWaypointInfo()

◆ UpdateEntry() [1/2]

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

References UpdateEntry().

Referenced by UpdateEntry().

◆ UpdateEntry() [2/2]

bool Creature::UpdateEntry ( uint32  entry,
CreatureData const *  data = nullptr,
bool  changelevel = true,
bool  updateAI = false 
)
586{
587 if (!InitEntry(Entry, data))
588 return false;
589
590 CreatureTemplate const* cInfo = GetCreatureTemplate();
591
592 m_regenHealth = cInfo->RegenHealth;
593
594 // creatures always have melee weapon ready if any unless specified otherwise
595 if (!GetCreatureAddon())
597
598 SetFaction(cInfo->faction);
599
600 uint32 npcflag, unit_flags, dynamicflags;
601 ObjectMgr::ChooseCreatureFlags(cInfo, npcflag, unit_flags, dynamicflags, data);
602
604 ReplaceAllNpcFlags(NPCFlags(npcflag | sGameEventMgr->GetNPCFlag(this)));
605 else
607
608 // Xinef: NPC is in combat, keep this flag!
609 unit_flags &= ~UNIT_FLAG_IN_COMBAT;
610 if (IsInCombat())
611 unit_flags |= UNIT_FLAG_IN_COMBAT;
612
613 ReplaceAllUnitFlags(UnitFlags(unit_flags));
615
616 ReplaceAllDynamicFlags(dynamicflags);
617
620
624
625 uint32 previousHealth = GetHealth();
626 uint32 previousMaxHealth = GetMaxHealth();
627 uint32 previousPlayerDamageReq = _playerDamageReq;
628
629 SelectLevel(changelevel);
630 if (previousHealth > 0)
631 {
632 SetHealth(previousHealth);
633
634 if (previousMaxHealth && previousMaxHealth > GetMaxHealth())
635 {
636 _playerDamageReq = (uint32)(previousPlayerDamageReq * GetMaxHealth() / previousMaxHealth);
637 }
638 else
639 {
640 _playerDamageReq = previousPlayerDamageReq;
641 }
642 }
643
645 CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(GetLevel(), cInfo->unit_class);
646 float armor = stats->GenerateArmor(cInfo);
654
655 SetCanModifyStats(true);
657
659
660 // checked and error show at loading templates
661 if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->faction))
662 {
663 if (factionTemplate->factionFlags & FACTION_TEMPLATE_FLAG_ASSIST_PLAYERS)
664 SetPvP(true);
665 else
666 SetPvP(false);
667 }
668
669 // updates spell bars for vehicles and set player's faction - should be called here, to overwrite faction that is set from the new template
670 if (IsVehicle())
671 {
672 if (Player* owner = Creature::GetCharmerOrOwnerPlayerOrPlayerItself()) // this check comes in case we don't have a player
673 {
674 SetFaction(owner->GetFaction()); // vehicles should have same as owner faction
675 owner->VehicleSpellInitialize();
676 }
677 }
678
679 // trigger creature is always not selectable and can not be attacked
680 if (IsTrigger())
682
684
686 {
689 }
690
692
694
695 // Update movement
696 if (IsRooted())
699
701
702 if (updateAI)
703 {
705 }
706
707 return true;
708}
@ CREATURE_FLAG_EXTRA_CANNOT_ENTER_COMBAT
Definition CreatureData.h:59
@ CREATURE_FLAG_EXTRA_NO_TAUNT
Definition CreatureData.h:54
@ CREATURE_FLAG_EXTRA_WORLDEVENT
Definition CreatureData.h:60
@ FACTION_TEMPLATE_FLAG_ASSIST_PLAYERS
Definition DBCEnums.h:330
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplateEntryfmt)
#define sGameEventMgr
Definition GameEventMgr.h:204
@ SPELL_SCHOOL_SHADOW
Definition SharedDefines.h:276
@ SPELL_SCHOOL_NATURE
Definition SharedDefines.h:274
@ SPELL_SCHOOL_FROST
Definition SharedDefines.h:275
@ SPELL_SCHOOL_ARCANE
Definition SharedDefines.h:277
@ SPELL_SCHOOL_FIRE
Definition SharedDefines.h:273
@ SPELL_SCHOOL_HOLY
Definition SharedDefines.h:272
@ SPELL_EFFECT_ATTACK_ME
Definition SharedDefines.h:880
@ SPELL_AURA_MOD_TAUNT
Definition SpellAuraDefines.h:74
UnitFlags2
Definition UnitDefines.h:294
@ SHEATH_STATE_MELEE
Definition UnitDefines.h:130
@ UNIT_STATE_ROOT
Definition UnitDefines.h:183
UnitFlags
Definition UnitDefines.h:255
@ UNIT_FLAG_IN_COMBAT
Definition UnitDefines.h:276
@ UNIT_MOD_RESISTANCE_SHADOW
Definition Unit.h:171
@ UNIT_MOD_RESISTANCE_FROST
Definition Unit.h:170
@ UNIT_MOD_RESISTANCE_HOLY
Definition Unit.h:167
@ UNIT_MOD_RESISTANCE_ARCANE
Definition Unit.h:172
@ UNIT_MOD_RESISTANCE_FIRE
Definition Unit.h:168
@ UNIT_MOD_RESISTANCE_NATURE
Definition Unit.h:169
bool UpdateAllStats() override
Definition StatSystem.cpp:1039
void LoadTemplateImmunities(int32 creatureImmunitiesId)
Definition Creature.cpp:2269
bool IsRooted() const
Definition Creature.h:88
void SetDetectionDistance(float dist)
Definition Creature.h:211
bool InitEntry(uint32 entry, CreatureData const *data=nullptr)
Definition Creature.cpp:482
static void ChooseCreatureFlags(CreatureTemplate const *cinfo, uint32 &npcflag, uint32 &unit_flags, uint32 &dynamicflags, CreatureData const *data=nullptr)
Definition ObjectMgr.cpp:1659
void SetFaction(uint32 faction)
Definition Unit.cpp:6886
void SetPvP(bool state)
Definition Unit.h:1060
void ReplaceAllUnitFlags(UnitFlags flags)
Remove the Unit flag specify only.
Definition Unit.h:756
virtual void SetSheath(SheathState sheathed)
Definition Unit.h:1793
void SetCanModifyStats(bool modifyStats)
Definition Unit.h:1111
void ReplaceAllUnitFlags2(UnitFlags2 flags)
Definition Unit.h:762
void SetAttackTime(WeaponAttackType att, uint32 val)
Definition Unit.h:934
void SetIsCombatDisallowed(bool value)
Definition Unit.h:983
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition Object.cpp:3338
float GenerateArmor(CreatureTemplate const *info) const
Definition CreatureData.h:327
uint32 RangeAttackTime
Definition CreatureData.h:210
uint32 BaseAttackTime
Definition CreatureData.h:209
float detection_range
Definition CreatureData.h:205
int32 CreatureImmunitiesId
Definition CreatureData.h:240
int32 resistance[MAX_SPELL_SCHOOL]
Definition CreatureData.h:223
bool RegenHealth
Definition CreatureData.h:239
uint32 faction
Definition CreatureData.h:199
uint32 unit_flags2
Definition CreatureData.h:215
Definition DBCStructure.h:975

References _playerDamageReq, AIM_Initialize(), Unit::ApplySpellImmune(), BASE_ATTACK, BASE_VALUE, CreatureTemplate::BaseAttackTime, ObjectMgr::ChooseCreatureFlags(), CREATURE_FLAG_EXTRA_CANNOT_ENTER_COMBAT, CREATURE_FLAG_EXTRA_NO_TAUNT, CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK, CREATURE_FLAG_EXTRA_WORLDEVENT, CreatureTemplate::CreatureImmunitiesId, CreatureTemplate::detection_range, CreatureTemplate::dmgschool, ENABLED, Entry, CreatureTemplate::faction, FACTION_TEMPLATE_FLAG_ASSIST_PLAYERS, CreatureBaseStats::GenerateArmor(), WorldObject::GetCharmerOrOwnerPlayerOrPlayerItself(), GetCreatureAddon(), GetCreatureTemplate(), Unit::GetHealth(), Unit::GetLevel(), Unit::GetMaxHealth(), CreatureTemplate::HasFlagsExtra(), IMMUNITY_EFFECT, IMMUNITY_STATE, InitEntry(), InitializeReactState(), Unit::IsInCombat(), Unit::IsPet(), IsRooted(), IsTrigger(), Unit::IsVehicle(), LoadSparringPct(), LoadTemplateImmunities(), 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::SetDualWieldMode(), Unit::SetFaction(), Unit::SetHealth(), Unit::SetIsCombatDisallowed(), SetMeleeDamageSchool(), Unit::SetPvP(), Unit::SetSheath(), Unit::SetStatFlatModifier(), 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, UpdateAllStats(), and UpdateMovementFlags().

Referenced by CreateFromProto(), boss_yoggsaron_influence_tentacle::DamageTaken(), npc_molten_golem::DamageTaken(), npc_forest_frog::DoSpawnRandom(), boss_halazzi::EnterPhase(), 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::JustRespawned(), boss_yoggsaron_brain::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::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(), boss_halazzi::Reset(), npc_announcer_toc5::npc_announcer_toc5AI::Reset(), Respawn(), NPCStaveQuestAI::RevealForm(), boss_halazzi::SpellHit(), 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::SpellHit(), npc_nether_drake::npc_nether_drakeAI::SpellHit(), boss_hydross_the_unstable::SummonMovementInform(), 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(), and npc_tyrion_spybot::npc_tyrion_spybotAI::UpdateAI().

◆ UpdateLeashExtensionTime()

void Creature::UpdateLeashExtensionTime ( )

◆ UpdateMaxHealth()

void Creature::UpdateMaxHealth ( )
overridevirtual

Implements Unit.

Reimplemented in Guardian, and Totem.

1071{
1073 SetMaxHealth(uint32(value));
1074}

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.

1077{
1078 UnitMods unitMod = UnitMods(static_cast<uint16>(UNIT_MOD_POWER_START) + power);
1079
1080 float value = GetTotalAuraModValue(unitMod);
1081 SetMaxPower(power, uint32(value));
1082}
@ UNIT_MOD_POWER_START
Definition Unit.h:184

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

Referenced by UpdateAllStats().

◆ UpdateMoveInLineOfSightState()

void Creature::UpdateMoveInLineOfSightState ( )
2656{
2657 // xinef: pets, guardians and units with scripts / smartAI should be skipped
2659 GetScriptId() || GetAIName() == "SmartAI")
2660 {
2663 return;
2664 }
2665
2666 if (IsTrigger() || IsCivilian() || GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET || IsCritter() || GetAIName() == "NullCreatureAI")
2667 {
2670 return;
2671 }
2672
2673 bool nonHostile = true;
2674 if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(GetFaction()))
2675 if (factionTemplate->hostileMask || factionTemplate->enemyFaction[0] || factionTemplate->enemyFaction[1] || factionTemplate->enemyFaction[2] || factionTemplate->enemyFaction[3])
2676 nonHostile = false;
2677
2678 if (nonHostile)
2680 else
2682}
@ UNIT_MASK_SUMMON
Definition UnitDefines.h:159
@ UNIT_MASK_CONTROLLABLE_GUARDIAN
Definition UnitDefines.h:167
@ UNIT_MASK_GUARDIAN
Definition UnitDefines.h:161
@ UNIT_MASK_MINION
Definition UnitDefines.h:160
uint32 GetCreatureType() const
Definition Unit.cpp:11599
uint32 HasUnitTypeMask(uint32 mask) const
Definition Unit.h:747

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_CONTROLLABLE_GUARDIAN, UNIT_MASK_GUARDIAN, UNIT_MASK_MINION, and UNIT_MASK_SUMMON.

Referenced by Unit::SetFaction().

◆ UpdateMovementFlags()

void Creature::UpdateMovementFlags ( )
3521{
3522 // Track where the flags were last evaluated - Creature::Update() uses this as the throttle
3523 // baseline for a wandering creature (see Map::CreatureRelocation).
3525
3526 // Do not update movement flags if creature is controlled by a player (charm/vehicle)
3527 if (m_movedByPlayer)
3528 return;
3529
3530 CreatureTemplate const* info = GetCreatureTemplate();
3531 if (!info)
3532 return;
3533
3534 // Creatures with CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE should control MovementFlags in your own scripts
3536 return;
3537
3538 float ground = GetFloorZ();
3539
3540 bool canHover = CanHover();
3541 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
3542
3543 if (GetMovementTemplate().IsFlightAllowed() && isInAir && !IsFalling())
3544 {
3546 SetCanFly(true);
3547 else if (!IsLevitating())
3548 SetDisableGravity(true);
3549
3550 if (!HasHoverAura() && IsHovering())
3551 SetHover(false);
3552 }
3553 else
3554 {
3556 SetCanFly(false);
3557
3558 if (IsLevitating())
3559 SetDisableGravity(false);
3560
3562 SetHover(true);
3563 }
3564
3565 if (!isInAir)
3567
3568 bool Swim = false;
3569 LiquidData const& liquidData = GetLiquidData();
3570 switch (liquidData.Status)
3571 {
3574 Swim = GetPositionZ() - liquidData.DepthLevel > GetCollisionHeight() * 0.75f; // Shallow water at ~75% of collision height
3575 break;
3577 Swim = true;
3578 break;
3579 default:
3580 break;
3581 }
3582
3583 SetSwim(CanSwim() && Swim);
3584}
@ CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE
Definition CreatureData.h:55
@ LIQUID_MAP_UNDER_WATER
Definition GridTerrainData.h:195
@ LIQUID_MAP_IN_WATER
Definition GridTerrainData.h:194
@ LIQUID_MAP_WATER_WALK
Definition GridTerrainData.h:193
float const GROUND_HEIGHT_TOLERANCE
Definition SharedDefines.h:26
@ MOVEMENTFLAG_CAN_FLY
Definition UnitDefines.h:396
bool SetSwim(bool enable) override
Definition Creature.cpp:3427
float GetFloatValue(uint16 index) const
Definition Object.cpp:315
float GetCollisionHeight() const override
Return collision height sent to client.
Definition Unit.cpp:16862
bool IsLevitating() const
Definition Unit.h:1726
void SetCanFly(bool enable)
Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pre...
Definition Unit.cpp:16268
SafeUnitPointer m_movedByPlayer
Definition Unit.h:2097
bool HasHoverAura() const
Definition Unit.h:1821
LiquidData const & GetLiquidData() const
Definition Object.cpp:3211
float GetFloorZ() const
Definition Object.cpp:3167
Definition DynamicTree.h:25
Definition GridTerrainData.h:199
LiquidStatus Status
Definition GridTerrainData.h:206
float DepthLevel
Definition GridTerrainData.h:205
bool HasMovementFlag(uint32 flag) const
Definition Object.h:353

References CanFly, CanHover(), CanSwim(), CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE, LiquidData::DepthLevel, CreatureMovementData::Flight, Unit::GetCollisionHeight(), GetCreatureTemplate(), Object::GetFloatValue(), WorldObject::GetFloorZ(), WorldObject::GetLiquidData(), GetMovementTemplate(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), CreatureMovementData::Ground, GROUND_HEIGHT_TOLERANCE, CreatureTemplate::HasFlagsExtra(), Unit::HasHoverAura(), MovementInfo::HasMovementFlag(), Hover, Unit::IsAlive(), Unit::IsFalling(), CreatureMovementData::IsFlightAllowed(), Unit::IsHovering(), Unit::IsLevitating(), LastMovementFlagsPos, LIQUID_MAP_IN_WATER, LIQUID_MAP_UNDER_WATER, LIQUID_MAP_WATER_WALK, Unit::m_movedByPlayer, WorldObject::m_movementInfo, MOVEMENTFLAG_CAN_FLY, MOVEMENTFLAG_FALLING, Position::Relocate(), Unit::RemoveUnitMovementFlag(), Unit::SetCanFly(), Unit::SetDisableGravity(), Unit::SetHover(), SetSwim(), LiquidData::Status, Swim, and UNIT_FIELD_HOVERHEIGHT.

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

◆ UpdateResistances()

void Creature::UpdateResistances ( uint32  school)
overridevirtual

Implements Unit.

Reimplemented in Totem.

1054{
1055 if (school > SPELL_SCHOOL_NORMAL)
1056 {
1058 SetResistance(SpellSchools(school), int32(value));
1059 }
1060 else
1061 UpdateArmor();
1062}
@ UNIT_MOD_RESISTANCE_START
Definition Unit.h:182
void UpdateArmor() override
Definition StatSystem.cpp:1064
void SetResistance(SpellSchools school, int32 val)
Definition Unit.h:1215

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.

1035{
1036 return true;
1037}

◆ UpdateVendorItemCurrentCount()

uint32 Creature::UpdateVendorItemCurrentCount ( VendorItem const *  vItem,
uint32  used_count 
)
3313{
3314 if (!vItem->maxcount)
3315 return 0;
3316
3317 VendorItemCounts::iterator itr = m_vendorItemCounts.begin();
3318 for (; itr != m_vendorItemCounts.end(); ++itr)
3319 if (itr->itemId == vItem->item)
3320 break;
3321
3322 if (itr == m_vendorItemCounts.end())
3323 {
3324 uint32 new_count = vItem->maxcount > used_count ? vItem->maxcount - used_count : 0;
3325 m_vendorItemCounts.push_back(VendorItemCount(vItem->item, new_count));
3326 return new_count;
3327 }
3328
3329 VendorItemCount* vCount = &*itr;
3330
3331 time_t ptime = GameTime::GetGameTime().count();
3332
3333 if (time_t(vCount->lastIncrementTime + vItem->incrtime) <= ptime)
3334 {
3335 ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(vItem->item);
3336
3337 uint32 diff = uint32((ptime - vCount->lastIncrementTime) / vItem->incrtime);
3338 if ((vCount->count + diff * pProto->BuyCount) < vItem->maxcount)
3339 vCount->count += diff * pProto->BuyCount;
3340 else
3341 vCount->count = vItem->maxcount;
3342 }
3343
3344 vCount->count = vCount->count > used_count ? vCount->count - used_count : 0;
3345 vCount->lastIncrementTime = ptime;
3346 return vCount->count;
3347}

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

Referenced by Player::_StoreOrEquipNewItem().

◆ UpdateWaypointID()

Member Data Documentation

◆ _creatureImmunitiesId

int32 Creature::_creatureImmunitiesId
protected

◆ _currentWaypointNodeInfo

std::pair<uint32, uint32> Creature::_currentWaypointNodeInfo {0, 0}
private
541{0, 0};

Referenced by GetCurrentWaypointInfo(), and UpdateCurrentWaypointInfo().

◆ _damagedByPlayer

bool Creature::_damagedByPlayer
private

◆ _focusSpell

Spell const* Creature::_focusSpell
private

◆ _gossipMenuId

uint32 Creature::_gossipMenuId
protected

Referenced by GetGossipMenuId(), and SetGossipMenuId().

◆ _highestPlayerAttackerLevel

uint8 Creature::_highestPlayerAttackerLevel
private

◆ _isCombatMovementAllowed

bool Creature::_isCombatMovementAllowed
private

◆ _isMissingSwimmingFlagOutOfCombat

bool Creature::_isMissingSwimmingFlagOutOfCombat
private

◆ _nativeObjectScale

float Creature::_nativeObjectScale = 1.0f
private

DisplayScale of the native model, set in InitEntry.

Referenced by Create(), GetNativeObjectScale(), InitEntry(), and Respawn().

◆ _playerDamageReq

◆ _respawnCompatibilityMode

bool Creature::_respawnCompatibilityMode {true}
protected

◆ _sparringPct

float Creature::_sparringPct
protected

Referenced by GetSparringPct(), and LoadSparringPct().

◆ [struct]

struct { ... } Creature::_spellFocusInfo

Referenced by HasSpellFocus().

◆ _spellFocusTarget

ObjectGuid Creature::_spellFocusTarget
private

‍Locks the target during spell cast for proper facing

Referenced by FocusTarget(), ReleaseFocus(), and SetTarget().

◆ CachedScriptId

uint32 Creature::CachedScriptId = 0
mutableprotected

Referenced by GetScriptId().

◆ CachedScriptIdEntry

uint32 Creature::CachedScriptIdEntry = 0
mutableprotected

Referenced by GetScriptId(), and InitEntry().

◆ Delay

uint32 Creature::Delay = 0

◆ DisableLootReward

bool Creature::DisableLootReward
protected

◆ DisableReputationReward

bool Creature::DisableReputationReward
protected

◆ EXTEND_LEASH_CHECK_INTERVAL

constexpr uint32 Creature::EXTEND_LEASH_CHECK_INTERVAL = 3000
staticconstexpr

Referenced by Update().

◆ LastMovementFlagsPos

Position Creature::LastMovementFlagsPos
protected

Referenced by Update(), and UpdateMovementFlags().

◆ 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_alreadyCallForHelp

bool Creature::m_alreadyCallForHelp
protected

Referenced by CallForHelp(), and SetNoCallForHelp().

◆ 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_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_extendLeashTime

uint32 Creature::m_extendLeashTime = EXTEND_LEASH_CHECK_INTERVAL

Referenced by Update().

◆ m_formation

◆ m_groupLootTimer

uint32 Creature::m_groupLootTimer

Referenced by Update().

◆ m_homePosition

Position Creature::m_homePosition
protected

◆ m_lastLeashExtensionTime

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

◆ 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_textCooldowns

std::unordered_map<uint8, uint32> Creature::m_textCooldowns
private

◆ m_textRepeat

CreatureTextRepeatGroup Creature::m_textRepeat
private

‍Saved target during spell focus for restoration

Referenced by ClearTextRepeatGroup(), GetTextRepeatGroup(), and SetTextRepeatId().

◆ m_transportCheckTimer

uint16 Creature::m_transportCheckTimer
protected

Referenced by Update().

◆ m_transportHomePosition

◆ 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().


The documentation for this class was generated from the following files: