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

#include "Creature.h"

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

Public Member Functions

 Creature (bool isWorldObject=false)
 
 ~Creature () override
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
float GetNativeObjectScale () const override
 
void SetObjectScale (float scale) override
 
void SetDisplayId (uint32 displayId, float displayScale=1.f) 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, const CreatureData *data=nullptr)
 
bool LoadCreaturesAddon (bool reload=false)
 
void SelectLevel (bool changelevel=true)
 
void LoadEquipment (int8 id=1, bool force=false)
 
ObjectGuid::LowType GetSpawnId () const
 
void Update (uint32 time) override
 
void GetRespawnPosition (float &x, float &y, float &z, float *ori=nullptr, float *dist=nullptr) const
 
void SetCorpseDelay (uint32 delay)
 
void SetCorpseRemoveTime (uint32 delay)
 
uint32 GetCorpseDelay () const
 
bool IsRacialLeader () const
 
bool IsCivilian () const
 
bool IsTrigger () const
 
bool IsGuard () const
 
CreatureMovementData const & GetMovementTemplate () const
 
bool CanWalk () const
 
bool CanSwim () const override
 This method check the current flag/status of a creature and its inhabit type. More...
 
bool CanEnterWater () const override
 
bool CanFly () const override
 
bool CanHover () const
 
bool IsRooted () const
 
MovementGeneratorType GetDefaultMovementType () const override
 -------—End of Pet responses methods-------— More...
 
void SetDefaultMovementType (MovementGeneratorType mgt)
 
void SetReactState (ReactStates state)
 A creature can have 3 ReactStates : Agressive, Passive, Neutral. More...
 
ReactStates GetReactState () const
 
bool HasReactState (ReactStates state) const
 
void InitializeReactState ()
 Check if the creature has the specified ReactState. More...
 
bool isCanInteractWithBattleMaster (Player *player, bool msg) const
 
bool isCanTrainingAndResetTalentsOf (Player *player) const
 
bool IsValidTrainerForPlayer (Player *player, uint32 *npcFlags=nullptr) const
 
bool CanCreatureAttack (Unit const *victim, bool skipDistCheck=false) const
 
void LoadSpellTemplateImmunity ()
 
bool IsImmunedToSpell (SpellInfo const *spellInfo, Spell const *spell=nullptr) override
 
bool HasMechanicTemplateImmunity (uint32 mask) const
 
bool IsImmunedToSpellEffect (SpellInfo const *spellInfo, uint32 index) const override
 
bool isElite () const
 
bool isWorldBoss () const
 
bool IsDungeonBoss () const
 
bool IsImmuneToKnockback () const
 
bool IsAvoidingAOE () const
 
uint8 getLevelForTarget (WorldObject const *target) const override
 
bool IsInEvadeMode () const
 
bool IsEvadingAttacks () const
 
bool AIM_Initialize (CreatureAI *ai=nullptr)
 
void Motion_Initialize ()
 
CreatureAIAI () const
 
bool SetWalk (bool enable) override
 Enable or disable the creature's walk mode by removing: MOVEMENTFLAG_WALKING. Infom also the client. More...
 
bool SetDisableGravity (bool disable, bool packetOnly=false, bool updateAnimationTier=true) override
 Enable or disable the creature's fly mode by adding or removing: MOVEMENTFLAG_FLYING. Infom also the client. More...
 
bool SetSwim (bool enable) override
 
bool SetCanFly (bool enable, bool packetOnly=false) override
 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(). More...
 
bool SetWaterWalking (bool enable, bool packetOnly=false) override
 Allow to walk on water. Doesn't inform the client. Need to use SendMovementWaterWalking() if it's for players. More...
 
bool SetFeatherFall (bool enable, bool packetOnly=false) override
 
bool SetHover (bool enable, bool packetOnly=false, bool updateAnimationTier=true) override
 
bool HasSpellFocus (Spell const *focusSpell=nullptr) const
 
uint32 GetShieldBlockValue () const override
 
SpellSchoolMask GetMeleeDamageSchoolMask (WeaponAttackType=BASE_ATTACK, uint8=0) const override
 
void SetMeleeDamageSchool (SpellSchools school)
 
void _AddCreatureSpellCooldown (uint32 spell_id, uint16 categoryId, uint32 end_time)
 
void AddSpellCooldown (uint32 spell_id, uint32, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
 
bool HasSpellCooldown (uint32 spell_id) const override
 
uint32 GetSpellCooldown (uint32 spell_id) const
 
void ProhibitSpellSchool (SpellSchoolMask idSchoolMask, uint32 unTimeMs) override
 
bool IsSpellProhibited (SpellSchoolMask idSchoolMask) const
 
void ClearProhibitedSpellTimers ()
 
bool HasSpell (uint32 spellID) const override
 
void UpdateMovementFlags ()
 
uint32 GetRandomId (uint32 id1, uint32 id2, uint32 id3)
 
bool UpdateEntry (uint32 entry, const CreatureData *data=nullptr, bool changelevel=true, bool updateAI=false)
 
bool UpdateEntry (uint32 entry, bool updateAI)
 
bool UpdateStats (Stats stat) override
 
bool UpdateAllStats () override
 
void UpdateResistances (uint32 school) override
 
void UpdateArmor () override
 
void UpdateMaxHealth () override
 
void UpdateMaxPower (Powers power) override
 
void UpdateAttackPowerAndDamage (bool ranged=false) override
 
void CalculateMinMaxDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage, uint8 damageIndex) override
 
void SetCanDualWield (bool value) override
 
int8 GetOriginalEquipmentId () const
 
uint8 GetCurrentEquipmentId ()
 
void SetCurrentEquipmentId (uint8 id)
 
float GetSpellDamageMod (int32 Rank)
 
VendorItemData const * GetVendorItems () const
 
uint32 GetVendorItemCurrentCount (VendorItem const *vItem)
 
uint32 UpdateVendorItemCurrentCount (VendorItem const *vItem, uint32 used_count)
 
TrainerSpellData const * GetTrainerSpells () const
 
CreatureTemplate const * GetCreatureTemplate () const
 
CreatureData const * GetCreatureData () const
 
void SetDetectionDistance (float dist)
 
CreatureAddon const * GetCreatureAddon () const
 
std::string const & GetAIName () const
 
std::string GetScriptName () const
 
uint32 GetScriptId () const
 
std::string const & GetNameForLocaleIdx (LocaleConstant locale_idx) const override
 
void setDeathState (DeathState s, bool despawn=false) override
 A creature can be in 4 different states: Alive, JustDied, Corpse, and JustRespawned. The cycle follows the next order: More...
 
bool LoadFromDB (ObjectGuid::LowType guid, Map *map, bool allowDuplicate=false)
 
bool LoadCreatureFromDB (ObjectGuid::LowType guid, Map *map, bool addToMap=true, bool allowDuplicate=false)
 
void SaveToDB ()
 
virtual void SaveToDB (uint32 mapid, uint8 spawnMask, uint32 phaseMask)
 
virtual void DeleteFromDB ()
 
ObjectGuid GetLootRecipientGUID () const
 
PlayerGetLootRecipient () const
 
ObjectGuid::LowType GetLootRecipientGroupGUID () const
 
GroupGetLootRecipientGroup () const
 
bool hasLootRecipient () const
 
bool isTappedBy (Player const *player) const
 
bool CanGeneratePickPocketLoot () const
 
void SetPickPocketLootTime ()
 
void ResetPickPocketLootTime ()
 
void SetLootRecipient (Unit *unit, bool withGroup=true)
 
void AllLootRemovedFromCorpse ()
 
uint16 GetLootMode () const
 
bool HasLootMode (uint16 lootMode) const
 
void SetLootMode (uint16 lootMode)
 
void AddLootMode (uint16 lootMode)
 
void RemoveLootMode (uint16 lootMode)
 
void ResetLootMode ()
 
SpellInfo const * reachWithSpellAttack (Unit *victim)
 
SpellInfo const * reachWithSpellCure (Unit *victim)
 
bool CanStartAttack (Unit const *u) const
 
float GetAggroRange (Unit const *target) const
 
float GetAttackDistance (Unit const *player) const
 
float GetDetectionRange () const
 
void SendAIReaction (AiReaction reactionType)
 
UnitSelectNearestTarget (float dist=0, bool playerOnly=false) const
 Select nearest hostile unit within the given distance (regardless of threat list). More...
 
UnitSelectNearestTargetInAttackDistance (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. More...
 
void DoFleeToGetAssistance ()
 
void CallForHelp (float fRadius, Unit *target=nullptr)
 
void CallAssistance (Unit *target=nullptr)
 
void SetNoCallAssistance (bool val)
 
void SetNoSearchAssistance (bool val)
 
bool HasSearchedAssistance ()
 
bool CanAssistTo (Unit const *u, Unit const *enemy, bool checkfaction=true) const
 
bool _IsTargetAcceptable (Unit const *target) const
 
bool CanIgnoreFeignDeath () const
 
void UpdateMoveInLineOfSightState ()
 
bool IsMoveInLineOfSightDisabled ()
 
bool IsMoveInLineOfSightStrictlyDisabled ()
 
void RemoveCorpse (bool setSpawnTime=true, bool skipVisibility=false)
 
void DespawnOrUnsummon (Milliseconds msTimeToDespawn, Seconds forcedRespawnTimer)
 
void DespawnOrUnsummon (uint32 msTimeToDespawn=0)
 
void DespawnOnEvade (Seconds respawnDelay=20s)
 
time_t const & GetRespawnTime () const
 
time_t GetRespawnTimeEx () const
 
void SetRespawnTime (uint32 respawn)
 
void Respawn (bool force=false)
 
void SaveRespawnTime () override
 
uint32 GetRespawnDelay () const
 
void SetRespawnDelay (uint32 delay)
 
uint32 GetCombatPulseDelay () const
 
void SetCombatPulseDelay (uint32 delay)
 
float GetWanderDistance () const
 
void SetWanderDistance (float dist)
 
void DoImmediateBoundaryCheck ()
 
void SendZoneUnderAttackMessage (Player *attacker)
 Send a message to LocalDefense channel for players opposition team in the zone. More...
 
void SetInCombatWithZone ()
 Set in combat all units in the dungeon/raid. Affect only units with IsAIEnabled. More...
 
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
 
bool IsNotReachableAndNeedRegen () const
 
void SetPosition (float x, float y, float z, float o)
 
void SetPosition (const Position &pos)
 
void SetHomePosition (float x, float y, float z, float o)
 
void SetHomePosition (const Position &pos)
 
void GetHomePosition (float &x, float &y, float &z, float &ori) const
 
Position const & GetHomePosition () const
 
void SetTransportHomePosition (float x, float y, float z, float o)
 
void SetTransportHomePosition (const Position &pos)
 
void GetTransportHomePosition (float &x, float &y, float &z, float &ori) const
 
Position const & GetTransportHomePosition () const
 
uint32 GetWaypointPath () const
 
void LoadPath (uint32 pathid)
 
uint32 GetCurrentWaypointID () const
 
void UpdateWaypointID (uint32 wpID)
 
void SearchFormation ()
 
CreatureGroup const * GetFormation () const
 
CreatureGroupGetFormation ()
 
void SetFormation (CreatureGroup *formation)
 
UnitSelectVictim ()
 
void SetDisableReputationGain (bool disable)
 
bool IsReputationGainDisabled () const
 
bool IsDamageEnoughForLootingAndReward () const
 
void LowerPlayerDamageReq (uint32 unDamage, bool damagedByPlayer=true)
 
void ResetPlayerDamageReq ()
 
uint32 GetPlayerDamageReq () const
 
uint32 GetOriginalEntry () const
 
void SetOriginalEntry (uint32 entry)
 
void SetTarget (ObjectGuid guid=ObjectGuid::Empty) override
 
void 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 ()
 
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. More...
 
bool CanCastSpell (uint32 spellID) const
 Returns true if the creature is able to cast the spell. More...
 
ObjectGuid GetSummonerGUID () const
 Helper to get the creature's summoner GUID, if it is a summon. More...
 
void SetCombatMovement (bool allowMovement)
 
bool IsCombatMovementAllowed () const
 
std::string GetDebugInfo () const override
 
- Public Member Functions inherited from Unit
 ~Unit () override
 
void Update (uint32 time) override
 
UnitAIGetAI ()
 
void SetAI (UnitAI *newAI)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void CleanupBeforeRemoveFromMap (bool finalCleanup)
 
void CleanupsBeforeDelete (bool finalCleanup=true) override
 
void SetUInt32Value (uint16 index, uint32 value)
 
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. More...
 
void RemoveUnitFlag (UnitFlags flags)
 UnitFlags available in UnitDefines.h. More...
 
void ReplaceAllUnitFlags (UnitFlags flags)
 Remove the Unit flag specify only. More...
 
UnitFlags2 GetUnitFlags2 () const
 Remove all UnitFlags and set new ones. UnitFlags available in UnitDefines.h. More...
 
bool HasUnitFlag2 (UnitFlags2 flags) const
 
void SetUnitFlag2 (UnitFlags2 flags)
 
void RemoveUnitFlag2 (UnitFlags2 flags)
 
void ReplaceAllUnitFlags2 (UnitFlags2 flags)
 
NPCFlags GetNpcFlags () const
 
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
 
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
 
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
 
void SetFaction (uint32 faction)
 
FactionTemplateEntry const * GetFactionTemplateEntry () 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 haveOffhandWeapon () const
 
bool CanDualWield () const
 
virtual void SetCanDualWield (bool value)
 
float GetCombatReach () const override
 
float GetMeleeReach () const
 
bool IsWithinRange (Unit const *obj, float dist) const
 
bool IsWithinCombatRange (Unit const *obj, float dist2compare) const
 
bool IsWithinMeleeRange (Unit const *obj, float dist=0.f) const
 
float GetMeleeRange (Unit const *target) const
 
virtual SpellSchoolMask GetMeleeDamageSchoolMask (WeaponAttackType attackType=BASE_ATTACK, uint8 damageIndex=0) const =0
 
bool GetRandomContactPoint (Unit const *target, float &x, float &y, float &z, bool force=false) const
 
UnitgetAttackerForHelper () 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. More...
 
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. More...
 
void RemoveAllAttackers ()
 Remove all units in m_attackers list and send them AttackStop() More...
 
AttackerSet const & getAttackers () const
 
bool GetMeleeAttackPoint (Unit *attacker, Position &pos)
 
bool isAttackingPlayer () const
 
UnitGetVictim () const
 
void CombatStop (bool includingCast=false)
 
void CombatStopWithPets (bool includingCast=false)
 
void StopAttackFaction (uint32 faction_id)
 
void StopAttackingInvalidTarget ()
 
UnitSelectNearbyTarget (Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
 
UnitSelectNearbyNoTotemTarget (Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
 
void SendMeleeAttackStop (Unit *victim=nullptr)
 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. More...
 
void SendMeleeAttackStart (Unit *victim, Player *sendTo=nullptr)
 
uint32 GetAttackTime (WeaponAttackType att) const
 
void SetAttackTime (WeaponAttackType att, uint32 val)
 
void ApplyAttackTimePercentMod (WeaponAttackType att, float val, bool apply)
 
void ApplyCastTimePercentMod (float val, bool apply)
 
void SetImmuneToAll (bool apply, bool keepCombat=false)
 
bool IsImmuneToAll () const
 
void SetImmuneToPC (bool apply, bool keepCombat=false)
 
bool IsImmuneToPC () const
 
void SetImmuneToNPC (bool apply, bool keepCombat=false)
 
bool IsImmuneToNPC () const
 
bool IsEngaged () const
 
bool IsEngagedBy (Unit const *who) const
 
bool IsInCombat () const
 
bool IsInCombatWith (Unit const *who) const
 
bool IsPetInCombat () const
 
void CombatStart (Unit *target, bool initialAggro=true)
 
void CombatStartOnCast (Unit *target, bool initialAggro=true, uint32 duration=0)
 
void SetInCombatState (bool PvP, Unit *enemy=nullptr, uint32 duration=0)
 
void SetInCombatWith (Unit *enemy, uint32 duration=0)
 
void ClearInCombat ()
 
void ClearInPetCombat ()
 
uint32 GetCombatTimer () const
 
void SetCombatTimer (uint32 timer)
 
bool CanHaveThreatList () const
 
void AddThreat (Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
 
float ApplyTotalThreatModifier (float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
void TauntApply (Unit *victim)
 
void TauntFadeOut (Unit *taunter)
 
ThreatMgrGetThreatMgr ()
 
ThreatMgr const & GetThreatMgr () const
 
void addHatedBy (HostileReference *pHostileReference)
 
void removeHatedBy (HostileReference *)
 
HostileRefMgrgetHostileRefMgr ()
 
void SetRedirectThreat (ObjectGuid guid, uint32 pct)
 
void ResetRedirectThreat ()
 
void ModifyRedirectThreat (int32 amount)
 
uint32 GetRedirectThreatPercent ()
 
UnitGetRedirectThreatTarget () const
 
uint8 GetLevel () const
 
uint8 getLevelForTarget (WorldObject const *) const override
 
void SetLevel (uint8 lvl, bool showLevelChange=true)
 
float GetStat (Stats stat) const
 
void SetStat (Stats stat, int32 val)
 
uint32 GetArmor () const
 
void SetArmor (int32 val)
 
uint32 GetResistance (SpellSchools school) const
 
uint32 GetResistance (SpellSchoolMask mask) const
 
void SetResistance (SpellSchools school, int32 val)
 
uint32 GetHealth () const
 
uint32 GetMaxHealth () const
 
bool IsFullHealth () const
 
bool HealthBelowPct (int32 pct) const
 
bool HealthBelowPctDamaged (int32 pct, uint32 damage) const
 
bool HealthAbovePct (int32 pct) const
 
bool HealthAbovePctHealed (int32 pct, uint32 heal) const
 
float GetHealthPct () const
 
uint32 CountPctFromMaxHealth (int32 pct) const
 
uint32 CountPctFromCurHealth (int32 pct) const
 
float GetPowerPct (Powers power) const
 
void SetHealth (uint32 val)
 
void SetMaxHealth (uint32 val)
 
void SetFullHealth ()
 
int32 ModifyHealth (int32 val)
 
int32 GetHealthGain (int32 dVal)
 
Powers getPowerType () const
 
void setPowerType (Powers power)
 
virtual bool HasActivePowerType (Powers power)
 
uint32 GetPower (Powers power) const
 
uint32 GetMaxPower (Powers power) const
 
void SetPower (Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
 
void SetMaxPower (Powers power, uint32 val)
 
int32 ModifyPower (Powers power, int32 val, bool withPowerUpdate=true)
 
int32 ModifyPowerPct (Powers power, float pct, bool apply=true)
 
bool HandleStatModifier (UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
 
void SetModifierValue (UnitMods unitMod, UnitModifierType modifierType, float value)
 
float GetModifierValue (UnitMods unitMod, UnitModifierType modifierType) const
 
float GetTotalStatValue (Stats stat, float additionalValue=0.0f) const
 
float GetTotalAuraModValue (UnitMods unitMod) const
 
SpellSchools GetSpellSchoolByAuraGroup (UnitMods unitMod) const
 
Stats GetStatByAuraGroup (UnitMods unitMod) const
 
Powers GetPowerTypeByAuraGroup (UnitMods unitMod) const
 
bool CanModifyStats () const
 
void SetCanModifyStats (bool modifyStats)
 
virtual bool UpdateStats (Stats stat)=0
 
virtual bool UpdateAllStats ()=0
 
virtual void UpdateResistances (uint32 school)=0
 
virtual void UpdateAllResistances ()
 
virtual void UpdateArmor ()=0
 
virtual void UpdateMaxHealth ()=0
 
virtual void UpdateMaxPower (Powers power)=0
 
virtual void UpdateAttackPowerAndDamage (bool ranged=false)=0
 
virtual void UpdateDamagePhysical (WeaponAttackType attType)
 
float GetTotalAttackPowerValue (WeaponAttackType attType, Unit *pVictim=nullptr) const
 
float GetWeaponDamageRange (WeaponAttackType attType, WeaponDamageRange type, uint8 damageIndex=0) const
 
void SetBaseWeaponDamage (WeaponAttackType attType, WeaponDamageRange damageRange, float value, uint8 damageIndex=0)
 
virtual void CalculateMinMaxDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage, uint8 damageIndex=0)=0
 
uint32 CalculateDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, uint8 itemDamagesMask=0)
 
float GetAPMultiplier (WeaponAttackType attType, bool normalized)
 
DiminishingLevels GetDiminishing (DiminishingGroup group)
 
void IncrDiminishing (DiminishingGroup group)
 
float ApplyDiminishingToDuration (DiminishingGroup group, int32 &duration, Unit *caster, DiminishingLevels Level, int32 limitduration)
 
void ApplyDiminishingAura (DiminishingGroup group, bool apply)
 
void ClearDiminishings ()
 
float GetSpellMaxRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
float GetSpellMinRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
bool CanFreeMove () const
 
SheathState GetSheath () const
 
virtual void SetSheath (SheathState sheathed)
 
ReputationRank GetReactionTo (Unit const *target, bool checkOriginalFaction=false) const
 
ReputationRank GetFactionReactionTo (FactionTemplateEntry const *factionTemplateEntry, Unit const *target) const
 
bool IsHostileTo (Unit const *unit) const
 
bool IsHostileToPlayers () const
 
bool IsFriendlyTo (Unit const *unit) const
 
bool IsNeutralToAll () const
 
bool IsInPartyWith (Unit const *unit) const
 
bool IsInRaidWith (Unit const *unit) const
 
void GetPartyMembers (std::list< Unit * > &units)
 
bool IsContestedGuard () const
 
bool IsInSanctuary () const
 
bool IsPvP () const
 
bool IsFFAPvP () const
 
void SetPvP (bool state)
 
uint32 GetCreatureType () const
 
uint32 GetCreatureTypeMask () const
 
uint8 getStandState () const
 
bool IsSitState () const
 
bool IsStandState () const
 
void SetStandState (uint8 state)
 
void SetStandFlags (uint8 flags)
 
void RemoveStandFlags (uint8 flags)
 
bool IsMounted () const
 
uint32 GetMountID () const
 
void Mount (uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
 
void Dismount ()
 
uint16 GetMaxSkillValueForLevel (Unit const *target=nullptr) const
 
void KillSelf (bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
 
void ProcDamageAndSpellFor (bool isVictim, Unit *target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const *procSpellInfo, uint32 damage, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
 
void GetProcAurasTriggeredOnEvent (std::list< AuraApplication * > &aurasTriggeringProc, std::list< AuraApplication * > *procAuras, ProcEventInfo eventInfo)
 
void TriggerAurasProcOnEvent (CalcDamageInfo &damageInfo)
 
void TriggerAurasProcOnEvent (std::list< AuraApplication * > *myProcAuras, std::list< AuraApplication * > *targetProcAuras, Unit *actionTarget, uint32 typeMaskActor, uint32 typeMaskActionTarget, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell *spell, DamageInfo *damageInfo, HealInfo *healInfo)
 
void TriggerAurasProcOnEvent (ProcEventInfo &eventInfo, std::list< AuraApplication * > &procAuras)
 
void HandleEmoteCommand (uint32 emoteId)
 
void AttackerStateUpdate (Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false, bool ignoreCasting=false)
 
void CalculateMeleeDamage (Unit *victim, CalcDamageInfo *damageInfo, WeaponAttackType attackType=BASE_ATTACK, const bool sittingVictim=false)
 
void DealMeleeDamage (CalcDamageInfo *damageInfo, bool durabilityLoss)
 
void HandleProcExtraAttackFor (Unit *victim, uint32 count)
 
void SetLastExtraAttackSpell (uint32 spellId)
 
uint32 GetLastExtraAttackSpell () const
 
void AddExtraAttacks (uint32 count)
 
void SetLastDamagedTargetGuid (ObjectGuid const &guid)
 
ObjectGuid const & GetLastDamagedTargetGuid () const
 
void CalculateSpellDamageTaken (SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=BASE_ATTACK, bool crit=false)
 
void DealSpellDamage (SpellNonMeleeDamage *damageInfo, bool durabilityLoss, Spell const *spell=nullptr)
 
float GetMeleeCritChanceReduction () const
 
float GetRangedCritChanceReduction () const
 
float GetSpellCritChanceReduction () const
 
uint32 GetMeleeCritDamageReduction (uint32 damage) const
 
uint32 GetRangedCritDamageReduction (uint32 damage) const
 
uint32 GetSpellCritDamageReduction (uint32 damage) const
 
uint32 GetMeleeDamageReduction (uint32 damage) const
 
uint32 GetRangedDamageReduction (uint32 damage) const
 
uint32 GetSpellDamageReduction (uint32 damage) const
 
float MeleeSpellMissChance (Unit const *victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
 
SpellMissInfo MeleeSpellHitResult (Unit *victim, SpellInfo const *spell)
 
SpellMissInfo MagicSpellHitResult (Unit *victim, SpellInfo const *spell)
 
SpellMissInfo SpellHitResult (Unit *victim, SpellInfo const *spell, bool canReflect=false)
 
SpellMissInfo SpellHitResult (Unit *victim, Spell const *spell, bool canReflect=false)
 
float GetUnitDodgeChance () const
 
float GetUnitParryChance () const
 
float GetUnitBlockChance () const
 
float GetUnitMissChance (WeaponAttackType attType) const
 
float GetUnitCriticalChance (WeaponAttackType attackType, Unit const *victim) const
 
int32 GetMechanicResistChance (SpellInfo const *spell)
 
bool CanUseAttackType (uint8 attacktype) const
 
virtual uint32 GetShieldBlockValue () const =0
 
uint32 GetShieldBlockValue (uint32 soft_cap, uint32 hard_cap) const
 
uint32 GetUnitMeleeSkill (Unit const *target=nullptr) const
 
uint32 GetDefenseSkillValue (Unit const *target=nullptr) const
 
uint32 GetWeaponSkillValue (WeaponAttackType attType, Unit const *target=nullptr) const
 
float GetWeaponProcChance () const
 
float GetPPMProcChance (uint32 WeaponSpeed, float PPM, SpellInfo const *spellProto) const
 
MeleeHitOutcome RollMeleeOutcomeAgainst (Unit const *victim, WeaponAttackType attType) const
 
MeleeHitOutcome RollMeleeOutcomeAgainst (Unit const *victim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance) const
 
bool IsCritter () const
 
bool IsInFlight () const
 
bool HasAuraTypeWithFamilyFlags (AuraType auraType, uint32 familyName, uint32 familyFlags) const
 
virtual bool HasSpell (uint32) const
 
bool HasBreakableByDamageAuraType (AuraType type, uint32 excludeAura=0) const
 
bool HasBreakableByDamageCrowdControlAura (Unit *excludeCasterChannel=nullptr) const
 
bool HasStealthAura () const
 
bool HasInvisibilityAura () const
 
bool isFeared () const
 
bool isInRoots () const
 
bool IsPolymorphed () const
 
bool isFrozen () const
 
bool isTargetableForAttack (bool checkFakeDeath=true, Unit const *byWho=nullptr) const
 
bool IsValidAttackTarget (Unit const *target, SpellInfo const *bySpell=nullptr) const
 
bool _IsValidAttackTarget (Unit const *target, SpellInfo const *bySpell, WorldObject const *obj=nullptr) const
 
bool IsValidAssistTarget (Unit const *target) const
 
bool _IsValidAssistTarget (Unit const *target, SpellInfo const *bySpell) const
 
virtual bool IsInWater () const
 
virtual bool IsUnderWater () const
 
bool isInAccessiblePlaceFor (Creature const *c) const
 
void SendHealSpellLog (HealInfo const &healInfo, bool critical=false)
 
int32 HealBySpell (HealInfo &healInfo, bool critical=false)
 
void SendEnergizeSpellLog (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
 
void EnergizeBySpell (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
 
SpellCastResult CastSpell (SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, uint32 spellId, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, SpellInfo const *spellInfo, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, SpellInfo const *spellInfo, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (float x, float y, float z, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (GameObject *go, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, SpellValueMod mod, int32 value, Unit *victim, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, SpellValueMod mod, int32 value, Unit *victim=nullptr, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, CustomSpellValues const &value, Unit *victim=nullptr, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
AuraAddAura (uint32 spellId, Unit *target)
 
AuraAddAura (SpellInfo const *spellInfo, uint8 effMask, Unit *target)
 
void SetAuraStack (uint32 spellId, Unit *target, uint32 stack)
 
void SendPlaySpellVisual (uint32 id)
 
void SendPlaySpellImpact (ObjectGuid guid, uint32 id)
 
void BuildCooldownPacket (WorldPacket &data, uint8 flags, uint32 spellId, uint32 cooldown)
 
void BuildCooldownPacket (WorldPacket &data, uint8 flags, PacketCooldowns const &cooldowns)
 
void DeMorph ()
 
void SendAttackStateUpdate (CalcDamageInfo *damageInfo)
 
void SendAttackStateUpdate (uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount)
 
void SendSpellNonMeleeDamageLog (SpellNonMeleeDamage *log)
 
void SendSpellNonMeleeReflectLog (SpellNonMeleeDamage *log, Unit *attacker)
 
void SendSpellNonMeleeDamageLog (Unit *target, SpellInfo const *spellInfo, uint32 Damage, SpellSchoolMask damageSchoolMask, uint32 AbsorbedDamage, uint32 Resist, bool PhysicalDamage, uint32 Blocked, bool CriticalHit=false, bool Split=false)
 
void SendPeriodicAuraLog (SpellPeriodicAuraLogInfo *pInfo)
 
void SendSpellMiss (Unit *target, uint32 spellID, SpellMissInfo missInfo)
 
void SendSpellDamageResist (Unit *target, uint32 spellId)
 
void SendSpellDamageImmune (Unit *target, uint32 spellId)
 
void NearTeleportTo (Position &pos, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
 
void NearTeleportTo (float x, float y, float z, float orientation, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
 
void SendTameFailure (uint8 result)
 
void SendTeleportPacket (Position &pos)
 
virtual bool UpdatePosition (float x, float y, float z, float ang, bool teleport=false)
 
bool UpdatePosition (const Position &pos, bool teleport=false)
 
void UpdateOrientation (float orientation)
 Only server-side orientation update, does not broadcast to client. More...
 
void UpdateHeight (float newZ)
 Only server-side height update, does not broadcast to client. More...
 
void KnockbackFrom (float x, float y, float speedXY, float speedZ)
 
void JumpTo (float speedXY, float speedZ, bool forward=true)
 
void JumpTo (WorldObject *obj, float speedZ)
 
void SendMonsterMove (float NewPosX, float NewPosY, float NewPosZ, uint32 TransitTime, SplineFlags sf=SPLINEFLAG_WALK_MODE)
 
void MonsterMoveWithSpeed (float x, float y, float z, float speed)
 
void SendMovementFlagUpdate (bool self=false)
 
virtual bool SetWalk (bool enable)
 
virtual bool SetDisableGravity (bool disable, bool packetOnly=false, bool updateAnimationTier=true)
 
virtual bool SetSwim (bool enable)
 
virtual bool SetCanFly (bool enable, bool packetOnly=false)
 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(). More...
 
virtual bool SetWaterWalking (bool enable, bool packetOnly=false)
 Allow to walk on water. Doesn't inform the client. Need to use SendMovementWaterWalking() if it's for players. More...
 
virtual bool SetFeatherFall (bool enable, bool packetOnly=false)
 
virtual bool SetHover (bool enable, bool packetOnly=false, bool updateAnimationTier=true)
 
void SendMovementWaterWalking (Player *sendTo)
 
void SendMovementFeatherFall (Player *sendTo)
 
void SendMovementHover (Player *sendTo)
 
void SetInFront (WorldObject const *target)
 
void SetFacingTo (float ori)
 
void SetFacingToObject (WorldObject *object)
 
void SendChangeCurrentVictimOpcode (HostileReference *pHostileReference)
 
void SendClearThreatListOpcode ()
 
void SendRemoveFromThreatListOpcode (HostileReference *pHostileReference)
 
void SendThreatListUpdate ()
 
void SendClearTarget ()
 
void BuildHeartBeatMsg (WorldPacket *data) const
 
bool IsAlive () const
 
bool isDying () const
 
bool isDead () const
 
DeathState getDeathState ()
 
virtual void setDeathState (DeathState s, bool despawn=false)
 
ObjectGuid GetOwnerGUID () const
 
void SetOwnerGUID (ObjectGuid owner)
 
ObjectGuid GetCreatorGUID () const
 
void SetCreatorGUID (ObjectGuid creator)
 
ObjectGuid GetMinionGUID () const
 
void SetMinionGUID (ObjectGuid guid)
 
ObjectGuid GetCharmerGUID () const
 
void SetCharmerGUID (ObjectGuid owner)
 
ObjectGuid GetCharmGUID () const
 
void SetPetGUID (ObjectGuid guid)
 
ObjectGuid GetPetGUID () const
 
void SetCritterGUID (ObjectGuid guid)
 
ObjectGuid GetCritterGUID () const
 
bool IsControlledByPlayer () const
 
bool IsCreatedByPlayer () const
 
ObjectGuid GetCharmerOrOwnerGUID () const
 
ObjectGuid GetCharmerOrOwnerOrOwnGUID () const
 
bool IsCharmedOwnedByPlayerOrPlayer () const
 
PlayerGetSpellModOwner () const
 
UnitGetOwner () const
 
GuardianGetGuardianPet () const
 
MinionGetFirstMinion () const
 
UnitGetCharmer () const
 
UnitGetCharm () const
 
UnitGetCharmerOrOwner () const
 
UnitGetCharmerOrOwnerOrSelf () const
 
PlayerGetCharmerOrOwnerPlayerOrPlayerItself () const
 
PlayerGetAffectingPlayer () const
 
void SetMinion (Minion *minion, bool apply)
 
void GetAllMinionsByEntry (std::list< Creature * > &Minions, uint32 entry)
 
void RemoveAllMinionsByEntry (uint32 entry)
 
void SetCharm (Unit *target, bool apply)
 
UnitGetNextRandomRaidMemberOrPet (float radius)
 
bool SetCharmedBy (Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
 
void RemoveCharmedBy (Unit *charmer)
 
void RestoreFaction ()
 
UnitGetFirstControlled () const
 
void RemoveAllControlled (bool onDeath=false)
 
bool IsCharmed () const
 
bool isPossessed () const
 
bool isPossessedByPlayer () const
 
bool isPossessing () const
 
bool isPossessing (Unit *u) const
 
CharmInfoGetCharmInfo ()
 
CharmInfoInitCharmInfo ()
 
void DeleteCharmInfo ()
 
void UpdateCharmAI ()
 
SharedVisionList const & GetSharedVisionList ()
 
void AddPlayerToVision (Player *player)
 
void RemovePlayerFromVision (Player *player)
 
bool HasSharedVision () const
 
void RemoveBindSightAuras ()
 
void RemoveCharmAuras ()
 
PetCreateTamedPetFrom (Creature *creatureTarget, uint32 spell_id=0)
 
PetCreateTamedPetFrom (uint32 creatureEntry, uint32 spell_id=0)
 
bool InitTamedPet (Pet *pet, uint8 level, uint32 spell_id)
 
Aura_TryStackingOrRefreshingExistingAura (SpellInfo const *newAura, uint8 effMask, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, bool periodicReset=false)
 
void _AddAura (UnitAura *aura, Unit *caster)
 
AuraApplication_CreateAuraApplication (Aura *aura, uint8 effMask)
 
void _ApplyAuraEffect (Aura *aura, uint8 effIndex)
 
void _ApplyAura (AuraApplication *aurApp, uint8 effMask)
 
void _UnapplyAura (AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
 
void _UnapplyAura (AuraApplication *aurApp, AuraRemoveMode removeMode)
 
void _RemoveNoStackAuraApplicationsDueToAura (Aura *aura)
 
void _RemoveNoStackAurasDueToAura (Aura *aura)
 
bool _IsNoStackAuraDueToAura (Aura *appliedAura, Aura *existingAura) const
 
void _RegisterAuraEffect (AuraEffect *aurEff, bool apply)
 
AuraMapGetOwnedAuras ()
 
AuraMap const & GetOwnedAuras () const
 
void RemoveOwnedAura (AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAura (Aura *aura, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
AuraGetOwnedAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, Aura *except=nullptr) const
 
AuraApplicationMapGetAppliedAuras ()
 
AuraApplicationMap const & GetAppliedAuras () const
 
void RemoveAura (AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (AuraApplication *aurApp, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (Aura *aur, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAppliedAuras (std::function< bool(AuraApplication const *)> const &check)
 
void RemoveOwnedAuras (std::function< bool(Aura const *)> const &check)
 
void RemoveAppliedAuras (uint32 spellId, std::function< bool(AuraApplication const *)> const &check)
 
void RemoveOwnedAuras (uint32 spellId, std::function< bool(Aura const *)> const &check)
 
void RemoveAurasDueToSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAuraFromStack (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAurasDueToSpellByDispel (uint32 spellId, uint32 dispellerSpellId, ObjectGuid casterGUID, Unit *dispeller, uint8 chargesRemoved=1)
 
void RemoveAurasDueToSpellBySteal (uint32 spellId, ObjectGuid casterGUID, Unit *stealer)
 
void RemoveAurasDueToItemSpell (uint32 spellId, ObjectGuid castItemGuid)
 
void RemoveAurasByType (AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
 
void RemoveNotOwnSingleTargetAuras ()
 
void RemoveAurasWithInterruptFlags (uint32 flag, uint32 except=0, bool isAutoshot=false)
 
void RemoveAurasWithAttribute (uint32 flags)
 
void RemoveAurasWithFamily (SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID)
 
void RemoveAurasWithMechanic (uint32 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
 
void RemoveMovementImpairingAuras (bool withRoot)
 
void RemoveAurasByShapeShift ()
 
void RemoveAreaAurasDueToLeaveWorld ()
 
void RemoveAllAuras ()
 
void RemoveArenaAuras ()
 
void RemoveAllAurasOnDeath ()
 
void RemoveAllAurasRequiringDeadTarget ()
 
void RemoveAllAurasExceptType (AuraType type)
 
void RemoveEvadeAuras ()
 
void DelayOwnedAuras (uint32 spellId, ObjectGuid caster, int32 delaytime)
 
void _RemoveAllAuraStatMods ()
 
void _ApplyAllAuraStatMods ()
 
AuraEffectList const & GetAuraEffectsByType (AuraType type) const
 
AuraListGetSingleCastAuras ()
 
AuraList const & GetSingleCastAuras () const
 
AuraEffectGetAuraEffect (uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffectOfRankedSpell (uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffect (AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
 
AuraEffectGetAuraEffect (AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffectDummy (uint32 spellid) const
 
AuraEffectGetDummyAuraEffect (SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
 
AuraApplicationGetAuraApplication (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
 
AuraGetAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
AuraApplicationGetAuraApplicationOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
 
AuraGetAuraOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
void GetDispellableAuraList (Unit *caster, uint32 dispelMask, DispelChargesList &dispelList, SpellInfo const *dispelSpell)
 
bool HasAuraEffect (uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
 
uint32 GetAuraCount (uint32 spellId) const
 
bool HasAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
bool HasAuraType (AuraType auraType) const
 
bool HasAuraTypeWithCaster (AuraType auratype, ObjectGuid caster) const
 
bool HasAuraTypeWithMiscvalue (AuraType auratype, int32 miscvalue) const
 
bool HasAuraTypeWithAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
bool HasAuraTypeWithValue (AuraType auratype, int32 value) const
 
bool HasAuraTypeWithTriggerSpell (AuraType auratype, uint32 triggerSpell) const
 
bool HasNegativeAuraWithInterruptFlag (uint32 flag, ObjectGuid guid=ObjectGuid::Empty)
 
bool HasVisibleAuraType (AuraType auraType) const
 
bool HasNegativeAuraWithAttribute (uint32 flag, ObjectGuid guid=ObjectGuid::Empty)
 
bool HasAuraWithMechanic (uint32 mechanicMask) const
 
AuraEffectIsScriptOverriden (SpellInfo const *spell, int32 script) const
 
uint32 GetDiseasesByCaster (ObjectGuid casterGUID, uint8 mode=0)
 
uint32 GetDoTsByCaster (ObjectGuid casterGUID) const
 
int32 GetTotalAuraModifierAreaExclusive (AuraType auratype) const
 
int32 GetTotalAuraModifier (AuraType auratype) const
 
float GetTotalAuraMultiplier (AuraType auratype) const
 
int32 GetMaxPositiveAuraModifier (AuraType auratype)
 
int32 GetMaxNegativeAuraModifier (AuraType auratype) const
 
int32 GetTotalAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
float GetTotalAuraMultiplierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
int32 GetMaxPositiveAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask, const AuraEffect *except=nullptr) const
 
int32 GetMaxNegativeAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
int32 GetTotalAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
float GetTotalAuraMultiplierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetMaxPositiveAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetMaxNegativeAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetTotalAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
float GetTotalAuraMultiplierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
int32 GetMaxPositiveAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
int32 GetMaxNegativeAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
float GetResistanceBuffMods (SpellSchools school, bool positive) const
 
void SetResistanceBuffMods (SpellSchools school, bool positive, float val)
 
void ApplyResistanceBuffModsMod (SpellSchools school, bool positive, float val, bool apply)
 
void ApplyResistanceBuffModsPercentMod (SpellSchools school, bool positive, float val, bool apply)
 
void InitStatBuffMods ()
 
void ApplyStatBuffMod (Stats stat, float val, bool apply)
 
void ApplyStatPercentBuffMod (Stats stat, float val, bool apply)
 
void SetCreateStat (Stats stat, float val)
 
void SetCreateHealth (uint32 val)
 
uint32 GetCreateHealth () const
 
void SetCreateMana (uint32 val)
 
uint32 GetCreateMana () const
 
uint32 GetCreatePowers (Powers power) const
 
float GetPosStat (Stats stat) const
 
float GetNegStat (Stats stat) const
 
float GetCreateStat (Stats stat) const
 
void SetCurrentCastedSpell (Spell *pSpell)
 
virtual void ProhibitSpellSchool (SpellSchoolMask, uint32)
 
void InterruptSpell (CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
 
void FinishSpell (CurrentSpellTypes spellType, bool ok=true)
 
bool IsNonMeleeSpellCast (bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
 
void InterruptNonMeleeSpells (bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
 
SpellGetCurrentSpell (CurrentSpellTypes spellType) const
 
SpellGetCurrentSpell (uint32 spellType) const
 
SpellFindCurrentSpellBySpellId (uint32 spell_id) const
 
int32 GetCurrentSpellCastTime (uint32 spell_id) const
 
virtual bool IsMovementPreventedByCasting () const
 
ShapeshiftForm GetShapeshiftForm () const
 
void SetShapeshiftForm (ShapeshiftForm form)
 
bool IsInFeralForm () const
 
bool IsInDisallowedMountForm () const
 
bool isInFrontInMap (Unit const *target, float distance, float arc=M_PI) const
 
bool isInBackInMap (Unit const *target, float distance, float arc=M_PI) const
 
bool IsVisible () const
 
void SetVisible (bool x)
 
void SetModelVisible (bool on)
 
uint32 GetPhaseByAuras () const
 
void SetPhaseMask (uint32 newPhaseMask, bool update) override
 
void UpdateObjectVisibility (bool forced=true, bool fromUpdate=false) override
 
VisibleAuraMap const * GetVisibleAuras ()
 
AuraApplicationGetVisibleAura (uint8 slot)
 
void SetVisibleAura (uint8 slot, AuraApplication *aur)
 
void RemoveVisibleAura (uint8 slot)
 
uint32 GetInterruptMask () const
 
void AddInterruptMask (uint32 mask)
 
void UpdateInterruptMask ()
 
virtual float GetNativeObjectScale () const
 
virtual void RecalculateObjectScale ()
 
uint32 GetDisplayId () const
 
virtual void SetDisplayId (uint32 modelId, float displayScale=1.f)
 
uint32 GetNativeDisplayId () const
 
void RestoreDisplayId ()
 
void SetNativeDisplayId (uint32 displayId)
 
void setTransForm (uint32 spellid)
 
uint32 getTransForm () const
 
void _RegisterDynObject (DynamicObject *dynObj)
 
void _UnregisterDynObject (DynamicObject *dynObj)
 
DynamicObjectGetDynObject (uint32 spellId)
 
bool RemoveDynObject (uint32 spellId)
 
void RemoveAllDynObjects ()
 
GameObjectGetGameObject (uint32 spellId) const
 
void AddGameObject (GameObject *gameObj)
 
void RemoveGameObject (GameObject *gameObj, bool del)
 
void RemoveGameObject (uint32 spellid, bool del)
 
void RemoveAllGameObjects ()
 
void ModifyAuraState (AuraStateType flag, bool apply)
 
uint32 BuildAuraStateUpdateForTarget (Unit *target) const
 
bool HasAuraState (AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
 
void UnsummonAllTotems (bool onDeath=false)
 
UnitGetMagicHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo)
 
UnitGetMeleeHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo=nullptr)
 
int32 SpellBaseDamageBonusDone (SpellSchoolMask schoolMask)
 
int32 SpellBaseDamageBonusTaken (SpellSchoolMask schoolMask, bool isDoT=false)
 
float SpellPctDamageModsDone (Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
 
uint32 SpellDamageBonusDone (Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
 
uint32 SpellDamageBonusTaken (Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack=1)
 
int32 SpellBaseHealingBonusDone (SpellSchoolMask schoolMask)
 
int32 SpellBaseHealingBonusTaken (SpellSchoolMask schoolMask)
 
float SpellPctHealingModsDone (Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
 
uint32 SpellHealingBonusDone (Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
 
uint32 SpellHealingBonusTaken (Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack=1)
 
uint32 MeleeDamageBonusDone (Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
uint32 MeleeDamageBonusTaken (Unit *attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
bool isSpellBlocked (Unit *victim, SpellInfo const *spellProto, WeaponAttackType attackType=BASE_ATTACK)
 
bool isBlockCritical ()
 
float SpellDoneCritChance (Unit const *, SpellInfo const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType, bool skipEffectCheck) const
 
float SpellTakenCritChance (Unit const *caster, SpellInfo const *spellProto, SpellSchoolMask schoolMask, float doneChance, WeaponAttackType attackType, bool skipEffectCheck) const
 
void SetLastManaUse (uint32 spellCastTime)
 
bool IsUnderLastManaUseEffect () const
 
void SetContestedPvP (Player *attackedPlayer=nullptr, bool lookForNearContestedGuards=true)
 
uint32 GetCastingTimeForBonus (SpellInfo const *spellProto, DamageEffectType damagetype, uint32 CastingTime) const
 
float CalculateDefaultCoefficient (SpellInfo const *spellInfo, DamageEffectType damagetype) const
 
void CastDelayedSpellWithPeriodicAmount (Unit *caster, uint32 spellId, AuraType auraType, int32 addAmount, uint8 effectIndex=0)
 
void ApplySpellImmune (uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
 
void ApplySpellDispelImmunity (SpellInfo const *spellProto, DispelType type, bool apply)
 
virtual bool IsImmunedToSpell (SpellInfo const *spellInfo, Spell const *spell=nullptr)
 
bool IsImmunedToDamage (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToDamage (SpellInfo const *spellInfo) const
 
bool IsImmunedToDamage (Spell const *spell) const
 
bool IsImmunedToSchool (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToSchool (SpellInfo const *spellInfo) const
 
bool IsImmunedToSchool (Spell const *spell) const
 
bool IsImmunedToDamageOrSchool (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToDamageOrSchool (SpellInfo const *spellInfo) const
 
virtual bool IsImmunedToSpellEffect (SpellInfo const *spellInfo, uint32 index) const
 
void UpdateSpeed (UnitMoveType mtype, bool forced)
 
float GetSpeed (UnitMoveType mtype) const
 
float GetSpeedRate (UnitMoveType mtype) const
 
void SetSpeed (UnitMoveType mtype, float rate, bool forced=false)
 
void SetSpeedRate (UnitMoveType mtype, float rate)
 
float ApplyEffectModifiers (SpellInfo const *spellProto, uint8 effect_index, float value) const
 
int32 CalculateSpellDamage (Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
 
int32 CalcSpellDuration (SpellInfo const *spellProto)
 
int32 ModSpellDuration (SpellInfo const *spellProto, Unit const *target, int32 duration, bool positive, uint32 effectMask)
 
void ModSpellCastTime (SpellInfo const *spellProto, int32 &castTime, Spell *spell=nullptr)
 
float CalculateLevelPenalty (SpellInfo const *spellProto) const
 
void addFollower (FollowerReference *pRef)
 
void removeFollower (FollowerReference *)
 
MotionMasterGetMotionMaster ()
 
const MotionMasterGetMotionMaster () const
 
virtual MovementGeneratorType GetDefaultMovementType () const
 -------—End of Pet responses methods-------— More...
 
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. More...
 
void ResumeMovement (uint32 timer=0, uint8 slot=0)
 
void AddUnitMovementFlag (uint32 f)
 
void RemoveUnitMovementFlag (uint32 f)
 
bool HasUnitMovementFlag (uint32 f) const
 
uint32 GetUnitMovementFlags () const
 
void SetUnitMovementFlags (uint32 f)
 
void AddExtraUnitMovementFlag (uint16 f)
 
void RemoveExtraUnitMovementFlag (uint16 f)
 
uint16 HasExtraUnitMovementFlag (uint16 f) const
 
uint16 GetExtraUnitMovementFlags () const
 
void SetExtraUnitMovementFlags (uint16 f)
 
void SetControlled (bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
 
void DisableRotate (bool apply)
 
void DisableSpline ()
 
uint8 GetComboPoints (Unit const *who=nullptr) const
 --------—Combo point system----------------— More...
 
uint8 GetComboPoints (ObjectGuid const &guid) const
 
UnitGetComboTarget () const
 
ObjectGuid const GetComboTargetGUID () const
 
void AddComboPoints (Unit *target, int8 count)
 
void AddComboPoints (int8 count)
 
void ClearComboPoints ()
 
void SendComboPoints ()
 
void AddComboPointHolder (Unit *unit)
 
void RemoveComboPointHolder (Unit *unit)
 
void ClearComboPointHolders ()
 
void SendPetActionFeedback (uint8 msg)
 -------—Pet responses methods--------------— More...
 
void SendPetTalk (uint32 pettalk)
 
void SendPetAIReaction (ObjectGuid guid)
 
void propagateSpeedChange ()
 -------—End of Pet responses methods-------— More...
 
void ClearAllReactives ()
 
void StartReactiveTimer (ReactiveType reactive)
 
void UpdateReactives (uint32 p_time)
 
void UpdateAuraForGroup (uint8 slot)
 
bool CanProc ()
 
void SetCantProc (bool apply)
 
void AddPetAura (PetAura const *petSpell)
 
void RemovePetAura (PetAura const *petSpell)
 
void CastPetAura (PetAura const *aura)
 
bool IsPetAura (Aura const *aura)
 
uint32 GetModelForForm (ShapeshiftForm form, uint32 spellId) const
 
uint32 GetModelForTotem (PlayerTotemType totemType)
 
bool CreateVehicleKit (uint32 id, uint32 creatureEntry)
 
void RemoveVehicleKit ()
 
VehicleGetVehicleKit () const
 
VehicleGetVehicle () const
 
bool IsOnVehicle (Unit const *vehicle) const
 
UnitGetVehicleBase () const
 
CreatureGetVehicleCreatureBase () const
 
ObjectGuid GetTransGUID () const override
 
TransportBaseGetDirectTransport () const
 Returns the transport this unit is on directly (if on vehicle and transport, return vehicle) More...
 
bool HandleSpellClick (Unit *clicker, int8 seatId=-1)
 
void EnterVehicle (Unit *base, int8 seatId=-1)
 
void EnterVehicleUnattackable (Unit *base, int8 seatId=-1)
 
void ExitVehicle (Position const *exitPosition=nullptr)
 
void ChangeSeat (int8 seatId, bool next=true)
 
void _ExitVehicle (Position const *exitPosition=nullptr)
 
void _EnterVehicle (Vehicle *vehicle, int8 seatId, AuraApplication const *aurApp=nullptr)
 
void BuildMovementPacket (ByteBuffer *data) const
 
virtual bool CanSwim () const
 this method checks the current flag of a unit More...
 
bool IsLevitating () const
 
bool IsWalking () const
 
bool isMoving () const
 
bool isTurning () const
 
bool IsHovering () const
 
bool isSwimming () const
 
virtual bool CanFly () const =0
 
bool IsFlying () const
 
bool IsFalling () const
 
float GetHoverHeight () const
 
virtual bool CanEnterWater () const =0
 
void RewardRage (uint32 damage, uint32 weaponSpeedHitFactor, bool attacker)
 
virtual float GetFollowAngle () const
 
void OutDebugInfo () const
 
virtual bool isBeingLoaded () const
 
bool IsDuringRemoveFromWorld () const
 
PetToPet ()
 
TotemToTotem ()
 
TempSummonToTempSummon ()
 
const TempSummonToTempSummon () const
 
void AddPointedBy (SafeUnitPointer *sup)
 
void RemovePointedBy (SafeUnitPointer *sup)
 
void ExecuteDelayedUnitRelocationEvent ()
 
void ExecuteDelayedUnitAINotifyEvent ()
 
virtual bool HasSpellCooldown (uint32) const
 
virtual bool HasSpellItemCooldown (uint32, uint32) const
 
virtual void AddSpellCooldown (uint32, uint32, uint32, bool needSendToClient=false, bool forceSendToSpectator=false)
 
bool CanApplyResilience () const
 
void PetSpellFail (SpellInfo const *spellInfo, Unit *target, uint32 result)
 
int32 CalculateAOEDamageReduction (int32 damage, uint32 schoolMask, Unit *caster) const
 
ObjectGuid GetTarget () const
 
virtual void SetTarget (ObjectGuid=ObjectGuid::Empty)=0
 
void SetInstantCast (bool set)
 
bool CanInstantCast () const
 
virtual void Talk (std::string_view text, ChatMsg msgType, Language language, float textRange, WorldObject const *target)
 
virtual void Say (std::string_view text, Language language, WorldObject const *target=nullptr)
 
virtual void Yell (std::string_view text, Language language, WorldObject const *target=nullptr)
 
virtual void TextEmote (std::string_view text, WorldObject const *target=nullptr, bool isBossEmote=false)
 
virtual void Whisper (std::string_view text, Language language, Player *target, bool isBossWhisper=false)
 
virtual void Talk (uint32 textId, ChatMsg msgType, float textRange, WorldObject const *target)
 
virtual void Say (uint32 textId, WorldObject const *target=nullptr)
 
virtual void Yell (uint32 textId, WorldObject const *target=nullptr)
 
virtual void TextEmote (uint32 textId, WorldObject const *target=nullptr, bool isBossEmote=false)
 
virtual void Whisper (uint32 textId, Player *target, bool isBossWhisper=false)
 
float GetCollisionHeight () const override
 Return collision height sent to client. More...
 
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 More...
 
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 More...
 
void ProcessPositionDataChanged (PositionFullTerrainStatus const &data) override
 
virtual void ProcessTerrainStatusUpdate ()
 
bool CanRestoreMana (SpellInfo const *spellInfo) const
 
std::string GetDebugInfo () const override
 
uint32 GetOldFactionId () const
 
- Public Member Functions inherited from WorldObject
 ~WorldObject () override
 
virtual void Update (uint32)
 
void _Create (ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void GetNearPoint2D (WorldObject const *searcher, float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
 
void GetNearPoint2D (float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
 
void GetNearPoint (WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle, float controlZ=0, Position const *startPos=nullptr) const
 
void GetVoidClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0, float controlZ=0) const
 
bool GetClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float angle=0, WorldObject const *forWho=nullptr, bool force=false) const
 
void MovePosition (Position &pos, float dist, float angle)
 
Position GetNearPosition (float dist, float angle)
 
void MovePositionToFirstCollision (Position &pos, float dist, float angle)
 
Position GetFirstCollisionPosition (float startX, float startY, float startZ, float destX, float destY)
 
Position GetFirstCollisionPosition (float destX, float destY, float destZ)
 
Position GetFirstCollisionPosition (float dist, float angle)
 
Position GetRandomNearPosition (float radius)
 
void GetContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
void GetChargeContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
float GetObjectSize () const
 
virtual float GetCombatReach () const
 
void UpdateGroundPositionZ (float x, float y, float &z) const
 
void UpdateAllowedPositionZ (float x, float y, float &z, float *groundZ=nullptr) const
 
void GetRandomPoint (const Position &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
 
Position GetRandomPoint (const Position &srcPos, float distance) const
 
uint32 GetInstanceId () const
 
virtual void SetPhaseMask (uint32 newPhaseMask, bool update)
 
uint32 GetPhaseMask () const
 
bool InSamePhase (WorldObject const *obj) const
 
bool InSamePhase (uint32 phasemask) const
 
uint32 GetZoneId () const
 
uint32 GetAreaId () const
 
void GetZoneAndAreaId (uint32 &zoneid, uint32 &areaid) const
 
bool IsOutdoors () const
 
LiquidData const & GetLiquidData () const
 
InstanceScriptGetInstanceScript () const
 
std::string const & GetName () const
 
void SetName (std::string const &newname)
 
virtual std::string const & GetNameForLocaleIdx (LocaleConstant) const
 
float GetDistance (WorldObject const *obj) const
 
float GetDistance (const Position &pos) const
 
float GetDistance (float x, float y, float z) const
 
float GetDistance2d (WorldObject const *obj) const
 
float GetDistance2d (float x, float y) const
 
float GetDistanceZ (WorldObject const *obj) const
 
bool IsSelfOrInSameMap (WorldObject const *obj) const
 
bool IsInMap (WorldObject const *obj) const
 
bool IsWithinDist3d (float x, float y, float z, float dist) const
 
bool IsWithinDist3d (const Position *pos, float dist) const
 
bool IsWithinDist2d (float x, float y, float dist) const
 
bool IsWithinDist2d (const Position *pos, float dist) const
 
bool IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
 
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
 
bool IsWithinLOS (float x, float y, float z, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS) const
 
bool IsWithinLOSInMap (WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
Position GetHitSpherePointFor (Position const &dest, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
void GetHitSpherePointFor (Position const &dest, float &x, float &y, float &z, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
bool GetDistanceOrder (WorldObject const *obj1, WorldObject const *obj2, bool is3D=true) const
 
bool IsInRange (WorldObject const *obj, float minRange, float maxRange, bool is3D=true) const
 
bool IsInRange2d (float x, float y, float minRange, float maxRange) const
 
bool IsInRange3d (float x, float y, float z, float minRange, float maxRange) const
 
bool isInFront (WorldObject const *target, float arc=M_PI) const
 
bool isInBack (WorldObject const *target, float arc=M_PI) const
 
bool IsInBetween (WorldObject const *obj1, WorldObject const *obj2, float size=0) const
 
virtual void CleanupsBeforeDelete (bool finalCleanup=true)
 
virtual void SendMessageToSet (WorldPacket const *data, bool self) const
 
virtual void SendMessageToSetInRange (WorldPacket const *data, float dist, bool self) const
 
virtual void SendMessageToSet (WorldPacket const *data, Player const *skipped_rcvr) const
 
virtual uint8 getLevelForTarget (WorldObject const *) const
 
void PlayDistanceSound (uint32 sound_id, Player *target=nullptr)
 
void PlayDirectSound (uint32 sound_id, Player *target=nullptr)
 
void PlayRadiusSound (uint32 sound_id, float radius)
 
void PlayDirectMusic (uint32 music_id, Player *target=nullptr)
 
void PlayRadiusMusic (uint32 music_id, float radius)
 
void SendObjectDeSpawnAnim (ObjectGuid guid)
 
virtual void SaveRespawnTime ()
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
virtual float GetSightRange (WorldObject const *target=nullptr) const
 
bool CanSeeOrDetect (WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
 
void SendPlayMusic (uint32 Music, bool OnlySelf)
 
virtual void SetMap (Map *map)
 
virtual void ResetMap ()
 
MapGetMap () const
 
MapFindMap () const
 
void SetZoneScript ()
 
void ClearZoneScript ()
 
ZoneScriptGetZoneScript () const
 
TempSummonSummonCreature (uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
 
TempSummonSummonCreature (uint32 id, float x, float y, float z, float ang=0, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false)
 
GameObjectSummonGameObject (uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport=true, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
 
CreatureSummonTrigger (float x, float y, float z, float ang, uint32 dur, bool setLevel=false, CreatureAI *(*GetAI)(Creature *)=nullptr)
 
void SummonCreatureGroup (uint8 group, std::list< TempSummon * > *list=nullptr)
 
CreatureFindNearestCreature (uint32 entry, float range, bool alive=true) const
 
GameObjectFindNearestGameObject (uint32 entry, float range, bool onlySpawned=false) const
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
PlayerSelectNearestPlayer (float distance=0) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetDeadCreatureListInGrid (std::list< Creature * > &lList, float maxSearchRange, bool alive=false) const
 
void DestroyForNearbyPlayers ()
 
virtual void UpdateObjectVisibility (bool forced=true, bool fromUpdate=false)
 
void BuildUpdate (UpdateDataMapType &data_map, UpdatePlayerSet &player_set) override
 
void GetCreaturesWithEntryInRange (std::list< Creature * > &creatureList, float radius, uint32 entry)
 
void SetPositionDataUpdate ()
 
void UpdatePositionData ()
 
void AddToObjectUpdate () override
 
void RemoveFromObjectUpdate () override
 
void AddToNotify (uint16 f)
 
void RemoveFromNotify (uint16 f)
 
bool isNeedNotify (uint16 f) const
 
uint16 GetNotifyFlags () const
 
bool NotifyExecuted (uint16 f) const
 
void SetNotified (uint16 f)
 
void ResetAllNotifies ()
 
bool isActiveObject () const
 
void setActive (bool isActiveObject)
 
bool IsFarVisible () const
 
bool IsVisibilityOverridden () const
 
void SetVisibilityDistanceOverride (VisibilityDistanceType type)
 
void SetWorldObject (bool apply)
 
bool IsPermanentWorldObject () const
 
bool IsWorldObject () const
 
bool IsInWintergrasp () const
 
TransportGetTransport () const
 
float GetTransOffsetX () const
 
float GetTransOffsetY () const
 
float GetTransOffsetZ () const
 
float GetTransOffsetO () const
 
uint32 GetTransTime () const
 
int8 GetTransSeat () const
 
virtual ObjectGuid GetTransGUID () const
 
void SetTransport (Transport *t)
 
virtual float GetStationaryX () const
 
virtual float GetStationaryY () const
 
virtual float GetStationaryZ () const
 
virtual float GetStationaryO () const
 
float GetMapWaterOrGroundLevel (float x, float y, float z, float *ground=nullptr) const
 
float GetMapHeight (float x, float y, float z, bool vmap=true, float distanceToSearch=50.0f) const
 
float GetFloorZ () const
 
float GetMinHeightInWater () const
 Get the minimum height of a object that should be in water to start floating/swim. More...
 
virtual float GetCollisionHeight () const
 
virtual float GetCollisionWidth () const
 
virtual float GetCollisionRadius () const
 
void AddAllowedLooter (ObjectGuid guid)
 
void ResetAllowedLooters ()
 
void SetAllowedLooters (GuidUnorderedSet const looters)
 
bool HasAllowedLooter (ObjectGuid guid) const
 
GuidUnorderedSet const & GetAllowedLooters () const
 
void RemoveAllowedLooter (ObjectGuid guid)
 
std::string GetDebugInfo () const override
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
virtual void AddToWorld ()
 
virtual void RemoveFromWorld ()
 
ObjectGuid GetGUID () const
 
PackedGuid const & GetPackGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
virtual void SetObjectScale (float scale)
 
virtual uint32 GetDynamicFlags () const
 
bool HasDynamicFlag (uint32 flag) const
 
virtual void SetDynamicFlag (uint32 flag)
 
virtual void RemoveDynamicFlag (uint32 flag)
 
virtual void ReplaceAllDynamicFlags (uint32 flag)
 
TypeID GetTypeId () const
 
bool isType (uint16 mask) const
 
virtual void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target)
 
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 ApplyPercentModFloatValue (uint16 index, float val, bool apply)
 
void SetFlag (uint16 index, uint32 newFlag)
 
void RemoveFlag (uint16 index, uint32 oldFlag)
 
void ToggleFlag (uint16 index, uint32 flag)
 
bool HasFlag (uint16 index, uint32 flag) const
 
void ApplyModFlag (uint16 index, uint32 flag, bool apply)
 
void SetByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void RemoveByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
bool HasByteFlag (uint16 index, uint8 offset, uint8 flag) const
 
void SetFlag64 (uint16 index, uint64 newFlag)
 
void RemoveFlag64 (uint16 index, uint64 oldFlag)
 
void ToggleFlag64 (uint16 index, uint64 flag)
 
bool HasFlag64 (uint16 index, uint64 flag) const
 
void ApplyModFlag64 (uint16 index, uint64 flag, bool apply)
 
void ClearUpdateMask (bool remove)
 
uint16 GetValuesCount () const
 
virtual bool hasQuest (uint32) const
 
virtual bool hasInvolvedQuest (uint32) const
 
virtual void BuildUpdate (UpdateDataMapType &, UpdatePlayerSet &)
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &)
 
void SetFieldNotifyFlag (uint16 flag)
 
void RemoveFieldNotifyFlag (uint16 flag)
 
void ForceValuesUpdateAtIndex (uint32)
 
bool IsPlayer () const
 
PlayerToPlayer ()
 
Player const * ToPlayer () const
 
bool IsCreature () const
 
CreatureToCreature ()
 
Creature const * ToCreature () const
 
bool IsUnit () const
 
UnitToUnit ()
 
Unit const * ToUnit () const
 
bool IsGameObject () const
 
GameObjectToGameObject ()
 
GameObject const * ToGameObject () const
 
bool IsCorpse () const
 
CorpseToCorpse ()
 
Corpse const * ToCorpse () const
 
bool IsDynamicObject () const
 
DynamicObjectToDynObject ()
 
DynamicObject const * ToDynObject () const
 
bool IsItem () const
 
virtual std::string GetDebugInfo () const
 
- Public Member Functions inherited from WorldLocation
 WorldLocation (uint32 _mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
 WorldLocation (uint32 mapId, Position const &position)
 
void WorldRelocate (const WorldLocation &loc)
 
void WorldRelocate (uint32 mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
void SetMapId (uint32 mapId)
 
uint32 GetMapId () const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y) const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z) const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z, float &o) const
 
void GetWorldLocation (WorldLocation *location) const
 
WorldLocation GetWorldLocation () const
 
std::string GetDebugInfo () const
 
- Public Member Functions inherited from Position
 Position (float x=0, float y=0, float z=0, float o=0)
 
 Position (Position const &loc)
 
 Position (Position &&)=default
 
Positionoperator= (const Position &)=default
 
Positionoperator= (Position &&)=default
 
bool operator== (Position const &a) const
 
bool operator!= (Position const &a)
 
 operator G3D::Vector3 () const
 
void Relocate (float x, float y)
 
void Relocate (float x, float y, float z)
 
void Relocate (float x, float y, float z, float orientation)
 
void Relocate (const Position &pos)
 
void Relocate (const Position *pos)
 
void RelocatePolarOffset (float angle, float dist, float z=0.0f)
 
void RelocateOffset (const Position &offset)
 
void SetOrientation (float orientation)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
float GetOrientation () const
 
void GetPosition (float &x, float &y) const
 
void GetPosition (float &x, float &y, float &z) const
 
void GetPosition (float &x, float &y, float &z, float &o) const
 
Position GetPosition () const
 
Position::PositionXYZStreamer PositionXYZStream ()
 
Position::PositionXYZOStreamer PositionXYZOStream ()
 
bool IsPositionValid () const
 
float GetExactDist2dSq (const float x, const float y) const
 
float GetExactDist2dSq (Position const &pos) const
 
float GetExactDist2dSq (Position const *pos) const
 
float GetExactDist2d (const float x, const float y) const
 
float GetExactDist2d (Position const &pos) const
 
float GetExactDist2d (Position const *pos) const
 
float GetExactDistSq (float x, float y, float z) const
 
float GetExactDistSq (Position const &pos) const
 
float GetExactDistSq (Position const *pos) const
 
float GetExactDist (float x, float y, float z) const
 
float GetExactDist (Position const &pos) const
 
float GetExactDist (Position const *pos) const
 
void GetPositionOffsetTo (const Position &endPos, Position &retOffset) const
 
Position GetPositionWithOffset (Position const &offset) const
 
float GetAngle (const Position *pos) const
 
float GetAngle (float x, float y) const
 
float GetAbsoluteAngle (float x, float y) const
 
float GetAbsoluteAngle (Position const &pos) const
 
float GetAbsoluteAngle (Position const *pos) const
 
float GetRelativeAngle (const Position *pos) const
 
float GetRelativeAngle (float x, float y) const
 
float ToAbsoluteAngle (float relAngle) const
 
void GetSinCos (float x, float y, float &vsin, float &vcos) const
 
bool IsInDist2d (float x, float y, float dist) const
 
bool IsInDist2d (const Position *pos, float dist) const
 
bool IsInDist (float x, float y, float z, float dist) const
 
bool IsInDist (const Position *pos, float dist) const
 
bool IsWithinBox (const Position &center, float xradius, float yradius, float zradius) const
 
bool HasInArc (float arcangle, const Position *pos, float targetRadius=0.0f) const
 
bool HasInLine (Position const *pos, float width) const
 
std::string ToString () const
 
- Public Member Functions inherited from GridObject< Creature >
bool IsInGrid () const
 
void AddToGrid (GridRefMgr< Creature > &m)
 
void RemoveFromGrid ()
 

Static Public Member Functions

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

Public Attributes

struct {
   ::Spell const *   Spell = nullptr
 
   uint32   Delay = 0
 
   ObjectGuid   Target
 
   float   Orientation = 0.0f
 
_spellFocusInfo
 
Loot loot
 
uint32 m_spells [MAX_CREATURE_SPELLS]
 
CreatureSpellCooldowns m_CreatureSpellCooldowns
 
uint32 m_ProhibitSchoolTime [7]
 
uint32 m_groupLootTimer
 
uint32 lootingGroupLowGUID
 
float m_SightDistance
 
float m_CombatDistance
 
bool m_isTempWorldObject
 
uint32 m_moveCircleMovementTime = MOVE_CIRCLE_CHECK_INTERVAL
 
uint32 m_moveBackwardsMovementTime = MOVE_BACKWARDS_CHECK_INTERVAL
 
- Public Attributes inherited from Unit
uint32 m_extraAttacks
 
bool m_canDualWield
 
ControlSet m_Controlled
 
SafeUnitPointer m_movedByPlayer
 
ObjectGuid m_SummonSlot [MAX_SUMMON_SLOT]
 
ObjectGuid m_ObjectSlot [MAX_GAMEOBJECT_SLOT]
 
float m_modMeleeHitChance
 
float m_modRangedHitChance
 
float m_modSpellHitChance
 
int32 m_baseSpellCritChance
 
float m_threatModifier [MAX_SPELL_SCHOOL]
 
float m_modAttackSpeedPct [3]
 
EventProcessor m_Events
 
SpellImmuneList m_spellImmune [MAX_SPELL_IMMUNITY]
 
uint32 m_lastSanctuaryTime
 
PetAuraSet m_petAuras
 
bool IsAIEnabled
 
bool NeedChangeAI
 
bool m_ControlledByPlayer
 
bool m_CreatedByPlayer
 
std::set< SafeUnitPointer * > SafeUnitPointerSet
 
Position m_last_notify_position
 
uint32 m_last_notify_mstime
 
uint16 m_delayed_unit_relocation_timer
 
uint16 m_delayed_unit_ai_notify_timer
 
bool bRequestForcedVisibilityUpdate
 
Movement::MoveSplinemovespline
 
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealth
 
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealthDetect
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibility
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibilityDetect
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibility
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibilityDetect
 
uint32 LastUsedScriptID
 
MovementInfo m_movementInfo
 
ElunaEventProcessor * elunaEvents
 
- Public Attributes inherited from Object
DataMap CustomData
 
- Public Attributes inherited from WorldLocation
uint32 m_mapId
 
- Public Attributes inherited from Position
float m_positionX = 0
 
float m_positionY = 0
 
float m_positionZ = 0
 
float m_orientation = 0
 

Static Public Attributes

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

Protected Member Functions

bool CreateFromProto (ObjectGuid::LowType guidlow, uint32 Entry, uint32 vehId, const CreatureData *data=nullptr)
 
bool InitEntry (uint32 entry, const CreatureData *data=nullptr)
 
void RegenerateHealth ()
 
void Regenerate (Powers power)
 
bool IsInvisibleDueToDespawn () const override
 
bool CanAlwaysSee (WorldObject const *obj) const override
 
bool IsAlwaysDetectableFor (WorldObject const *seer) const override
 
- Protected Member Functions inherited from Unit
 Unit (bool isWorldObject)
 
void BuildValuesUpdate (uint8 updateType, ByteBuffer *data, Player *target) override
 
void _UpdateSpells (uint32 time)
 
void _DeleteRemovedAuras ()
 
void _UpdateAutoRepeatSpell ()
 
bool IsAlwaysVisibleFor (WorldObject const *seer) const override
 
bool IsAlwaysDetectableFor (WorldObject const *seer) const override
 
void SetFeared (bool apply, Unit *fearedBy=nullptr, bool isFear=false)
 
void SetConfused (bool apply)
 
void SetStunned (bool apply)
 
void SetRooted (bool apply, bool isStun=false)
 
- Protected Member Functions inherited from WorldObject
 WorldObject (bool isWorldObject)
 
virtual void ProcessPositionDataChanged (PositionFullTerrainStatus const &data)
 
void SetLocationMapId (uint32 _mapId)
 
void SetLocationInstanceId (uint32 _instanceId)
 
virtual bool IsNeverVisible () const
 
virtual bool IsAlwaysVisibleFor (WorldObject const *) const
 
virtual bool IsInvisibleDueToDespawn () const
 
virtual bool IsAlwaysDetectableFor (WorldObject const *) const
 
- Protected Member Functions inherited from Object
 Object ()
 
void _InitValues ()
 
void _Create (ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
 
std::string _ConcatFields (uint16 startIndex, uint16 size) const
 
bool _LoadIntoDataField (std::string const &data, uint32 startOffset, uint32 count)
 
uint32 GetUpdateFieldData (Player const *target, uint32 *&flags) const
 
void BuildMovementUpdate (ByteBuffer *data, uint16 flags) const
 
virtual void BuildValuesUpdate (uint8 updateType, ByteBuffer *data, Player *target)
 
virtual void AddToObjectUpdate ()=0
 
virtual void RemoveFromObjectUpdate ()=0
 
void AddToObjectUpdateIfNeeded ()
 
- Protected Member Functions inherited from MovableMapObject
 MovableMapObject ()=default
 

Static Protected Member Functions

static float _GetHealthMod (int32 Rank)
 

Protected Attributes

VendorItemCounts m_vendorItemCounts
 
ObjectGuid m_lootRecipient
 
ObjectGuid::LowType m_lootRecipientGroup
 
time_t m_corpseRemoveTime
 Timers. More...
 
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. More...
 
uint8 m_equipmentId
 
int8 m_originalEquipmentId
 
bool m_AlreadyCallAssistance
 
bool m_AlreadySearchedAssistance
 
bool m_regenHealth
 
bool m_regenPower
 
bool m_AI_locked
 
SpellSchoolMask m_meleeDamageSchoolMask
 
uint32 m_originalEntry
 
bool m_moveInLineOfSightDisabled
 
bool m_moveInLineOfSightStrictlyDisabled
 
Position m_homePosition
 
Position m_transportHomePosition
 
bool DisableReputationGain
 
CreatureTemplate const * m_creatureInfo
 
CreatureData const * m_creatureData
 
float m_detectionDistance
 
uint16 m_LootMode
 
- Protected Attributes inherited from Unit
UnitAIi_AI
 
UnitAIi_disabledAI
 
uint8 m_realRace
 
uint8 m_race
 
bool m_AutoRepeatFirstCast
 
int32 m_attackTimer [MAX_ATTACK]
 
float m_createStats [MAX_STATS]
 
AttackerSet m_attackers
 
Unitm_attacking
 
DeathState m_deathState
 
int32 m_procDeep
 
DynObjectList m_dynObj
 
GameObjectList m_gameObj
 
uint32 m_transform
 
Spellm_currentSpells [CURRENT_MAX_SPELL]
 
AuraMap m_ownedAuras
 
AuraApplicationMap m_appliedAuras
 
AuraList m_removedAuras
 
AuraMap::iterator m_auraUpdateIterator
 
uint32 m_removedAurasCount
 
AuraEffectList m_modAuras [TOTAL_AURAS]
 
AuraList m_scAuras
 
AuraApplicationList m_interruptableAuras
 
AuraStateAurasMap m_auraStateAuras
 
uint32 m_interruptMask
 
float m_auraModifiersGroup [UNIT_MOD_END][MODIFIER_TYPE_END]
 
float m_weaponDamage [MAX_ATTACK][MAX_WEAPON_DAMAGE_RANGE][MAX_ITEM_PROTO_DAMAGES]
 
bool m_canModifyStats
 
VisibleAuraMap m_visibleAuras
 
float m_speed_rate [MAX_MOVE_TYPE]
 
CharmInfom_charmInfo
 
SharedVisionList m_sharedVision
 
MotionMasteri_motionMaster
 
uint32 m_reactiveTimer [MAX_REACTIVE]
 
int32 m_regenTimer
 
ThreatMgr m_ThreatMgr
 
CharmThreatMap _charmThreatInfo
 
Vehiclem_vehicle
 
Vehiclem_vehicleKit
 
uint32 m_unitTypeMask
 
LiquidTypeEntry const * _lastLiquid
 
bool m_applyResilience
 
bool _instantCast
 
uint32 m_rootTimes
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
bool m_isFarVisible
 
Optional< float > m_visibilityDistanceOverride
 
const bool m_isWorldObject
 
ZoneScriptm_zoneScript
 
uint32 _zoneId
 
uint32 _areaId
 
float _floorZ
 
bool _outdoors
 
LiquidData _liquidData
 
bool _updatePositionData
 
Transportm_transport
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
TypeID m_objectTypeId
 
uint16 m_updateFlag
 
union {
   int32 *   m_int32Values
 
   uint32 *   m_uint32Values
 
   float *   m_floatValues
 
}; 
 
UpdateMask _changesMask
 
uint16 m_valuesCount
 
uint16 _fieldNotifyFlags
 
bool m_objectUpdated
 

Private Member Functions

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

Private Attributes

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

‍Locks the target during spell cast for proper facing

More...
 
uint32 m_assistanceTimer
 
uint32 _playerDamageReq
 
bool _damagedByPlayer
 
bool _isCombatMovementAllowed
 

Additional Inherited Members

- Public Types inherited from Unit
typedef std::unordered_set< Unit * > AttackerSet
 
typedef std::set< Unit * > ControlSet
 
typedef std::multimap< uint32, Aura * > AuraMap
 
typedef std::pair< AuraMap::const_iterator, AuraMap::const_iterator > AuraMapBounds
 
typedef std::pair< AuraMap::iterator, AuraMap::iterator > AuraMapBoundsNonConst
 
typedef std::multimap< uint32, AuraApplication * > AuraApplicationMap
 
typedef std::pair< AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator > AuraApplicationMapBounds
 
typedef std::pair< AuraApplicationMap::iterator, AuraApplicationMap::iterator > AuraApplicationMapBoundsNonConst
 
typedef std::multimap< AuraStateType, AuraApplication * > AuraStateAurasMap
 
typedef std::pair< AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator > AuraStateAurasMapBounds
 
typedef std::list< AuraEffect * > AuraEffectList
 
typedef std::list< Aura * > AuraList
 
typedef std::list< AuraApplication * > AuraApplicationList
 
typedef std::list< DiminishingReturnDiminishing
 
typedef GuidUnorderedSet ComboPointHolderSet
 
typedef std::map< uint8, AuraApplication * > VisibleAuraMap
 
typedef std::set< PetAura const * > PetAuraSet
 
- Protected Types inherited from Unit
typedef std::list< DynamicObject * > DynObjectList
 
typedef GuidList GameObjectList
 
typedef std::map< ObjectGuid, float > CharmThreatMap
 

Detailed Description

Constructor & Destructor Documentation

◆ Creature()

Creature::Creature ( bool  isWorldObject = false)
explicit
279{
282
283 for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
284 m_spells[i] = 0;
285
286 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
288
290 DisableReputationGain = false;
291
293 m_CombatDistance = 0.0f;
294
295 ResetLootMode(); // restore default loot mode
296 TriggerJustRespawned = false;
297 m_isTempWorldObject = false;
298 _focusSpell = nullptr;
299
300 m_respawnedTime = time_t(0);
301}
std::uint8_t uint8
Definition: Define.h:109
@ IDLE_MOTION_TYPE
Definition: MotionMaster.h:37
@ CONFIG_SIGHT_MONSTER
Definition: IWorld.h:198
@ REACT_AGGRESSIVE
Definition: Unit.h:550
static constexpr uint32 MAX_CREATURE_SPELLS
Definition: Unit.h:45
@ UNIT_END
Definition: UpdateFields.h:175
#define CREATURE_REGEN_INTERVAL
Definition: CreatureData.h:32
@ SPELL_SCHOOL_NORMAL
Definition: SharedDefines.h:283
constexpr auto MAX_SPELL_SCHOOL
Definition: SharedDefines.h:292
@ SPELL_SCHOOL_MASK_NORMAL
Definition: SharedDefines.h:297
#define sWorld
Definition: World.h:444
bool m_regenPower
Definition: Creature.h:467
float m_wanderDistance
Definition: Creature.h:449
void ResetLootMode()
Definition: Creature.h:246
std::shared_ptr< time_t > m_lastLeashExtensionTime
Definition: Creature.h:506
SpellSchoolMask m_meleeDamageSchoolMask
Definition: Creature.h:470
uint16 m_transportCheckTimer
Definition: Creature.h:451
bool m_AI_locked
Definition: Creature.h:468
uint32 m_assistanceTimer
Definition: Creature.h:515
int8 m_originalEquipmentId
Definition: Creature.h:462
ObjectGuid::LowType m_spawnId
For new or temporary creatures is 0 for saved it is lowguid.
Definition: Creature.h:460
Position m_transportHomePosition
Definition: Creature.h:477
ObjectGuid::LowType m_lootRecipientGroup
Definition: Creature.h:441
uint32 m_spells[MAX_CREATURE_SPELLS]
Definition: Creature.h:251
CreatureTemplate const * m_creatureInfo
Definition: Creature.h:481
bool _isMissingSwimmingFlagOutOfCombat
‍Locks the target during spell cast for proper facing
Definition: Creature.h:513
uint32 m_waypointID
Definition: Creature.h:497
MovementGeneratorType m_defaultMovementType
Definition: Creature.h:459
float m_detectionDistance
Definition: Creature.h:484
CreatureSpellCooldowns m_CreatureSpellCooldowns
Definition: Creature.h:252
float m_SightDistance
Definition: Creature.h:372
uint32 m_cannotReachTimer
Definition: Creature.h:509
uint32 m_respawnDelay
Definition: Creature.h:447
time_t m_corpseRemoveTime
Timers.
Definition: Creature.h:444
uint32 m_combatPulseDelay
Definition: Creature.h:454
time_t m_respawnTime
Definition: Creature.h:445
CreatureData const * m_creatureData
Definition: Creature.h:482
float m_CombatDistance
Definition: Creature.h:372
time_t m_respawnedTime
Definition: Creature.h:446
uint32 m_boundaryCheckTime
Definition: Creature.h:450
Position m_homePosition
Definition: Creature.h:476
bool TriggerJustRespawned
Definition: Creature.h:502
bool m_AlreadyCallAssistance
Definition: Creature.h:464
bool DisableReputationGain
Definition: Creature.h:479
CreatureGroup * m_formation
Definition: Creature.h:501
uint32 m_corpseDelay
Definition: Creature.h:448
uint8 m_equipmentId
Definition: Creature.h:461
bool m_AlreadySearchedAssistance
Definition: Creature.h:465
uint32 m_originalEntry
Definition: Creature.h:471
bool m_isTempWorldObject
Definition: Creature.h:374
ReactStates m_reactState
Definition: Creature.h:456
Spell const * _focusSpell
Definition: Creature.h:511
uint32 lootPickPocketRestoreTime
Definition: Creature.h:452
bool m_moveInLineOfSightStrictlyDisabled
Definition: Creature.h:474
uint32 lootingGroupLowGUID
Definition: Creature.h:309
bool _isCombatMovementAllowed
Definition: Creature.h:519
bool m_regenHealth
Definition: Creature.h:466
uint32 _playerDamageReq
Definition: Creature.h:517
bool _damagedByPlayer
Definition: Creature.h:518
uint32 m_path_id
Definition: Creature.h:498
bool m_moveInLineOfSightDisabled
Definition: Creature.h:473
uint32 m_groupLootTimer
Definition: Creature.h:308
uint32 m_combatPulseTime
Definition: Creature.h:453
uint32 m_ProhibitSchoolTime[7]
Definition: Creature.h:253
uint16 m_valuesCount
Definition: Object.h:254
MovableMapObject()=default
Definition: Unit.h:630
int32 m_regenTimer
Definition: Unit.h:1892

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

◆ ~Creature()

Creature::~Creature ( )
override
304{
305 m_vendorItemCounts.clear();
306
307 delete i_AI;
308 i_AI = nullptr;
309}
VendorItemCounts m_vendorItemCounts
Definition: Creature.h:436
UnitAI * i_AI
Definition: Unit.h:1839

References Unit::i_AI, and m_vendorItemCounts.

Member Function Documentation

◆ _AddCreatureSpellCooldown()

void Creature::_AddCreatureSpellCooldown ( uint32  spell_id,
uint16  categoryId,
uint32  end_time 
)
2848{
2849 CreatureSpellCooldown spellCooldown;
2850 spellCooldown.category = categoryId;
2851 spellCooldown.end = GameTime::GetGameTimeMS().count() + end_time;
2852 m_CreatureSpellCooldowns[spell_id] = std::move(spellCooldown);
2853}
Milliseconds GetGameTimeMS()
Definition: GameTime.cpp:43
Definition: CreatureData.h:543
uint16 category
Definition: CreatureData.h:547
uint32 end
Definition: CreatureData.h:548

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

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

◆ _GetDamageMod()

float Creature::_GetDamageMod ( int32  Rank)
static
1588{
1589 switch (Rank) // define rates for each elite rank
1590 {
1592 return sWorld->getRate(RATE_CREATURE_NORMAL_DAMAGE);
1600 return sWorld->getRate(RATE_CREATURE_ELITE_RARE_DAMAGE);
1601 default:
1603 }
1604}
@ RATE_CREATURE_NORMAL_DAMAGE
Definition: IWorld.h:492
@ RATE_CREATURE_ELITE_RARE_DAMAGE
Definition: IWorld.h:496
@ RATE_CREATURE_ELITE_WORLDBOSS_DAMAGE
Definition: IWorld.h:495
@ RATE_CREATURE_ELITE_RAREELITE_DAMAGE
Definition: IWorld.h:494
@ RATE_CREATURE_ELITE_ELITE_DAMAGE
Definition: IWorld.h:493
@ CREATURE_ELITE_NORMAL
Definition: SharedDefines.h:2731
@ CREATURE_ELITE_WORLDBOSS
Definition: SharedDefines.h:2734
@ CREATURE_ELITE_RARE
Definition: SharedDefines.h:2735
@ CREATURE_ELITE_RAREELITE
Definition: SharedDefines.h:2733
@ CREATURE_ELITE_ELITE
Definition: SharedDefines.h:2732

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
1569{
1570 switch (Rank) // define rates for each elite rank
1571 {
1573 return sWorld->getRate(RATE_CREATURE_NORMAL_HP);
1575 return sWorld->getRate(RATE_CREATURE_ELITE_ELITE_HP);
1581 return sWorld->getRate(RATE_CREATURE_ELITE_RARE_HP);
1582 default:
1583 return sWorld->getRate(RATE_CREATURE_ELITE_ELITE_HP);
1584 }
1585}
@ RATE_CREATURE_NORMAL_HP
Definition: IWorld.h:487
@ RATE_CREATURE_ELITE_WORLDBOSS_HP
Definition: IWorld.h:490
@ RATE_CREATURE_ELITE_ELITE_HP
Definition: IWorld.h:488
@ RATE_CREATURE_ELITE_RARE_HP
Definition: IWorld.h:491
@ RATE_CREATURE_ELITE_RAREELITE_HP
Definition: IWorld.h:489

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
2553{
2554 ASSERT(target);
2555
2556 // if the target cannot be attacked, the target is not acceptable
2557 if (IsFriendlyTo(target) || !target->isTargetableForAttack(false, this) || (m_vehicle && (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target))))
2558 return false;
2559
2560 if (target->HasUnitState(UNIT_STATE_DIED))
2561 {
2562 // some creatures can detect fake death
2563 if (CanIgnoreFeignDeath() && target->HasUnitFlag2(UNIT_FLAG2_FEIGN_DEATH))
2564 return true;
2565 else
2566 return false;
2567 }
2568
2569 Unit const* targetVictim = target->getAttackerForHelper();
2570
2571 // if I'm already fighting target, or I'm hostile towards the target, the target is acceptable
2572 if (IsEngagedBy(target) || IsHostileTo(target))
2573 return true;
2574
2575 // if the target's victim is friendly, and the target is neutral, the target is acceptable
2576 if (targetVictim && !IsNeutralToAll() && IsFriendlyTo(targetVictim))
2577 return true;
2578
2579 // if the target's victim is not friendly, or the target is friendly, the target is not acceptable
2580 return false;
2581}
#define ASSERT
Definition: Errors.h:68
@ UNIT_FLAG2_FEIGN_DEATH
Definition: UnitDefines.h:268
@ UNIT_STATE_DIED
Definition: UnitDefines.h:149
bool CanIgnoreFeignDeath() const
Definition: Creature.h:273
Vehicle * m_vehicle
Definition: Unit.h:1898
Unit * getAttackerForHelper() const
Definition: Unit.cpp:741
bool IsNeutralToAll() const
Definition: Unit.cpp:10221
bool IsOnVehicle(Unit const *vehicle) const
Definition: Unit.h:1674
bool IsEngagedBy(Unit const *who) const
Definition: Unit.h:818
bool IsFriendlyTo(Unit const *unit) const
Definition: Unit.cpp:10203
bool IsHostileTo(Unit const *unit) const
Definition: Unit.cpp:10198
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(), 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.

2856{
2857 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id);
2858 if (!spellInfo)
2859 return;
2860
2861 // used in proc system, otherwise normal creature cooldown
2862 if (end_time)
2863 {
2864 _AddCreatureSpellCooldown(spellInfo->Id, 0, end_time);
2865 return;
2866 }
2867
2868 uint32 spellcooldown = spellInfo->RecoveryTime;
2869 uint32 categoryId = spellInfo->GetCategory();
2870 uint32 categorycooldown = categoryId ? spellInfo->CategoryRecoveryTime : 0;
2871 if (Player* modOwner = GetSpellModOwner())
2872 {
2873 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, spellcooldown);
2874 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, categorycooldown);
2875 }
2876
2877 SpellCategoryStore::const_iterator i_scstore = sSpellsByCategoryStore.find(categoryId);
2878 if (categorycooldown && i_scstore != sSpellsByCategoryStore.end())
2879 {
2880 for (SpellCategorySet::const_iterator i_scset = i_scstore->second.begin(); i_scset != i_scstore->second.end(); ++i_scset)
2881 {
2882 _AddCreatureSpellCooldown(i_scset->second, categoryId, categorycooldown);
2883 }
2884 }
2885 else if (spellcooldown)
2886 {
2887 _AddCreatureSpellCooldown(spellInfo->Id, 0, spellcooldown);
2888 }
2889
2890 if (sSpellMgr->HasSpellCooldownOverride(spellInfo->Id))
2891 {
2892 if (IsCharmed() && GetCharmer()->IsPlayer())
2893 {
2894 WorldPacket data;
2895 BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spellInfo->Id, spellcooldown);
2897 }
2898 }
2899}
std::uint32_t uint32
Definition: Define.h:107
SpellCategoryStore sSpellsByCategoryStore
Definition: DBCStores.cpp:152
@ SPELL_COOLDOWN_FLAG_NONE
Definition: Unit.h:616
@ SPELLMOD_COOLDOWN
Definition: SpellDefines.h:88
#define sSpellMgr
Definition: SpellMgr.h:825
void _AddCreatureSpellCooldown(uint32 spell_id, uint16 categoryId, uint32 end_time)
Definition: Creature.cpp:2847
bool IsPlayer() const
Definition: Object.h:197
Player * ToPlayer()
Definition: Object.h:198
Definition: Player.h:1064
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:5692
bool IsCharmed() const
Definition: Unit.h:1266
Player * GetSpellModOwner() const
Definition: Unit.cpp:16533
Unit * GetCharmer() const
Definition: Unit.cpp:10570
void BuildCooldownPacket(WorldPacket &data, uint8 flags, uint32 spellId, uint32 cooldown)
Definition: Unit.cpp:20941
Definition: WorldPacket.h:27
Definition: SpellInfo.h:316
uint32 GetCategory() const
Definition: SpellInfo.cpp:870
uint32 RecoveryTime
Definition: SpellInfo.h:348
uint32 Id
Definition: SpellInfo.h:320
uint32 CategoryRecoveryTime
Definition: SpellInfo.h:349

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

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

◆ AddToWorld()

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

Reimplemented from Object.

Reimplemented in Pet.

312{
314 if (!IsInWorld())
315 {
316 // pussywizard: motion master needs to be initialized before OnCreatureCreate, which may set death state to JUST_DIED, to prevent crash
317 // it's also initialized in AIM_Initialize(), few lines below, but it's not a problem
319
321 if (m_spawnId)
322 {
323 GetMap()->GetCreatureBySpawnIdStore().insert(std::make_pair(m_spawnId, this));
324 }
326
328
330
331 if (IsVehicle())
332 {
334 }
335
336 if (GetZoneScript())
337 {
339 }
340
342
343 sScriptMgr->OnCreatureAddWorld(this);
344 }
345}
#define sScriptMgr
Definition: ScriptMgr.h:708
bool Insert(KEY_TYPE const &handle, SPECIFIC_TYPE *obj)
Definition: TypeContainer.h:133
Definition: Creature.h:46
Loot loot
Definition: Creature.h:227
bool AIM_Initialize(CreatureAI *ai=nullptr)
Definition: Creature.cpp:1083
void Motion_Initialize()
Definition: Creature.cpp:1108
void SearchFormation()
Definition: Creature.cpp:381
bool IsInWorld() const
Definition: Object.h:104
ObjectGuid GetGUID() const
Definition: Object.h:110
Map * GetMap() const
Definition: Object.h:531
ZoneScript * GetZoneScript() const
Definition: Object.h:537
bool IsVehicle() const
Definition: Unit.h:713
void AddToWorld() override
Definition: Unit.cpp:15643
Vehicle * GetVehicleKit() const
Definition: Unit.h:1672
void Install()
Definition: Vehicle.cpp:68
ObjectGuid sourceWorldObjectGUID
Definition: LootMgr.h:330
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:517
CreatureBySpawnIdContainer & GetCreatureBySpawnIdStore()
Definition: Map.h:520
virtual void OnCreatureCreate(Creature *)
Definition: ZoneScript.h:35

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

Referenced by AddObjectHelper().

◆ AI()

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

References Unit::i_AI.

Referenced by Unit::_UnapplyAura(), Vehicle::AddPassenger(), Player::AddQuestAndCheckCompletion(), npc_mograine::npc_mograineAI::AshbringerEvent(), npc_anubisath_sentinel::aqsentinelAI::CallBuddiesToAttack(), boss_algalon_the_observer::boss_algalon_the_observerAI::CallConstellations(), instance_ruins_of_ahnqiraj::instance_ruins_of_ahnqiraj_InstanceMapScript::CallNextRajaxxLeader(), CanAlwaysSee(), CanCreatureAttack(), instance_obsidian_sanctum::instance_obsidian_sanctum_InstanceMapScript::CheckAchievementCriteriaMeet(), npc_still_at_it_trigger::npc_still_at_it_triggerAI::CheckAction(), spell_putricide_mutation_init::CheckRequirementInternal(), spell_the_lich_king_ice_burst_target_search::CheckTargetCount(), npc_riggle_bassbait::npc_riggle_bassbaitAI::CheckTournamentState(), Unit::CombatStart(), CreatureUnitRelocationWorker(), Unit::DealDamage(), DespawnOnEvade(), instance_karazhan::instance_karazhan_InstanceMapScript::DoAction(), SummonList::DoAction(), Spell::DoAllEffectOnTarget(), HomeMovementGenerator< Creature >::DoFinalize(), instance_stratholme::instance_stratholme_InstanceMapScript::DoSpawnPlaguedCritters(), SummonList::DoZoneInCombat(), boss_zuljin::boss_zuljinAI::EnterPhase(), AssistDelayEvent::Execute(), RestoreAttack::Execute(), DelayedTalk::Execute(), UtherBatteredHiltEvent::Execute(), StartMovementEvent::Execute(), ValithriaDespawner::Execute(), CaptainSurviveTalk::Execute(), ChargeRifts::Execute(), spell_kiljaeden_sinister_reflection_clone::FilterTargets(), spell_sapphiron_frost_explosion::FilterTargets(), RotateMovementGenerator::Finalize(), EffectMovementGenerator::Finalize(), npc_anubisath_sentinel::aqsentinelAI::GetOtherSentinels(), SmartScript::GetTargets(), go_ossirian_crystal::go_ossirian_crystalAI::GossipHello(), spell_herald_volzaj_insanity::HandleAfterCast(), spell_illidari_council_empyreal_balance::HandleAfterCast(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), spell_item_lil_xt::HandleDummy(), spell_shadowblink::HandleDummy(), spell_halion_twilight_division::HandleDummy(), spell_q12096_q12092_dummy::HandleDummy(), spell_q12096_q12092_bark::HandleDummy(), spell_q12589_shoot_rjr::HandleDummy(), spell_algalon_trigger_3_adds::HandleDummyEffect(), spell_herald_volzaj_insanity::HandleDummyEffect(), spell_hodir_flash_freeze_aura::HandleEffectPeriodic(), spell_mc_play_dead_aura::HandleEffectRemove(), WorldSession::HandleGossipHelloOpcode(), WorldSession::HandleGossipSelectOptionOpcode(), npc_commandscript::HandleNpcSetDataCommand(), WorldSession::HandlePetActionHelper(), WorldSession::HandleQuestgiverChooseRewardOpcode(), WorldSession::HandleQuestgiverHelloOpcode(), spell_kiljaeden_darkness_aura::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_q13011_bear_flank_master::HandleScript(), spell_volazj_whisper::HandleScriptEffect(), Unit::HandleSpellClick(), spell_putricide_mutated_transformation::HandleSummon(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::InformCloud(), TempSummon::InitSummon(), IsAlwaysDetectableFor(), SmartScript::IsSmart(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::JustEngagedWith(), npc_toc_warlock::npc_toc_warlockAI::JustSummoned(), npc_toc_hunter::npc_toc_hunterAI::JustSummoned(), npc_toc_boomkin::npc_toc_boomkinAI::JustSummoned(), boss_anubrekhan::boss_anubrekhanAI::JustSummoned(), boss_maexxna::boss_maexxnaAI::JustSummoned(), npc_frosthound::npc_frosthoundAI::JustSummoned(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), npc_daphne_stilwell::npc_daphne_stilwellAI::JustSummoned(), npc_battle_at_valhalas::npc_battle_at_valhalasAI::JustSummoned(), boss_urom::boss_uromAI::JustSummoned(), npc_hor_lich_king::npc_hor_lich_kingAI::JustSummoned(), WorldBossAI::JustSummoned(), npc_grimstone::npc_grimstoneAI::JustSummoned(), boss_gyth::boss_gythAI::JustSummoned(), boss_rend_blackhand::boss_rend_blackhandAI::JustSummoned(), boss_curator::JustSummoned(), boss_attumen::JustSummoned(), boss_midnight::JustSummoned(), boss_nightbane::JustSummoned(), boss_sacrolash::boss_sacrolashAI::JustSummoned(), npc_demonic_vapor_trail::npc_demonic_vapor_trailAI::JustSummoned(), boss_muru::boss_muruAI::JustSummoned(), boss_anetheron::JustSummoned(), boss_onyxia::JustSummoned(), boss_taldaram::JustSummoned(), boss_black_knight::boss_black_knightAI::JustSummoned(), boss_devourer_of_souls::boss_devourer_of_soulsAI::JustSummoned(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustSummoned(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustSummoned(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::JustSummoned(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustSummoned(), npc_precious_icc::npc_precious_iccAI::JustSummoned(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::JustSummoned(), npc_gluttonous_abomination::npc_gluttonous_abominationAI::JustSummoned(), boss_gluth::boss_gluthAI::JustSummoned(), boss_gothik::boss_gothikAI::JustSummoned(), boss_volkhan::boss_volkhanAI::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_koltira_deathweaver::npc_koltira_deathweaverAI::JustSummoned(), npc_professor_phizzlethorpe::npc_professor_phizzlethorpeAI::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::JustSummoned(), boss_archimonde::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::MemberEngagingTarget(), CreatureGroup::MemberEvaded(), npc_brew_bubble::MoveInLineOfSight(), npc_dkc1_gothik::npc_dkc1_gothikAI::MoveInLineOfSight(), npc_love_in_air_supply_sentry::MoveInLineOfSight(), npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight(), WaypointMovementGenerator< Creature >::MovementInform(), npc_claw_tentacle::npc_claw_tentacle(), npc_eye_tentacle::npc_eye_tentacle(), npc_giant_claw_tentacle::npc_giant_claw_tentacle(), npc_giant_eye_tentacle::npc_giant_eye_tentacle(), spell_pilgrims_bounty_serve_generic::OnAuraRemove(), achievement_flu_shot_shortage::OnCheck(), achievement_smell_saronite::OnCheck(), achievement_shadowdodger::OnCheck(), achievement_cheese_the_freeze::OnCheck(), achievement_getting_cold_in_here::OnCheck(), achievement_i_could_say_that_this_cache_was_rare::OnCheck(), achievement_i_have_the_coolest_friends::OnCheck(), achievement_ignis_shattered::OnCheck(), achievement_mimiron_firefighter::OnCheck(), achievement_mimiron_set_up_us_the_bomb_11::OnCheck(), achievement_mimiron_set_up_us_the_bomb_12::OnCheck(), achievement_mimiron_set_up_us_the_bomb_13::OnCheck(), achievement_quick_shave::OnCheck(), instance_blackrock_spire::instance_blackrock_spireMapScript::OnCreatureCreate(), instance_hyjal::instance_mount_hyjal_InstanceMapScript::OnCreatureCreate(), go_palehoof_sphere::OnGossipHello(), go_main_chambers_access_panel::OnGossipHello(), npc_pet_gen_argent_pony_bridle::OnGossipHello(), npc_death_knight_initiate::OnGossipHello(), npc_highlord_darion_mograine::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(), boss_doomrel::OnGossipSelect(), boss_majordomo::OnGossipSelect(), npc_barnes::OnGossipSelect(), npc_death_knight_initiate::OnGossipSelect(), npc_highlord_darion_mograine::OnGossipSelect(), npc_varian_wrynn::OnGossipSelect(), npc_thrall_bfu::OnGossipSelect(), npc_arthas::OnGossipSelect(), npc_high_overlord_saurfang_icc::OnGossipSelect(), npc_muradin_bronzebeard_icc::OnGossipSelect(), brann_bronzebeard::OnGossipSelect(), npc_ulduar_keeper::OnGossipSelect(), npc_shandy_dalaran::OnGossipSelect(), npc_vekjik::OnGossipSelect(), npc_adventurous_dwarf::OnGossipSelect(), npc_fos_leader::OnGossipSelect(), npc_hor_leader::OnGossipSelect(), npc_ulduar_expedition_commander::OnGossipSelect(), npc_mcmanus::OnGossipSelect(), npc_finklestein::OnGossipSelect(), npc_captain_saeed::OnGossipSelect(), boss_azuregos::OnGossipSelect(), npc_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(), instance_ulduar::instance_ulduar_InstanceMapScript::OnPlayerEnter(), npc_chicken_cluck::OnQuestAccept(), npc_kernobee::OnQuestAccept(), npc_koltira_deathweaver::OnQuestAccept(), pyrewood_ambush::OnQuestAccept(), npc_daphne_stilwell::OnQuestAccept(), npc_mikhail::OnQuestAccept(), npc_kerlonian::OnQuestAccept(), npc_prospector_remtravel::OnQuestAccept(), npc_tooga::OnQuestAccept(), npc_gilthares::OnQuestAccept(), npc_lakota_windsong::OnQuestAccept(), npc_paoka_swiftmountain::OnQuestAccept(), npc_ringo::OnQuestAccept(), npc_engineer_helice::OnQuestAccept(), npc_maghar_captive::OnQuestAccept(), npc_kurenai_captive::OnQuestAccept(), npc_maxx_a_million_escort::OnQuestAccept(), npc_eris_hevenfire::OnQuestAccept(), npc_deathstalker_erland::OnQuestAccept(), npc_cork_gizelton::OnQuestAccept(), npc_shenthul::OnQuestAccept(), npc_kaya_flathoof::OnQuestAccept(), npc_wizzlecrank_shredder::OnQuestAccept(), npc_ame::OnQuestAccept(), npc_ranshalla::OnQuestAccept(), npc_lurgglbr::OnQuestAccept(), npc_mootoo_the_younger::OnQuestAccept(), npc_bonker_togglevolt::OnQuestAccept(), npc_emily::OnQuestAccept(), npc_apothecary_hanes::OnQuestAccept(), npc_battle_at_valhalas::OnQuestAccept(), npc_finklestein::OnQuestAccept(), npc_bessy::OnQuestAccept(), npc_isla_starmane::OnQuestAccept(), npc_doctor::OnQuestAccept(), go_crystal_prison::OnQuestAccept(), go_crystalline_tear::OnQuestAccept(), npc_chicken_cluck::OnQuestComplete(), boss_apothecary_hummel::OnQuestReward(), npc_rocknot::OnQuestReward(), npc_thrall_warchief::OnQuestReward(), npc_lady_sylvanas_windrunner::OnQuestReward(), npc_tharnarian::OnQuestReward(), npc_elder_clearwater::OnQuestReward(), npc_riggle_bassbait::OnQuestReward(), at_blackrock_stadium::OnTrigger(), at_commander_dawnforge::OnTrigger(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnUnitDeath(), OrderWhelpTargetSelector::operator()(), FrostwingGauntletRespawner::operator()(), ValithriaDespawner::operator()(), Acore::CallOfHelpCreatureInRangeDo::operator()(), SplineHandler::operator()(), Unit::PetSpellFail(), PretendToDie(), npc_jungle_punch_target::npc_jungle_punch_targetAI::proceedCwEvent(), SmartScript::ProcessAction(), instance_stratholme::instance_stratholme_InstanceMapScript::ProcessSlaughterEvent(), RemoveCorpse(), Vehicle::RemovePassenger(), Respawn(), Resurrect(), boss_yoggsaron_lich_king::boss_yoggsaron_lich_kingAI::Say(), boss_yoggsaron_llane::boss_yoggsaron_llaneAI::Say(), boss_yoggsaron_neltharion::boss_yoggsaron_neltharionAI::Say(), boss_fathomguard_tidalvess::ScheduleRemoval(), spell_the_lich_king_valkyr_target_search::SelectTarget(), SelectVictim(), instance_naxxramas::instance_naxxramas_InstanceMapScript::SetBossState(), Unit::SetCharmedBy(), SetInCombatWithZone(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::SpawnAdds(), npc_pilgrims_bounty_chair::SpellHitTarget(), npc_still_at_it_trigger::npc_still_at_it_triggerAI::Start(), spell_putricide_ooze_channel::StartAttack(), WaypointMovementGenerator< Creature >::StartMove(), brann_bronzebeard::brann_bronzebeardAI::SummonCreatures(), boss_zuramat::boss_zuramatAI::SummonedCreatureDespawn(), boss_sindragosa::boss_sindragosaAI::SummonedCreatureDespawn(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::SummonedCreatureDespawn(), boss_anubrekhan::boss_anubrekhanAI::SummonedCreatureDies(), npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::SummonNextWave(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), npc_love_in_air_snivel_real::Talk(), Unit::TauntApply(), Unit::TauntFadeOut(), spell_igb_check_for_players::TriggerWipe(), Pet::Update(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), instance_naxxramas::instance_naxxramas_InstanceMapScript::Update(), Update(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), pyrewood_ambush::pyrewood_ambushAI::UpdateAI(), boss_akilzon::boss_akilzonAI::UpdateAI(), npc_winterfin_playmate::UpdateAI(), npc_snowfall_glade_playmate::UpdateAI(), npc_the_biggest_tree::UpdateAI(), npc_high_oracle_soo_roo::UpdateAI(), npc_elder_kekek::UpdateAI(), npc_the_etymidian::UpdateAI(), npc_alexstraza_the_lifebinder::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), npc_freya_ward::npc_freya_wardAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), npc_hourglass_of_eternity::npc_hourglass_of_eternityAI::UpdateAI(), npc_still_at_it_trigger::npc_still_at_it_triggerAI::UpdateAI(), npc_commander_dawnforge::npc_commander_dawnforgeAI::UpdateAI(), npc_tooga::npc_toogaAI::UpdateFollowerAI(), npc_ringo::npc_ringoAI::UpdateFollowerAI(), InstanceScript::UpdateMinionState(), npc_ranger_lilatha::WaypointReached(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), npc_cork_gizelton::npc_cork_gizeltonAI::WaypointReached(), npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached(), and npc_bessy::npc_bessyAI::WaypointReached().

◆ AIM_Initialize()

bool Creature::AIM_Initialize ( CreatureAI ai = nullptr)
1084{
1085 // make sure nothing can change the AI during AI update
1086 if (m_AI_locked)
1087 {
1088 LOG_DEBUG("scripts.ai", "AIM_Initialize: failed to init, locked.");
1089 return false;
1090 }
1091
1092 UnitAI* oldAI = i_AI;
1093
1094 // Xinef: called in add to world
1095 //Motion_Initialize();
1096
1097 i_AI = ai ? ai : FactorySelector::SelectAI(this);
1098 delete oldAI;
1099 IsAIEnabled = true;
1100 i_AI->InitializeAI();
1101
1102 // Xinef: Initialize vehicle if it is not summoned!
1103 if (GetVehicleKit() && m_spawnId)
1104 GetVehicleKit()->Reset();
1105 return true;
1106}
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:168
CreatureAI * SelectAI(Creature *creature)
Definition: CreatureAISelector.cpp:78
Definition: UnitAI.h:193
virtual void InitializeAI()
Definition: UnitAI.h:204
bool IsAIEnabled
Definition: Unit.h:1801
void Reset(bool evading=false)
Definition: Vehicle.cpp:116

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

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

◆ AllLootRemovedFromCorpse()

void Creature::AllLootRemovedFromCorpse ( )
2984{
2985 if (loot.loot_type != LOOT_SKINNING && !IsPet() && GetCreatureTemplate()->SkinLootId && hasLootRecipient())
2986 {
2988 {
2990 }
2991 }
2992
2993 time_t now = GameTime::GetGameTime().count();
2994 if (m_corpseRemoveTime <= now)
2995 {
2996 return;
2997 }
2998
2999 float decayRate = sWorld->getRate(RATE_CORPSE_DECAY_LOOTED);
3000 uint32 diff = uint32((m_corpseRemoveTime - now) * decayRate);
3001
3002 m_respawnTime -= diff;
3003
3004 // corpse skinnable, but without skinning flag, and then skinned, corpse will despawn next update
3006 {
3008 }
3009 else
3010 {
3011 m_corpseRemoveTime -= diff;
3012 }
3013}
LootStore LootTemplates_Skinning("skinning_loot_template", "creature skinning id", true)
@ LOOT_SKINNING
Definition: LootMgr.h:86
@ RATE_CORPSE_DECAY_LOOTED
Definition: IWorld.h:514
@ UNIT_FLAG_SKINNABLE
Definition: UnitDefines.h:255
Seconds GetGameTime()
Definition: GameTime.cpp:38
bool hasLootRecipient() const
Definition: Creature.h:232
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:206
bool IsPet() const
Definition: Unit.h:710
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition: Unit.h:683
bool HaveLootFor(uint32 loot_id) const
Definition: LootMgr.h:224
LootType loot_type
Definition: LootMgr.h:326

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

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

◆ CalculateMinMaxDamage()

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

Implements Unit.

1093{
1094 // creatures only have one damage
1095 if (damageIndex != 0)
1096 {
1097 minDamage = 0.f;
1098 maxDamage = 0.f;
1099 return;
1100 }
1101
1102 UnitMods unitMod;
1103 float variance = 1.0f;
1104 switch (attType)
1105 {
1106 case BASE_ATTACK:
1107 default:
1108 variance = GetCreatureTemplate()->BaseVariance;
1109 unitMod = UNIT_MOD_DAMAGE_MAINHAND;
1110 break;
1111 case OFF_ATTACK:
1112 variance = GetCreatureTemplate()->BaseVariance;
1113 unitMod = UNIT_MOD_DAMAGE_OFFHAND;
1114 break;
1115 case RANGED_ATTACK:
1116 variance = GetCreatureTemplate()->RangeVariance;
1117 unitMod = UNIT_MOD_DAMAGE_RANGED;
1118 break;
1119 }
1120
1121 if (attType == OFF_ATTACK && !haveOffhandWeapon())
1122 {
1123 minDamage = 0.0f;
1124 maxDamage = 0.0f;
1125 return;
1126 }
1127
1128 float weaponMinDamage = GetWeaponDamageRange(attType, MINDAMAGE);
1129 float weaponMaxDamage = GetWeaponDamageRange(attType, MAXDAMAGE);
1130
1131 if (!CanUseAttackType(attType)) // disarm case
1132 {
1133 weaponMinDamage = 0.0f;
1134 weaponMaxDamage = 0.0f;
1135 }
1136
1137 float attackPower = GetTotalAttackPowerValue(attType);
1138 float attackSpeedMulti = GetAPMultiplier(attType, normalized);
1139 float baseValue = GetModifierValue(unitMod, BASE_VALUE) + (attackPower / 14.0f) * variance;
1140 float basePct = GetModifierValue(unitMod, BASE_PCT) * attackSpeedMulti;
1141 float totalValue = GetModifierValue(unitMod, TOTAL_VALUE);
1142 float totalPct = addTotalPct ? GetModifierValue(unitMod, TOTAL_PCT) : 1.0f;
1143 float dmgMultiplier = GetCreatureTemplate()->DamageModifier; // = DamageModifier * _GetDamageMod(rank);
1144
1145 minDamage = ((weaponMinDamage + baseValue) * dmgMultiplier * basePct + totalValue) * totalPct;
1146 maxDamage = ((weaponMaxDamage + baseValue) * dmgMultiplier * basePct + totalValue) * totalPct;
1147
1148 // pussywizard: crashfix (casting negative to uint => min > max => assertion in urand)
1149 if (minDamage < 0.0f || minDamage > 1000000000.0f)
1150 minDamage = 0.0f;
1151 if (maxDamage < 0.0f || maxDamage > 1000000000.0f)
1152 maxDamage = 0.0f;
1153 if (minDamage > maxDamage)
1154 minDamage = maxDamage;
1155}
@ MINDAMAGE
Definition: Unit.h:135
@ MAXDAMAGE
Definition: Unit.h:136
UnitMods
Definition: Unit.h:142
@ UNIT_MOD_DAMAGE_OFFHAND
Definition: Unit.h:166
@ UNIT_MOD_DAMAGE_RANGED
Definition: Unit.h:167
@ UNIT_MOD_DAMAGE_MAINHAND
Definition: Unit.h:165
@ OFF_ATTACK
Definition: Unit.h:210
@ BASE_ATTACK
Definition: Unit.h:209
@ RANGED_ATTACK
Definition: Unit.h:211
@ BASE_VALUE
Definition: Unit.h:126
@ TOTAL_VALUE
Definition: Unit.h:128
@ TOTAL_PCT
Definition: Unit.h:129
@ BASE_PCT
Definition: Unit.h:127
float BaseVariance
Definition: CreatureData.h:214
float RangeVariance
Definition: CreatureData.h:215
float DamageModifier
Definition: CreatureData.h:211
float GetTotalAttackPowerValue(WeaponAttackType attType, Unit *pVictim=nullptr) const
Definition: Unit.cpp:15383
bool CanUseAttackType(uint8 attacktype) const
Definition: Unit.h:1055
float GetWeaponDamageRange(WeaponAttackType attType, WeaponDamageRange type, uint8 damageIndex=0) const
Definition: Unit.cpp:15407
bool haveOffhandWeapon() const
Definition: Unit.cpp:522
float GetModifierValue(UnitMods unitMod, UnitModifierType modifierType) const
Definition: Unit.cpp:15243
float GetAPMultiplier(WeaponAttackType attType, bool normalized)
Definition: Unit.cpp:17174

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

◆ CallAssistance()

void Creature::CallAssistance ( Unit target = nullptr)
2429{
2430 if (!target)
2431 {
2432 target = GetVictim();
2433 }
2434
2435 if (!m_AlreadyCallAssistance && target && !IsPet() && !IsCharmed())
2436 {
2437 SetNoCallAssistance(true);
2438
2439 float radius = sWorld->getFloatConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS);
2440
2441 if (radius > 0)
2442 {
2443 std::list<Creature*> assistList;
2444
2445 Acore::AnyAssistCreatureInRangeCheck u_check(this, target, radius);
2447 Cell::VisitGridObjects(this, searcher, radius);
2448
2449 if (!assistList.empty())
2450 {
2451 AssistDelayEvent* e = new AssistDelayEvent(target->GetGUID(), this);
2452 while (!assistList.empty())
2453 {
2454 // Pushing guids because in delay can happen some creature gets despawned => invalid pointer
2455 e->AddAssistant((*assistList.begin())->GetGUID());
2456 assistList.pop_front();
2457 }
2459 }
2460 }
2461 }
2462}
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY
Definition: IWorld.h:287
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS
Definition: IWorld.h:203
void AddEvent(BasicEvent *Event, uint64 e_time, bool set_addtime=true)
Definition: EventProcessor.h:103
uint64 CalculateTime(uint64 t_offset) const
Definition: EventProcessor.cpp:159
void SetNoCallAssistance(bool val)
Definition: Creature.h:268
Definition: Creature.h:523
void AddAssistant(ObjectGuid guid)
Definition: Creature.h:528
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:109
EventProcessor m_Events
Definition: Unit.h:1792
Unit * GetVictim() const
Definition: Unit.h:789
static void VisitGridObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:179
Definition: GridNotifiers.h:473
Definition: GridNotifiers.h:1266

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

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

◆ CallForHelp()

void Creature::CallForHelp ( float  fRadius,
Unit target = nullptr 
)
2465{
2466 if (radius <= 0.0f || IsPet() || IsCharmed())
2467 {
2468 return;
2469 }
2470
2471 if (!target)
2472 {
2473 target = GetVictim();
2474 }
2475
2476 if (!target)
2477 {
2478 return;
2479 }
2480
2481 Acore::CallOfHelpCreatureInRangeDo u_do(this, target, radius);
2483 Cell::VisitGridObjects(this, worker, radius);
2484}
Definition: GridNotifiers.h:489
Definition: GridNotifiers.h:1147

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

Referenced by BossAI::_JustEngagedWith(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::DamageTaken(), boss_emperor_dagran_thaurissan::boss_draganthaurissanAI::JustEngagedWith(), boss_grand_champion::boss_grand_championAI::JustEngagedWith(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::JustEngagedWith(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::JustEngagedWith(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::JustEngagedWith(), boss_thorim_gauntlet_npcs::boss_thorim_gauntlet_npcsAI::JustEngagedWith(), boss_xt002::boss_xt002AI::JustEngagedWith(), boss_blackheart_the_inciter::JustEngagedWith(), boss_sartharion::boss_sartharionAI::JustEngagedWith(), boss_moroes::JustEngagedWith(), npc_sindragosa_trash::npc_sindragosa_trashAI::JustEngagedWith(), boss_anubrekhan::boss_anubrekhanAI::JustEngagedWith(), boss_faerlina::boss_faerlinaAI::JustEngagedWith(), boss_gothik::boss_gothikAI::JustSummoned(), npc_sentinel_leader::UpdateAI(), and npc_cork_gizelton::npc_cork_gizeltonAI::WaypointReached().

◆ CanAlwaysSee()

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

Reimplemented from WorldObject.

1881{
1882 if (IsAIEnabled && AI()->CanSeeAlways(obj))
1883 return true;
1884
1885 return false;
1886}
CreatureAI * AI() const
Definition: Creature.h:143

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
2487{
2488 // is it true?
2490 return false;
2491
2492 // we don't need help from zombies :)
2493 if (!IsAlive())
2494 return false;
2495
2496 // Xinef: we cannot assist in evade mode
2497 if (IsInEvadeMode())
2498 return false;
2499
2500 // pussywizard: or if enemy is in evade mode
2501 if (enemy && enemy->IsCreature() && enemy->ToCreature()->IsInEvadeMode())
2502 return false;
2503
2504 // we don't need help from non-combatant ;)
2505 if (IsCivilian())
2506 return false;
2507
2509 return false;
2510
2511 // skip fighting creature
2512 if (IsEngaged())
2513 return false;
2514
2515 // only free creature
2517 return false;
2518
2521 {
2522 return false;
2523 }
2524
2525 // only from same creature faction
2526 if (checkfaction)
2527 {
2528 if (GetFaction() != u->GetFaction())
2529 return false;
2530 }
2531 else
2532 {
2533 if (!IsFriendlyTo(u))
2534 return false;
2535 }
2536
2537 // skip non hostile to caster enemy creatures
2538 if (!IsHostileTo(enemy))
2539 return false;
2540
2541 // Check if can see the enemy
2542 if (!CanSeeOrDetect(enemy))
2543 {
2544 return false;
2545 }
2546
2547 return true;
2548}
@ UNIT_FLAG_NON_ATTACKABLE
Definition: UnitDefines.h:230
@ UNIT_FLAG_NOT_SELECTABLE
Definition: UnitDefines.h:254
@ CREATURE_FLAG_EXTRA_IGNORE_ALL_ASSISTANCE_CALLS
Definition: CreatureData.h:72
bool IsCivilian() const
Definition: Creature.h:77
bool HasReactState(ReactStates state) const
Definition: Creature.h:99
bool IsInEvadeMode() const
Definition: Creature.h:137
bool HasFlagsExtra(uint32 flag) const
Definition: CreatureData.h:286
bool CanSeeOrDetect(WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
Definition: Object.cpp:1726
bool HasUnitFlag(UnitFlags flags) const
Definition: Unit.h:682
bool IsAlive() const
Definition: Unit.h:1204
uint32 GetFaction() const
Definition: Unit.h:755
bool IsEngaged() const
Definition: Unit.h:817
bool IsImmuneToNPC() const
Definition: Unit.h:815
ObjectGuid GetCharmerOrOwnerGUID() const
Definition: Unit.h:1226

References WorldObject::CanSeeOrDetect(), CREATURE_FLAG_EXTRA_IGNORE_ALL_ASSISTANCE_CALLS, Unit::GetCharmerOrOwnerGUID(), Unit::GetFaction(), CreatureTemplate::HasFlagsExtra(), HasReactState(), Unit::HasUnitFlag(), Unit::IsAlive(), IsCivilian(), Object::IsCreature(), Unit::IsEngaged(), Unit::IsFriendlyTo(), Unit::IsHostileTo(), Unit::IsImmuneToNPC(), IsInEvadeMode(), m_creatureInfo, REACT_AGGRESSIVE, 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.

3816{
3817 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID);
3818 int32 currentPower = GetPower(getPowerType());
3819
3821 {
3822 return false;
3823 }
3824
3825 if (spellInfo && (currentPower < spellInfo->CalcPowerCost(this, spellInfo->GetSchoolMask())))
3826 {
3827 return false;
3828 }
3829
3830 return true;
3831}
std::int32_t int32
Definition: Define.h:103
@ UNIT_FLAG_SILENCED
Definition: UnitDefines.h:242
@ UNIT_FIELD_FLAGS
Definition: UpdateFields.h:117
bool IsSpellProhibited(SpellSchoolMask idSchoolMask) const
Definition: Creature.cpp:2823
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.cpp:889
Powers getPowerType() const
Definition: Unit.h:888
uint32 GetPower(Powers power) const
Definition: Unit.h:891
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:1986

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

Referenced by npc_capernian::JustEngagedWith().

◆ CanCreatureAttack()

bool Creature::CanCreatureAttack ( Unit const *  victim,
bool  skipDistCheck = false 
) const
2621{
2622 if (!victim->IsInMap(this))
2623 return false;
2624
2625 if (!IsValidAttackTarget(victim))
2626 return false;
2627
2628 if (!victim->isInAccessiblePlaceFor(this))
2629 return false;
2630
2631 if (IsAIEnabled && !AI()->CanAIAttack(victim))
2632 return false;
2633
2634 // pussywizard: we cannot attack in evade mode
2635 if (IsInEvadeMode())
2636 return false;
2637
2638 // pussywizard: or if enemy is in evade mode
2639 if (victim->IsCreature() && victim->ToCreature()->IsInEvadeMode())
2640 return false;
2641
2642 // cannot attack if is during 5 second grace period, unless being attacked
2643 if (m_respawnedTime && (GameTime::GetGameTime().count() - m_respawnedTime) < 5 && !IsEngagedBy(victim))
2644 {
2645 return false;
2646 }
2647
2648 // if victim is in FD and we can't see that
2649 if (victim->HasUnitFlag2(UNIT_FLAG2_FEIGN_DEATH) && !CanIgnoreFeignDeath())
2650 {
2651 return false;
2652 }
2653
2655 {
2656 if (GetMap()->IsDungeon())
2657 return true;
2658
2659 float visibility = std::max<float>(GetVisibilityRange(), victim->GetVisibilityRange());
2660
2661 // if outside visibility
2662 if (!IsWithinDist(victim, visibility))
2663 return false;
2664
2665 // pussywizard: don't check distance to home position if recently damaged (allow kiting away from spawnpoint!)
2666 // xinef: this should include taunt auras
2668 return true;
2669 }
2670
2671 if (skipDistCheck)
2672 return true;
2673
2674 // xinef: added size factor for huge npcs
2675 float dist = std::min<float>(GetDetectionRange() + GetObjectSize() * 2, 150.0f);
2676
2677 if (Unit* unit = GetCharmerOrOwner())
2678 {
2679 dist = std::min<float>(GetMap()->GetVisibilityRange() + GetObjectSize() * 2, 150.0f);
2680 return victim->IsWithinDist(unit, dist);
2681 }
2682 else
2683 {
2684 // to prevent creatures in air ignore attacks because distance is already too high...
2685 if (GetMovementTemplate().IsFlightAllowed())
2686 return victim->IsInDist2d(&m_homePosition, dist);
2687 else
2688 return victim->IsInDist(&m_homePosition, dist);
2689 }
2690}
@ SPELL_AURA_MOD_TAUNT
Definition: SpellAuraDefines.h:74
bool isWorldBoss() const
Definition: Creature.h:123
float GetDetectionRange() const
Definition: Creature.h:258
time_t GetLastLeashExtensionTime() const
Definition: Creature.cpp:3695
CreatureMovementData const & GetMovementTemplate() const
Definition: Creature.cpp:2975
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition: Object.cpp:1316
float GetVisibilityRange() const
Definition: Object.cpp:1645
float GetObjectSize() const
Definition: Object.cpp:2771
Unit * GetCharmerOrOwner() const
Definition: Unit.h:1243
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:5676
bool IsValidAttackTarget(Unit const *target, SpellInfo const *bySpell=nullptr) const
Definition: Unit.cpp:13828

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

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

◆ CanEnterWater()

bool Creature::CanEnterWater ( ) const
overridevirtual

Implements Unit.

3259{
3260 if (CanSwim())
3261 return true;
3262
3264}
bool CanSwim() const override
This method check the current flag/status of a creature and its inhabit type.
Definition: Creature.cpp:3247
bool IsSwimAllowed() const
Definition: CreatureData.h:138

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

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

◆ CanFly()

bool Creature::CanFly ( ) const
inlineoverridevirtual

◆ CanGeneratePickPocketLoot()

bool Creature::CanGeneratePickPocketLoot ( ) const

◆ CanHover()

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

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

Referenced by LoadCreaturesAddon(), and UpdateMovementFlags().

◆ CanIgnoreFeignDeath()

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

References CREATURE_FLAG_EXTRA_IGNORE_FEIGN_DEATH, and GetCreatureTemplate().

Referenced by _IsTargetAcceptable(), and CanCreatureAttack().

◆ CanNotReachTarget()

bool Creature::CanNotReachTarget ( ) const
3664{
3665 return m_cannotReachTarget;
3666}
ObjectGuid m_cannotReachTarget
Definition: Creature.h:508

References m_cannotReachTarget.

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

◆ CanPeriodicallyCallForAssistance()

bool Creature::CanPeriodicallyCallForAssistance ( ) const
private
3706{
3707 if (!IsInCombat())
3708 return false;
3709
3711 return false;
3712
3713 if (!CanHaveThreatList())
3714 return false;
3715
3716 if (IsSummon() && GetMap()->Instanceable())
3717 return false;
3718
3719 return true;
3720}
@ UNIT_STATE_POSSESSED
Definition: UnitDefines.h:165
bool CanHaveThreatList() const
Definition: Unit.cpp:14569
bool IsSummon() const
Definition: Unit.h:707
bool HasUnitState(const uint32 f) const
Definition: Unit.h:673
bool IsInCombat() const
Definition: Unit.h:820

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

Referenced by Update().

◆ CanStartAttack()

bool Creature::CanStartAttack ( Unit const *  u) const
1904{
1905 if (IsCivilian())
1906 return false;
1907
1908 // This set of checks is should be done only for creatures
1909 if ((IsImmuneToNPC() && !who->IsPlayer()) || // flag is valid only for non player characters
1910 (IsImmuneToPC() && who->IsPlayer())) // immune to PC and target is a player, return false
1911 {
1912 return false;
1913 }
1914
1915 if (Unit* owner = who->GetOwner())
1916 if (owner->IsPlayer() && IsImmuneToPC()) // immune to PC and target has player owner
1917 return false;
1918
1919 // Do not attack non-combat pets
1920 if (who->IsCreature() && who->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET)
1921 return false;
1922
1923 if (!CanFly() && (GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE + m_CombatDistance)) // too much Z difference, skip very costy vmap calculations here
1924 return false;
1925
1926 if (!_IsTargetAcceptable(who))
1927 return false;
1928
1929 // pussywizard: at this point we are either hostile to who or friendly to who->getAttackerForHelper()
1930 // pussywizard: if who is in combat and has an attacker, help him if the distance is right (help because who is hostile or help because attacker is friendly)
1931 bool assist = false;
1932 if (who->IsEngaged() && IsWithinDist(who, ATTACK_DISTANCE))
1933 if (Unit* victim = who->getAttackerForHelper())
1935 assist = true;
1936
1937 if (!assist)
1938 if (IsNeutralToAll() || !IsWithinDistInMap(who, GetAggroRange(who) + m_CombatDistance, true, false)) // pussywizard: +m_combatDistance for turrets and similar
1939 return false;
1940
1941 if (!CanCreatureAttack(who))
1942 return false;
1943
1945 return false;
1946
1947 return IsWithinLOSInMap(who);
1948}
@ UNIT_STATE_STUNNED
Definition: UnitDefines.h:152
#define ATTACK_DISTANCE
Definition: ObjectDefines.h:25
#define CREATURE_Z_ATTACK_RANGE
Definition: Creature.h:41
@ CREATURE_TYPE_NON_COMBAT_PET
Definition: SharedDefines.h:2639
bool _IsTargetAcceptable(Unit const *target) const
Definition: Creature.cpp:2552
bool CanFly() const override
Definition: Creature.h:84
bool CanCreatureAttack(Unit const *victim, bool skipDistCheck=false) const
Definition: Creature.cpp:2620
float GetAggroRange(Unit const *target) const
Definition: Creature.cpp:3378
bool IsWithinLOSInMap(WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
Definition: Object.cpp:1347
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition: Object.cpp:1321
float GetDistanceZ(WorldObject const *obj) const
Definition: Object.cpp:1198
Unit * GetOwner() const
Definition: Unit.cpp:10562
bool IsImmuneToPC() const
Definition: Unit.h:813

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

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

◆ CanSwim()

bool Creature::CanSwim ( ) const
overridevirtual

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

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

Reimplemented from Unit.

3248{
3249 if (Unit::CanSwim() || (!Unit::CanSwim() && !CanFly()))
3250 return true;
3251
3252 if (IsPet())
3253 return true;
3254
3255 return false;
3256}
virtual bool CanSwim() const
this method checks the current flag of a unit
Definition: Unit.cpp:19923

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

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

◆ CanWalk()

◆ ClearLastLeashExtensionTimePtr()

◆ ClearProhibitedSpellTimers()

void Creature::ClearProhibitedSpellTimers ( )
2840{
2841 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
2842 {
2843 m_ProhibitSchoolTime[i] = 0;
2844 }
2845}

References m_ProhibitSchoolTime, MAX_SPELL_SCHOOL, and SPELL_SCHOOL_NORMAL.

◆ ClearTarget()

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

References SetTarget().

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

◆ Create()

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

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

Need to be called after LoadCreaturesAddon - MOVEMENTFLAG_HOVER is set there

1124{
1125 ASSERT(map);
1126 SetMap(map);
1127 SetPhaseMask(phaseMask, false);
1128
1129 CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(Entry);
1130 if (!cinfo)
1131 {
1132 LOG_ERROR("sql.sql", "Creature::Create(): creature template (guidlow: {}, entry: {}) does not exist.", guidlow, Entry);
1133 return false;
1134 }
1135
1138 Relocate(x, y, z, ang);
1139
1140 if (!IsPositionValid())
1141 {
1142 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);
1143 return false;
1144 }
1145
1146 // area/zone id is needed immediately for ZoneScript::GetCreatureEntry hook before it is known which creature template to load (no model/scale available yet)
1147 PositionFullTerrainStatus terrainData;
1149 ProcessPositionDataChanged(terrainData);
1150
1151 //oX = x; oY = y; dX = x; dY = y; m_moveTime = 0; m_startMove = 0;
1152 if (!CreateFromProto(guidlow, Entry, vehId, data))
1153 return false;
1154
1156
1157 switch (GetCreatureTemplate()->rank)
1158 {
1161 break;
1164 break;
1167 break;
1169 // Xinef: Reduce corpse delay for bossess outside of instance
1170 if (!GetInstanceId())
1171 m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_ELITE) * 2;
1172 else
1174 break;
1175 default:
1177 break;
1178 }
1179
1181 CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&display, cinfo);
1182 if (minfo && !IsTotem()) // Cancel load if no model defined or if totem
1183 {
1184 SetDisplayId(display.CreatureDisplayID, display.DisplayScale);
1185 SetNativeDisplayId(display.CreatureDisplayID);
1186 }
1187
1189
1192
1194
1196 {
1199 }
1200 else if (cinfo->type_flags & CREATURE_TYPE_FLAG_VISIBLE_TO_GHOSTS) // Xinef: Add ghost visibility for ghost units
1202
1203 if (Entry == VISUAL_WAYPOINT)
1204 SetVisible(false);
1205
1208
1209 return true;
1210}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:156
#define sObjectMgr
Definition: ObjectMgr.h:1623
#define VISUAL_WAYPOINT
Definition: MotionMaster.h:32
@ CONFIG_CORPSE_DECAY_ELITE
Definition: IWorld.h:306
@ CONFIG_CORPSE_DECAY_NORMAL
Definition: IWorld.h:304
@ CONFIG_CORPSE_DECAY_WORLDBOSS
Definition: IWorld.h:308
@ CONFIG_CORPSE_DECAY_RARE
Definition: IWorld.h:305
@ CONFIG_CORPSE_DECAY_RAREELITE
Definition: IWorld.h:307
@ UNIT_STATE_IGNORE_PATHFINDING
Definition: UnitDefines.h:176
#define DEFAULT_COLLISION_HEIGHT
Definition: ObjectDefines.h:50
@ CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING
Definition: CreatureData.h:75
@ CREATURE_FLAG_EXTRA_GHOST_VISIBILITY
Definition: CreatureData.h:56
uint32 const Entry[3]
Definition: instance_blackwing_lair.cpp:72
@ SERVERSIDE_VISIBILITY_GHOST
Definition: SharedDefines.h:1274
@ GHOST_VISIBILITY_ALIVE
Definition: SharedDefines.h:1281
@ GHOST_VISIBILITY_GHOST
Definition: SharedDefines.h:1282
@ CREATURE_TYPE_FLAG_VISIBLE_TO_GHOSTS
Definition: SharedDefines.h:2696
bool LoadCreaturesAddon(bool reload=false)
Definition: Creature.cpp:2705
void SetDisplayId(uint32 displayId, float displayScale=1.f) override
Definition: Creature.cpp:3505
bool CreateFromProto(ObjectGuid::LowType guidlow, uint32 Entry, uint32 vehId, const CreatureData *data=nullptr)
Definition: Creature.cpp:1625
uint32 GetScriptId() const
Definition: Creature.cpp:3038
void UpdateMovementFlags()
Definition: Creature.cpp:3423
float GetNativeObjectScale() const override
Definition: Creature.cpp:3481
Definition: CreatureData.h:172
Definition: CreatureData.h:189
uint32 type_flags
Definition: CreatureData.h:226
Definition: CreatureData.h:401
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:372
uint32 GetPhaseMask() const
Definition: Object.h:446
uint32 LastUsedScriptID
Definition: Object.h:596
uint32 GetInstanceId() const
Definition: Object.h:443
virtual void SetMap(Map *map)
Definition: Object.cpp:2105
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
Definition: Object.h:524
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition: Object.h:523
float m_positionZ
Definition: Position.h:58
float GetPositionZ() const
Definition: Position.h:119
bool IsPositionValid() const
Definition: Position.cpp:175
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118
void Relocate(float x, float y)
Definition: Position.h:73
void SetVisible(bool x)
Definition: Unit.cpp:14189
void SetNativeDisplayId(uint32 displayId)
Definition: Unit.h:1511
void AddUnitState(uint32 f)
Definition: Unit.h:672
float GetHoverHeight() const
Definition: Unit.h:1703
uint32 GetNativeDisplayId() const
Definition: Unit.h:1509
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition: Unit.cpp:19005
void ProcessPositionDataChanged(PositionFullTerrainStatus const &data) override
Definition: Unit.cpp:4236
bool IsSpiritHealer() const
Definition: Unit.h:725
bool IsTotem() const
Definition: Unit.h:712
bool IsSpiritGuide() const
Definition: Unit.h:726
Definition: Map.h:182
void GetFullTerrainStatusForPosition(uint32 phaseMask, float x, float y, float z, float collisionHeight, PositionFullTerrainStatus &data, uint8 reqLiquidType=MAP_ALL_LIQUIDS)
Definition: Map.cpp:2287

References Unit::AddUnitState(), ASSERT, CONFIG_CORPSE_DECAY_ELITE, CONFIG_CORPSE_DECAY_NORMAL, CONFIG_CORPSE_DECAY_RARE, CONFIG_CORPSE_DECAY_RAREELITE, CONFIG_CORPSE_DECAY_WORLDBOSS, CreateFromProto(), CREATURE_ELITE_ELITE, CREATURE_ELITE_RARE, CREATURE_ELITE_RAREELITE, CREATURE_ELITE_WORLDBOSS, CREATURE_FLAG_EXTRA_GHOST_VISIBILITY, CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING, CREATURE_TYPE_FLAG_VISIBLE_TO_GHOSTS, 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, Position::IsPositionValid(), Unit::IsSpiritGuide(), Unit::IsSpiritHealer(), Unit::IsTotem(), WorldObject::LastUsedScriptID, LoadCreaturesAddon(), LOG_ERROR, m_corpseDelay, Position::m_positionZ, WorldObject::m_serverSideVisibility, WorldObject::m_serverSideVisibilityDetect, Unit::ProcessPositionDataChanged(), Position::Relocate(), SERVERSIDE_VISIBILITY_GHOST, SetDisplayId(), WorldObject::SetMap(), Unit::SetNativeDisplayId(), Unit::SetPhaseMask(), FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue(), Unit::SetVisible(), sObjectMgr, sWorld, CreatureTemplate::type_flags, UNIT_STATE_IGNORE_PATHFINDING, UpdateMovementFlags(), and VISUAL_WAYPOINT.

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

◆ CreateFromProto()

bool Creature::CreateFromProto ( ObjectGuid::LowType  guidlow,
uint32  Entry,
uint32  vehId,
const CreatureData data = nullptr 
)
protected
1626{
1627 SetZoneScript();
1628 if (GetZoneScript() && data)
1629 {
1630 uint32 FirstEntry = GetZoneScript()->GetCreatureEntry(guidlow, data);
1631 if (!FirstEntry)
1632 return false;
1633 }
1634
1635 CreatureTemplate const* normalInfo = sObjectMgr->GetCreatureTemplate(Entry);
1636 if (!normalInfo)
1637 {
1638 LOG_ERROR("sql.sql", "Creature::CreateFromProto(): creature template (guidlow: {}, entry: {}) does not exist.", guidlow, Entry);
1639 return false;
1640 }
1641
1643
1644 Object::_Create(guidlow, Entry, (vehId || normalInfo->VehicleId) ? HighGuid::Vehicle : HighGuid::Unit);
1645
1646 // Xinef: select proper vehicle id
1647 if (!vehId)
1648 {
1649 CreatureTemplate const* cinfo = normalInfo;
1650 for (uint8 diff = uint8(GetMap()->GetSpawnMode()); diff > 0 && !IsPet();)
1651 {
1652 // we already have valid Map pointer for current creature!
1653 if (cinfo->DifficultyEntry[diff - 1])
1654 {
1655 cinfo = sObjectMgr->GetCreatureTemplate(normalInfo->DifficultyEntry[diff - 1]);
1656 if (cinfo && cinfo->VehicleId)
1657 break; // template found
1658
1659 // check and reported at startup, so just ignore (restore normalInfo)
1660 cinfo = normalInfo;
1661 }
1662
1663 // for instances heroic to normal, other cases attempt to retrieve previous difficulty
1664 if (diff >= RAID_DIFFICULTY_10MAN_HEROIC && GetMap()->IsRaid())
1665 diff -= 2; // to normal raid difficulty cases
1666 else
1667 --diff;
1668 }
1669
1670 if (cinfo->VehicleId)
1671 CreateVehicleKit(cinfo->VehicleId, (cinfo->VehicleId != normalInfo->VehicleId ? cinfo->Entry : normalInfo->Entry));
1672 }
1673 else
1674 CreateVehicleKit(vehId, Entry);
1675
1676 if (!UpdateEntry(Entry, data))
1677 return false;
1678
1679 return true;
1680}
@ RAID_DIFFICULTY_10MAN_HEROIC
Definition: DBCEnums.h:275
bool UpdateEntry(uint32 entry, const CreatureData *data=nullptr, bool changelevel=true, bool updateAI=false)
Definition: Creature.cpp:538
void SetOriginalEntry(uint32 entry)
Definition: Creature.h:368
uint32 Entry
Definition: CreatureData.h:190
uint32 VehicleId
Definition: CreatureData.h:233
uint32 DifficultyEntry[MAX_DIFFICULTY - 1]
Definition: CreatureData.h:191
void _Create(ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
Definition: Object.cpp:134
void SetZoneScript()
Definition: Object.cpp:2333
bool CreateVehicleKit(uint32 id, uint32 creatureEntry)
Definition: Unit.cpp:18671
bool IsRaid() const
Definition: Map.h:450
virtual uint32 GetCreatureEntry(ObjectGuid::LowType, CreatureData const *data)
Definition: ZoneScript.h:32

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

Referenced by Create().

◆ DeleteFromDB()

void Creature::DeleteFromDB ( )
virtual

Reimplemented in Pet.

1838{
1839 if (!m_spawnId)
1840 {
1841 LOG_ERROR("entities.unit", "Trying to delete not saved creature: {}", GetGUID().ToString());
1842 return;
1843 }
1844
1846 sObjectMgr->DeleteCreatureData(m_spawnId);
1847
1848 WorldDatabaseTransaction trans = WorldDatabase.BeginTransaction();
1849
1851 stmt->SetData(0, m_spawnId);
1852 trans->Append(stmt);
1853
1854 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE_ADDON);
1855 stmt->SetData(0, m_spawnId);
1856 trans->Append(stmt);
1857
1858 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAME_EVENT_CREATURE);
1859 stmt->SetData(0, m_spawnId);
1860 trans->Append(stmt);
1861
1862 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAME_EVENT_MODEL_EQUIP);
1863 stmt->SetData(0, m_spawnId);
1864 trans->Append(stmt);
1865
1866 WorldDatabase.CommitTransaction(trans);
1867}
SQLTransaction< WorldDatabaseConnection > WorldDatabaseTransaction
Definition: DatabaseEnvFwd.h:72
@ WORLD_DEL_GAME_EVENT_MODEL_EQUIP
Definition: WorldDatabase.h:94
@ WORLD_DEL_CREATURE_ADDON
Definition: WorldDatabase.h:73
@ WORLD_DEL_GAME_EVENT_CREATURE
Definition: WorldDatabase.h:93
@ WORLD_DEL_CREATURE
Definition: WorldDatabase.h:83
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
Definition: PreparedStatement.h:158
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition: PreparedStatement.h:78
std::string ToString() const
Definition: Position.cpp:51
void RemoveCreatureRespawnTime(ObjectGuid::LowType dbGuid)
Definition: Map.cpp:3372

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

Referenced by npc_commandscript::HandleNpcDeleteCommand().

◆ DespawnOnEvade()

void Creature::DespawnOnEvade ( Seconds  respawnDelay = 20s)
2182{
2184
2185 if (respawnDelay < 2s)
2186 {
2187 LOG_WARN("entities.unit", "DespawnOnEvade called with delay of {} seconds, defaulting to 2.", respawnDelay.count());
2188 respawnDelay = 2s;
2189 }
2190
2191 if (TempSummon* whoSummon = ToTempSummon())
2192 {
2193 LOG_WARN("entities.unit", "DespawnOnEvade called on a temporary summon.");
2194 whoSummon->UnSummon();
2195 return;
2196 }
2197
2198 DespawnOrUnsummon(Milliseconds(0), respawnDelay);
2199}
#define LOG_WARN(filterType__,...)
Definition: Log.h:160
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition: Duration.h:27
virtual void SummonedCreatureDespawnAll()
Definition: CreatureAI.h:138
void DespawnOrUnsummon(Milliseconds msTimeToDespawn, Seconds forcedRespawnTimer)
Definition: Creature.cpp:2173
Definition: TemporarySummon.h:40
TempSummon * ToTempSummon()
Definition: Unit.h:1716

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

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

◆ DespawnOrUnsummon() [1/2]

void Creature::DespawnOrUnsummon ( Milliseconds  msTimeToDespawn,
Seconds  forcedRespawnTimer 
)
2174{
2175 if (TempSummon* summon = this->ToTempSummon())
2176 summon->UnSummon(msTimeToDespawn.count());
2177 else
2178 ForcedDespawn(msTimeToDespawn.count(), forcedRespawnTimer);
2179}
void ForcedDespawn(uint32 timeMSToDespawn=0, Seconds forcedRespawnTimer=0s)
Definition: Creature.cpp:2149

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

Referenced by npc_mograine::npc_mograineAI::AshbringerEvent(), spell_the_lich_king_shadow_trap_periodic::CheckTargetCount(), npc_simone::npc_simoneAI::CorpseRemoved(), Player::CreatePet(), boss_headless_horseman_head::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), npc_power_spark::npc_power_sparkAI::DamageTaken(), npc_akama_shade::DamageTaken(), npc_tiger_matriarch::npc_tiger_matriarchAI::DamageTaken(), MotionTransport::DelayedTeleportTransport(), SummonList::DespawnAll(), SummonList::DespawnEntry(), brann_bronzebeard::brann_bronzebeardAI::DespawnHeads(), DespawnOnEvade(), spell_rotface_unstable_ooze_explosion_suicide_aura::DespawnSelf(), Vehicle::Dismiss(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), npc_ulduar_toasty_fire::npc_ulduar_toasty_fireAI::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), npc_saurfang_event::npc_saurfang_eventAI::DoAction(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::DoAction(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::DoAction(), npc_bone_spike::npc_bone_spikeAI::DoAction(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::DoAction(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), boss_fathomlord_karathress::DoAction(), boss_infinite_corruptor::boss_infinite_corruptorAI::DoAction(), npc_twilight_summon::npc_twilight_summonAI::DoAction(), npc_snobold_vassal::npc_snobold_vassalAI::DoAction(), npc_living_mojo::npc_living_mojoAI::DoAction(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::DoAction(), npc_spark_of_ionar::npc_spark_of_ionarAI::DoAction(), npc_molten_golem::npc_molten_golemAI::DoAction(), npc_auriaya_feral_defender::npc_auriaya_feral_defenderAI::DoAction(), boss_thorim_sif::boss_thorim_sifAI::DoAction(), npc_blade_of_azzinoth::DoAction(), Spell::EffectScriptEffect(), Spell::EffectTameCreature(), boss_julianne::EnterEvadeMode(), boss_rend_blackhand::boss_rend_blackhandAI::EnterEvadeMode(), boss_attumen::EnterEvadeMode(), boss_entropius::boss_entropiusAI::EnterEvadeMode(), boss_black_knight::boss_black_knightAI::EnterEvadeMode(), npc_phantom_hallucination::npc_phantom_hallucinationAI::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::npc_fel_infernalAI::EnterEvadeMode(), npc_mistress_of_pain::npc_mistress_of_painAI::EnterEvadeMode(), npc_parasitic_shadowfiend::EnterEvadeMode(), boss_ahune::EnterEvadeMode(), boss_nazan::EnterEvadeMode(), boss_vazruden::EnterEvadeMode(), ForcedDespawnDelayEvent::Execute(), VehicleDespawnEvent::Execute(), DelayedCastEvent::Execute(), EoEDrakeEnterVehicleEvent::Execute(), SuckBackEvent::Execute(), npc_hallows_end_soh::FinishEvent(), spell_gen_despawn_self::HandleDummy(), spell_item_lil_xt::HandleDummy(), spell_q12096_q12092_dummy::HandleDummy(), spell_q12096_q12092_bark::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(), 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_shredder_delivery::HandleScript(), spell_ahune_minion_despawner::HandleScript(), spell_q12690_burst_at_the_seams::HandleScript(), spell_illidan_cage_trap::HandleScriptEffect(), spell_winter_veil_racer_slam_hit::HandleScriptEffect(), spell_q11065_wrangle_some_aether_rays_aura::if(), boss_twilight_corrupter::InitializeAI(), npc_preparations_for_war_vehicle::InitializeAI(), npc_ahune_ice_spear_bunny::InitializeAI(), npc_underbog_mushroom::InitializeAI(), Guardian::InitStatsForLevel(), npc_taldaram_flamesphere::IsSummonedBy(), npc_putricide_oozeAI::IsSummonedBy(), npc_ranshalla::npc_ranshallaAI::JustDidDialogueStep(), boss_majordomo::boss_majordomoAI::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_belnistrasz::npc_belnistraszAI::JustDied(), npc_living_inferno::npc_living_infernoAI::JustDied(), npc_memory::npc_memoryAI::JustDied(), npc_argent_soldier::npc_argent_soldierAI::JustDied(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::JustDied(), npc_fel_infernal::npc_fel_infernalAI::JustDied(), npc_mistress_of_pain::npc_mistress_of_painAI::JustDied(), npc_dark_nucleus::npc_dark_nucleusAI::JustDied(), npc_gunship::npc_gunshipAI::JustDied(), npc_little_ooze::npc_little_oozeAI::JustDied(), npc_big_ooze::npc_big_oozeAI::JustDied(), npc_ice_tomb::npc_ice_tombAI::JustDied(), npc_eoe_wyrmrest_skytalon::npc_eoe_wyrmrest_skytalonAI::JustDied(), npc_ulduar_saronite_animus::npc_ulduar_saronite_animusAI::JustDied(), npc_ichor_globule::npc_ichor_globuleAI::JustDied(), npc_vh_void_sentry::npc_vh_void_sentryAI::JustDied(), npc_thassarian2::npc_thassarian2AI::JustDied(), npc_wintergarde_gryphon::JustDied(), npc_q24545_vegard::npc_q24545_vegardAI::JustDied(), npc_blessed_banner::npc_blessed_bannerAI::JustDied(), boss_fathomguard_sharkkis::JustDied(), boss_fathomguard_tidalvess::JustDied(), boss_fathomguard_caribdis::JustDied(), boss_hydromancer_thespia::JustDied(), npc_buru_egg::JustDied(), boss_bug_trio::JustDied(), npc_frost_tomb::npc_frost_tombAI::JustDied(), npc_dirt_mound::JustEngagedWith(), npc_tainted_elemental::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::boss_rend_blackhandAI::JustSummoned(), boss_kiljaeden::boss_kiljaedenAI::JustSummoned(), npc_medivh_bm::JustSummoned(), boss_gal_darah::boss_gal_darahAI::JustSummoned(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustSummoned(), boss_professor_putricide::boss_professor_putricideAI::JustSummoned(), boss_rotface::boss_rotfaceAI::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), npc_risen_archmage::npc_risen_archmageAI::JustSummoned(), npc_gluttonous_abomination::npc_gluttonous_abominationAI::JustSummoned(), boss_malygos::boss_malygosAI::JustSummoned(), npc_tiger_matriarch::npc_tiger_matriarchAI::KilledUnit(), npc_brew_bubble::MoveInLineOfSight(), npc_khunok_the_behemoth::npc_khunok_the_behemothAI::MoveInLineOfSight(), npc_captured_beryl_sorcerer::npc_captured_beryl_sorcererAI::MoveInLineOfSight(), FollowerAI::MovementInform(), npc_brann_bronzebeard_algalon::npc_brann_bronzebeard_algalonAI::MovementInform(), npc_spirit_shade::npc_spirit_shadeAI::MovementInform(), npc_forest_frog::npc_forest_frogAI::MovementInform(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::MovementInform(), npc_troll_volunteer::npc_troll_volunteerAI::MovementInform(), boss_grand_champion::boss_grand_championAI::MovementInform(), npc_concentrated_ball::npc_concentrated_ballAI::MovementInform(), npc_darnavan::npc_darnavanAI::MovementInform(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::MovementInform(), npc_vehicle_d16_propelled_delivery::npc_vehicle_d16_propelled_deliveryAI::MovementInform(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::MovementInform(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::MovementInform(), npc_chained_spirit::MovementInform(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), npc_assembly_lightning::npc_assembly_lightningAI::MovementInform(), npc_xt002_scrapbot::npc_xt002_scrapbotAI::MovementInform(), npc_released_offspring_harkoa::npc_released_offspring_harkoaAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::MovementInform(), npc_image_of_medivh::npc_image_of_medivhAI::NextStep(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::npc_lk_spirit_bombAI(), 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(), 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_kaelthas_flame_strike::OnRemove(), npc_valithria_portal::npc_valithria_portalAI::OnSpellClick(), boss_yoggsaron_descend_portal::boss_yoggsaron_descend_portalAI::OnSpellClick(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnUnitDeath(), FrostwingGauntletRespawner::operator()(), ValithriaDespawner::operator()(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::PassengerBoarded(), npc_ulduar_vx001::npc_ulduar_vx001AI::PassengerBoarded(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::PassengerBoarded(), npc_eoe_wyrmrest_skytalon::npc_eoe_wyrmrest_skytalonAI::PassengerBoarded(), npc_oculus_drake::npc_oculus_drakeAI::PassengerBoarded(), npc_ulduar_flames_initial::npc_ulduar_flames_initialAI::RemoveAll(), boss_gyth::boss_gythAI::Reset(), boss_nefarian::Reset(), npc_image_of_medivh::npc_image_of_medivhAI::Reset(), npc_singularity::npc_singularityAI::Reset(), boss_infinite_corruptor::boss_infinite_corruptorAI::Reset(), boss_mal_ganis::boss_mal_ganisAI::Reset(), npc_eye_tentacle::Reset(), npc_claw_tentacle::Reset(), npc_xerestrasza::npc_xerestraszaAI::Reset(), npc_raging_spirit::npc_raging_spiritAI::Reset(), npc_assembly_lightning::npc_assembly_lightningAI::Reset(), npc_xt002_pummeller::npc_xt002_pummellerAI::Reset(), npc_xt002_life_spark::npc_xt002_life_sparkAI::Reset(), npc_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(), NPCStaveQuestAI::RevealForm(), spell_putricide_ooze_channel::SelectTarget(), npc_frost_sphere::npc_frost_sphereAI::SpellHit(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::SpellHit(), npc_ulduar_flames_spread::npc_ulduar_flames_spreadAI::SpellHit(), npc_vics_flying_machine::npc_vics_flying_machineAI::SpellHit(), npc_captured_rageclaw::npc_captured_rageclawAI::SpellHit(), boss_headless_horseman_pumpkin::SpellHit(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), boss_freya::boss_freyaAI::SpellHit(), boss_hodir::boss_hodirAI::SpellHit(), boss_mimiron::boss_mimironAI::SpellHit(), npc_ulduar_keeper::npc_ulduar_keeperAI::SpellHit(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::SpellHit(), npc_living_constellation::npc_living_constellationAI::SpellHit(), npc_drakuru_shackles::npc_drakuru_shacklesAI::SpellHit(), npc_enslaved_netherwing_drake::SpellHit(), npc_midsummer_torch_target::SpellHit(), boss_magus_telestra::boss_magus_telestraAI::SpellHit(), boss_thorim::boss_thorimAI::SpellHit(), npc_iron_watcher::npc_iron_watcherAI::SpellHit(), npc_vengeful_shade::npc_vengeful_shadeAI::SpellHitTarget(), boss_headless_horseman_head::SpellHitTarget(), npc_q24545_lich_king::npc_q24545_lich_kingAI::SpellHitTarget(), boss_ouro::Submerge(), npc_time_rift::SummonedCreatureDies(), boss_hazzarah::SummonedCreatureDies(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonedCreatureDies(), npc_creature_generator_akama::SummonedCreatureDies(), boss_vexallus::SummonedCreatureDies(), boss_hydross_the_unstable::SummonMovementInform(), boss_razorgore::boss_razorgoreAI::SummonMovementInform(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), npc_drakuru_shackles::npc_drakuru_shacklesAI::UnlockRageclaw(), VehicleAI::UpdateAI(), npc_escortAI::UpdateAI(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_victor_nefarius::boss_victor_nefariusAI::UpdateAI(), npc_kernobee::npc_kernobeeAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), boss_kalec::boss_kalecAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_dark_iron_attack_mole_machine::UpdateAI(), npc_brew_bubble::UpdateAI(), npc_love_in_air_snivel_real::UpdateAI(), npc_belnistrasz::npc_belnistraszAI::UpdateAI(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), npc_depth_charge::npc_depth_chargeAI::UpdateAI(), npc_draenei_survivor::npc_draenei_survivorAI::UpdateAI(), npc_stillpine_capitive::npc_stillpine_capitiveAI::UpdateAI(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::UpdateAI(), npc_giant_spotlight::npc_giant_spotlightAI::UpdateAI(), npc_sergeant_bly::npc_sergeant_blyAI::UpdateAI(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::UpdateAI(), npc_fos_corrupted_soul_fragment::npc_fos_corrupted_soul_fragmentAI::UpdateAI(), boss_drakkari_elemental::boss_drakkari_elementalAI::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), npc_vengeful_shade::npc_vengeful_shadeAI::UpdateAI(), npc_bone_spike::npc_bone_spikeAI::UpdateAI(), npc_ice_tomb::npc_ice_tombAI::UpdateAI(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::UpdateAI(), npc_valithria_cloud::npc_valithria_cloudAI::UpdateAI(), npc_blistering_zombie::npc_blistering_zombieAI::UpdateAI(), npc_impaling_spear::npc_impaling_spearAI::UpdateAI(), npc_vortex_ride::npc_vortex_rideAI::UpdateAI(), npc_power_spark::npc_power_sparkAI::UpdateAI(), npc_oculus_drake::npc_oculus_drakeAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_freya_lifebinder::boss_freya_lifebinderAI::UpdateAI(), boss_freya_healthy_spore::boss_freya_healthy_sporeAI::UpdateAI(), boss_freya_summons::boss_freya_summonsAI::UpdateAI(), boss_freya_nature_bomb::boss_freya_nature_bombAI::UpdateAI(), npc_ulduar_flash_freeze::npc_ulduar_flash_freezeAI::UpdateAI(), boss_kologarn_eyebeam::boss_kologarn_eyebeamAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_ulduar_magnetic_core::npc_ulduar_magnetic_coreAI::UpdateAI(), npc_ulduar_bot_summon_trigger::npc_ulduar_bot_summon_triggerAI::UpdateAI(), npc_ulduar_flames_initial::npc_ulduar_flames_initialAI::UpdateAI(), boss_thorim_sif::boss_thorim_sifAI::UpdateAI(), boss_skadi_grauf::boss_skadi_graufAI::UpdateAI(), npc_vh_teleportation_portal::npc_vh_teleportation_portalAI::UpdateAI(), npc_azure_saboteur::npc_azure_saboteurAI::UpdateAI(), npc_lurgglbr::npc_lurgglbrAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_preparations_for_war_vehicle::UpdateAI(), npc_minigob_manabonk::UpdateAI(), npc_hourglass_of_eternity::npc_hourglass_of_eternityAI::UpdateAI(), npc_wintergarde_gryphon::UpdateAI(), npc_wounded_skirmisher::UpdateAI(), npc_lake_frog::npc_lake_frogAI::UpdateAI(), npc_lord_arete::npc_lord_areteAI::UpdateAI(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), npc_blessed_banner::npc_blessed_bannerAI::UpdateAI(), npc_feedin_da_goolz::npc_feedin_da_goolzAI::UpdateAI(), npc_crusade_recruit::npc_crusade_recruitAI::UpdateAI(), npc_fel_guard_hound::npc_fel_guard_houndAI::UpdateAI(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::UpdateAI(), npc_pet_gen_target_following_bomb::UpdateAI(), npc_pet_gen_imp_in_a_bottle::UpdateAI(), npc_pet_gen_fetch_ball::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), npc_elder_clearwater::npc_elder_clearwaterAI::UpdateAI(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::UpdateAI(), npc_ichor_globule::npc_ichor_globuleAI::UpdateAI(), FollowerAI::UpdateAI(), npc_brunnhildar_prisoner::npc_brunnhildar_prisonerAI::UpdateAI(), SmartAI::UpdateDespawn(), npc_rinji::npc_rinjiAI::UpdateEscortAI(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI(), SmartAI::UpdatePath(), npc_daphne_stilwell::npc_daphne_stilwellAI::WaypointReached(), npc_apothecary_hanes::npc_Apothecary_HanesAI::WaypointReached(), and npc_plaguehound_tracker::npc_plaguehound_trackerAI::WaypointReached().

◆ DespawnOrUnsummon() [2/2]

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

References DespawnOrUnsummon().

Referenced by DespawnOrUnsummon().

◆ DisappearAndDie()

void Creature::DisappearAndDie ( )
372{
374 //SetVisibility(VISIBILITY_OFF);
375 //ObjectAccessor::UpdateObjectVisibility(this);
376 if (IsAlive())
377 setDeathState(DeathState::JustDied, true);
378 RemoveCorpse(false, true);
379}
void setDeathState(DeathState s, bool despawn=false) override
A creature can be in 4 different states: Alive, JustDied, Corpse, and JustRespawned....
Definition: Creature.cpp:1960
void RemoveCorpse(bool setSpawnTime=true, bool skipVisibility=false)
Definition: Creature.cpp:401
void DestroyForNearbyPlayers()
Definition: Object.cpp:2942

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

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

◆ DoFleeToGetAssistance()

void Creature::DoFleeToGetAssistance ( )
1054{
1055 if (!GetVictim())
1056 return;
1057
1059 return;
1060
1061 float radius = sWorld->getFloatConfig(CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS);
1062 if (radius > 0)
1063 {
1064 Creature* creature = nullptr;
1065
1068
1069 Cell::VisitGridObjects(this, searcher, radius);
1070
1072 UpdateSpeed(MOVE_RUN, false);
1073
1074 if (!creature)
1075 //SetFeared(true, GetVictim()->GetGUID(), 0, sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY));
1076 //TODO: use 31365
1078 else
1079 GetMotionMaster()->MoveSeekAssistance(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ());
1080 }
1081}
@ CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS
Definition: IWorld.h:202
@ UNIT_STATE_FLEEING
Definition: UnitDefines.h:156
@ MOVE_RUN
Definition: UnitDefines.h:329
@ SPELL_AURA_PREVENTS_FLEEING
Definition: SpellAuraDefines.h:155
void SetNoSearchAssistance(bool val)
Definition: Creature.h:269
MotionMaster * GetMotionMaster()
Definition: Unit.h:1601
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition: Unit.cpp:17990
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition: Unit.cpp:14207
Definition: GridNotifiers.h:458
Definition: GridNotifiers.h:1297
void MoveSeekAssistance(float x, float y, float z)
Definition: MotionMaster.cpp:703

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

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

◆ DoImmediateBoundaryCheck()

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

References m_boundaryCheckTime.

Referenced by CreatureAI::SetBoundary().

◆ FocusTarget()

void Creature::FocusTarget ( Spell const *  focusSpell,
WorldObject const *  target 
)
3539{
3540 // already focused
3541 if (_focusSpell)
3542 return;
3543
3544 _focusSpell = focusSpell;
3545
3546 SetGuidValue(UNIT_FIELD_TARGET, this == target ? ObjectGuid::Empty : target->GetGUID());
3547 if (focusSpell->GetSpellInfo()->HasAttribute(SPELL_ATTR5_AI_DOESNT_FACE_TARGET))
3549
3550 // Set serverside orientation if needed (needs to be after attribute check)
3551 if (this == target && (movespline->Finalized() || GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE))
3553 else
3554 SetInFront(target);
3555}
@ CHASE_MOTION_TYPE
Definition: MotionMaster.h:43
@ UNIT_STATE_ROTATING
Definition: UnitDefines.h:169
@ UNIT_FIELD_TARGET
Definition: UpdateFields.h:92
@ SPELL_ATTR5_AI_DOESNT_FACE_TARGET
Definition: SharedDefines.h:586
void SetGuidValue(uint16 index, ObjectGuid value)
Definition: Object.cpp:723
static ObjectGuid const Empty
Definition: ObjectGuid.h:120
float GetOrientation() const
Definition: Position.h:120
void SetFacingTo(float ori)
Definition: Unit.cpp:20483
Movement::MoveSpline * movespline
Definition: Unit.h:1818
void SetInFront(WorldObject const *target)
Definition: Unit.cpp:20477
bool Finalized() const
Definition: MoveSpline.h:116

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

Referenced by Spell::prepare().

◆ ForcedDespawn()

void Creature::ForcedDespawn ( uint32  timeMSToDespawn = 0,
Seconds  forcedRespawnTimer = 0s 
)
private
2150{
2151 if (timeMSToDespawn)
2152 {
2153 ForcedDespawnDelayEvent* pEvent = new ForcedDespawnDelayEvent(*this, forceRespawnTimer);
2154 m_Events.AddEvent(pEvent, m_Events.CalculateTime(timeMSToDespawn));
2155 return;
2156 }
2157
2158 if (IsAlive())
2159 setDeathState(DeathState::JustDied, true);
2160
2161 // Xinef: Set new respawn time, ignore corpse decay time...
2162 RemoveCorpse(true);
2163
2164 if (forceRespawnTimer > Seconds::zero())
2165 {
2166 if (GetMap())
2167 {
2168 GetMap()->ScheduleCreatureRespawn(GetGUID(), forceRespawnTimer);
2169 }
2170 }
2171}
Definition: Creature.h:539
void ScheduleCreatureRespawn(ObjectGuid, Milliseconds)
Definition: Map.cpp:3707

References EventProcessor::AddEvent(), EventProcessor::CalculateTime(), Object::GetGUID(), WorldObject::GetMap(), Unit::IsAlive(), Unit::m_Events, RemoveCorpse(), Map::ScheduleCreatureRespawn(), and setDeathState().

Referenced by DespawnOrUnsummon().

◆ GetAggroRange()

float Creature::GetAggroRange ( Unit const *  target) const
3379{
3380 // Determines the aggro range for creatures
3381 // Based on data from wowwiki due to lack of 3.3.5a data
3382
3383 float aggroRate = sWorld->getRate(RATE_CREATURE_AGGRO);
3384 if (aggroRate == 0)
3385 return 0.0f;
3386
3387 auto creatureLevel = target->getLevelForTarget(this);
3388 auto playerLevel = getLevelForTarget(target);
3389 int32 levelDiff = int32(creatureLevel) - int32(playerLevel);
3390
3391 // The maximum Aggro Radius is capped at 45 yards (25 level difference)
3392 if (levelDiff < -25)
3393 levelDiff = -25;
3394
3395 // The base aggro radius for mob of same level
3396 auto aggroRadius = GetDetectionRange();
3397 if (aggroRadius < 1)
3398 {
3399 return 0.0f;
3400 }
3401 // Aggro Radius varies with level difference at a rate of roughly 1 yard/level
3402 aggroRadius -= (float)levelDiff;
3403
3404 // detect range auras
3406
3407 // detected range auras
3408 aggroRadius += target->GetTotalAuraModifier(SPELL_AURA_MOD_DETECTED_RANGE);
3409
3410 // Just in case, we don't want pets running all over the map
3411 if (aggroRadius > MAX_AGGRO_RADIUS)
3412 aggroRadius = MAX_AGGRO_RADIUS;
3413
3414 // Minimum Aggro Radius for a mob seems to be combat range (5 yards)
3415 // hunter pets seem to ignore minimum aggro radius so we'll default it a little higher
3416 float minRange = IsPet() ? 10.0f : 5.0f;
3417 if (aggroRadius < minRange)
3418 aggroRadius = minRange;
3419
3420 return (aggroRadius * aggroRate);
3421}
@ RATE_CREATURE_AGGRO
Definition: IWorld.h:502
#define MAX_AGGRO_RADIUS
Definition: Unit.h:43
@ SPELL_AURA_MOD_DETECTED_RANGE
Definition: SpellAuraDefines.h:215
@ SPELL_AURA_MOD_DETECT_RANGE
Definition: SpellAuraDefines.h:154
uint8 getLevelForTarget(WorldObject const *target) const override
Definition: Creature.cpp:3015
int32 GetTotalAuraModifier(AuraType auratype) const
Definition: Unit.cpp:5881

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

Referenced by CanStartAttack().

◆ GetAIName()

std::string const & Creature::GetAIName ( ) const
3029{
3030 return sObjectMgr->GetCreatureTemplate(GetEntry())->AIName;
3031}
uint32 GetEntry() const
Definition: Object.h:112

References Object::GetEntry(), and sObjectMgr.

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

◆ GetAttackDistance()

float Creature::GetAttackDistance ( Unit const *  player) const
3584{
3585 float aggroRate = sWorld->getRate(RATE_CREATURE_AGGRO);
3586
3587 if (aggroRate == 0)
3588 return 0.0f;
3589
3590 if (!player)
3591 return 0.0f;
3592
3593 uint32 playerLevel = player->getLevelForTarget(this);
3594 uint32 creatureLevel = getLevelForTarget(player);
3595
3596 int32 levelDiff = static_cast<int32>(playerLevel) - static_cast<int32>(creatureLevel);
3597
3598 // "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."
3599 if (levelDiff < -25)
3600 levelDiff = -25;
3601
3602 // "The aggro radius of a mob having the same level as the player is roughly 20 yards"
3603 float retDistance = 20.0f;
3604
3605 // "Aggro Radius varies with level difference at a rate of roughly 1 yard/level"
3606 // radius grow if playlevel < creaturelevel
3607 retDistance -= static_cast<float>(levelDiff);
3608
3609 if (creatureLevel + 5 <= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
3610 {
3611 // detect range auras
3612 retDistance += static_cast<float>( GetTotalAuraModifier(SPELL_AURA_MOD_DETECT_RANGE));
3613
3614 // detected range auras
3615 retDistance += static_cast<float>( player->GetTotalAuraModifier(SPELL_AURA_MOD_DETECTED_RANGE));
3616 }
3617
3618 // "Minimum Aggro Radius for a mob seems to be combat range (5 yards)"
3619 if (retDistance < 5.0f)
3620 retDistance = 5.0f;
3621
3622 return (retDistance * aggroRate);
3623}
@ CONFIG_MAX_PLAYER_LEVEL
Definition: IWorld.h:240

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

Referenced by WorldObject::CanDetectStealthOf().

◆ GetCombatPulseDelay()

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

References m_combatPulseDelay.

◆ GetCorpseDelay()

uint32 Creature::GetCorpseDelay ( ) const
inline

◆ GetCreatureAddon()

CreatureAddon const * Creature::GetCreatureAddon ( ) const
2693{
2694 if (m_spawnId)
2695 {
2696 if (CreatureAddon const* addon = sObjectMgr->GetCreatureAddon(m_spawnId))
2697 return addon;
2698 }
2699
2700 // dependent from difficulty mode entry
2701 return sObjectMgr->GetCreatureTemplateAddon(GetCreatureTemplate()->Entry);
2702}
Definition: CreatureData.h:443

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

References m_creatureInfo.

Referenced by KillRewarder::_InitXP(), Unit::_IsValidAttackTarget(), AllLootRemovedFromCorpse(), Vehicle::ApplyAllImmunities(), Unit::ApplyDiminishingToDuration(), npc_escortAI::AssistPlayerInCombatAgainst(), FollowerAI::AssistPlayerInCombatAgainst(), SmartAI::AssistPlayerInCombatAgainst(), Unit::Attack(), Player::BuildPetTalentsInfoData(), CalculateMinMaxDamage(), SpellEffectInfo::CalcValue(), CanIgnoreFeignDeath(), Spell::CheckCast(), SpellInfo::CheckTarget(), Create(), Pet::CreateBaseAtCreature(), Unit::DealMeleeDamage(), boss_high_king_maulgar::DoAction(), Spell::DoSpellHitOnUnit(), Spell::EffectForceDeselect(), Spell::EffectSanctuary(), Spell::EffectSkinning(), Spell::EffectSummonType(), Acore::XP::Gain(), GetCreatureAddon(), Unit::GetCreatureType(), Player::GetDefaultGossipMenuForSource(), GetMovementTemplate(), GetNativeObjectScale(), Pet::GetNativeObjectScale(), Player::GetNPCIfCanInteractWith(), SmartScript::GetScript(), AuraEffect::HandleFeignDeath(), WorldSession::HandleGossipHelloOpcode(), learn_commandscript::HandleLearnAllMyPetTalentsCommand(), npc_commandscript::HandleNpcInfoCommand(), npc_commandscript::HandleNpcSetFactionIdCommand(), npc_commandscript::HandleNpcTameCommand(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), WorldSession::HandleQuestgiverHelloOpcode(), ArenaSpectator::HandleResetCommand(), WorldSession::HandleSellItemOpcode(), HasMechanicTemplateImmunity(), Pet::HaveInDiet(), InitEntry(), Pet::InitLevelupSpellsForLevel(), Guardian::InitStatsForLevel(), IsAvoidingAOE(), isCanTrainingAndResetTalentsOf(), IsCivilian(), isElite(), IsGuard(), Player::isHonorOrXPTarget(), IsImmunedToSpellEffect(), Unit::IsInPartyWith(), Unit::IsInRaidWith(), Pet::IsPermanentPetFor(), IsRacialLeader(), Unit::isSpellBlocked(), IsTrigger(), isWorldBoss(), npc_escortAI::JustRespawned(), FollowerAI::JustRespawned(), SmartAI::JustRespawned(), Unit::Kill(), Pet::LearnPetPassives(), Player::LearnPetTalent(), LoadCreatureFromDB(), Pet::LoadPetFromDB(), LoadSpellTemplateImmunity(), Unit::MeleeSpellHitResult(), boss_onyxia::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_hor_leader_second::npc_hor_leader_secondAI::MoveToNextStopPoint(), 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_nightbane::Reset(), boss_onyxia::Reset(), boss_sindragosa::boss_sindragosaAI::Reset(), Pet::resetTalents(), Respawn(), Player::RewardReputation(), Unit::RollMeleeOutcomeAgainst(), SaveToDB(), SelectLevel(), Player::SendLoot(), WorldSession::SendPetNameQuery(), WorldSession::SendTrainerList(), Unit::SetCharmedBy(), setDeathState(), SetDisplayFromModel(), npc_tirion_fordring_tft::npc_tirion_fordringAI::sGossipSelect(), npc_harrison_jones::npc_harrison_jonesAI::sGossipSelect(), npc_captured_rageclaw::npc_captured_rageclawAI::SpellHit(), boss_priestess_delrissa::SummonedCreatureDies(), Player::SummonPet(), npc_hor_lich_king::npc_hor_lich_kingAI::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(), UpdateMovementFlags(), Unit::UpdateSpeed(), and Player::UpdateWeaponSkill().

◆ GetCurrentEquipmentId()

◆ GetCurrentWaypointID()

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

References m_waypointID.

Referenced by npc_akama_illidan::MovementInform().

◆ GetDebugInfo()

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

Reimplemented from Object.

Reimplemented in TempSummon, Minion, Guardian, and Pet.

3848{
3849 std::stringstream sstr;
3850 sstr << Unit::GetDebugInfo() << "\n"
3851 << "AIName: " << GetAIName() << " ScriptName: " << GetScriptName()
3852 << " WaypointPath: " << GetWaypointPath() << " SpawnId: " << GetSpawnId();
3853 return sstr.str();
3854}
uint32 GetWaypointPath() const
Definition: Creature.h:347
ObjectGuid::LowType GetSpawnId() const
Definition: Creature.h:68
std::string GetScriptName() const
Definition: Creature.cpp:3033
std::string const & GetAIName() const
Definition: Creature.cpp:3028
std::string GetDebugInfo() const override
Definition: Unit.cpp:21270

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

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

◆ GetDefaultMovementType()

MovementGeneratorType Creature::GetDefaultMovementType ( ) const
inlineoverridevirtual

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

Reimplemented from Unit.

88{ return m_defaultMovementType; }

References m_defaultMovementType.

Referenced by LoadHelper(), and SaveToDB().

◆ GetDetectionRange()

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

References m_detectionDistance.

Referenced by CanCreatureAttack(), and GetAggroRange().

◆ GetFormation() [1/2]

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

References m_formation.

◆ GetFormation() [2/2]

◆ GetHomePosition() [1/2]

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

References m_homePosition.

Referenced by GetRespawnPosition().

◆ GetHomePosition() [2/2]

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

References Position::GetPosition(), and m_homePosition.

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

◆ GetLastLeashExtensionTime()

time_t Creature::GetLastLeashExtensionTime ( ) const
3696{
3698}
std::shared_ptr< time_t > const & GetLastLeashExtensionTimePtr() const
Definition: Creature.cpp:3678

References GetLastLeashExtensionTimePtr().

Referenced by CanCreatureAttack().

◆ GetLastLeashExtensionTimePtr()

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

◆ getLevelForTarget()

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

Reimplemented from WorldObject.

3016{
3017 if (!isWorldBoss() || !target->ToUnit())
3018 return Unit::getLevelForTarget(target);
3019
3020 uint16 level = target->ToUnit()->GetLevel() + sWorld->getIntConfig(CONFIG_WORLD_BOSS_LEVEL_DIFF);
3021 if (level < 1)
3022 return 1;
3023 if (level > 255)
3024 return 255;
3025 return uint8(level);
3026}
std::uint16_t uint16
Definition: Define.h:108
@ CONFIG_WORLD_BOSS_LEVEL_DIFF
Definition: IWorld.h:290
uint8 getLevelForTarget(WorldObject const *) const override
Definition: Unit.h:856

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
1309{
1311 return nullptr;
1312 return sGroupMgr->GetGroupByGUID(m_lootRecipientGroup);
1313}
#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.

167{ return m_meleeDamageSchoolMask; }

References m_meleeDamageSchoolMask.

Referenced by ThreatContainer::SelectNextVictim().

◆ GetMovementTemplate()

◆ GetNameForLocaleIdx()

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

Reimplemented from WorldObject.

3134{
3135 if (loc_idx != DEFAULT_LOCALE)
3136 {
3137 uint8 uloc_idx = uint8(loc_idx);
3138 CreatureLocale const* cl = sObjectMgr->GetCreatureLocale(GetEntry());
3139 if (cl)
3140 {
3141 if (cl->Name.size() > uloc_idx && !cl->Name[uloc_idx].empty())
3142 return cl->Name[uloc_idx];
3143 }
3144 }
3145
3146 return GetName();
3147}
#define DEFAULT_LOCALE
Definition: Common.h:79
Definition: CreatureData.h:346
std::vector< std::string > Name
Definition: CreatureData.h:347
std::string const & GetName() const
Definition: Object.h:458

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.

3482{
3484}
float DisplayScale
Definition: CreatureData.h:183
static CreatureModel const * ChooseDisplayId(CreatureTemplate const *cinfo, CreatureData const *data=nullptr)
Definition: ObjectMgr.cpp:1645

References ObjectMgr::ChooseDisplayId(), CreatureModel::DisplayScale, and GetCreatureTemplate().

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

◆ GetOriginalEntry()

uint32 Creature::GetOriginalEntry ( ) const
inline

◆ GetOriginalEquipmentId()

◆ GetPetAutoSpellOnPos()

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

Reimplemented in Pet.

323 {
325 return 0;
326 else
327 return m_charmInfo->GetCharmSpell(pos)->GetAction();
328 }
#define MAX_SPELL_CHARM
Definition: CharmInfo.h:23
@ ACT_ENABLED
Definition: CharmInfo.h:62
ActiveStates GetType() const
Definition: CharmInfo.h:99
uint32 GetAction() const
Definition: CharmInfo.h:100
CharmSpellInfo * GetCharmSpell(uint8 index)
Definition: CharmInfo.h:156
CharmInfo * m_charmInfo
Definition: Unit.h:1886

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.

321{ return MAX_SPELL_CHARM; }

References MAX_SPELL_CHARM.

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

◆ GetPlayerDamageReq()

uint32 Creature::GetPlayerDamageReq ( ) const
3811{
3812 return _playerDamageReq;
3813}

References _playerDamageReq.

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

◆ GetRandomId()

uint32 Creature::GetRandomId ( uint32  id1,
uint32  id2,
uint32  id3 
)
3723{
3724 uint32 id = id1;
3725 uint8 ids = 0;
3726
3727 if (id2)
3728 {
3729 ++ids;
3730 if (id3) ++ids;
3731 }
3732
3733 if (ids)
3734 {
3735 uint8 idNumber = urand(0, ids);
3736 switch (idNumber)
3737 {
3738 case 0:
3739 id = id1;
3740 break;
3741 case 1:
3742 id = id2;
3743 break;
3744 case 2:
3745 id = id3;
3746 break;
3747 }
3748 }
3749 return id;
3750}
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44

References urand().

Referenced by LoadCreatureFromDB(), and Respawn().

◆ GetReactState()

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

References m_reactState.

Referenced by boss_shade_of_aran::AttackStart(), boss_kiljaeden::boss_kiljaedenAI::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(), SmartAI::CanAIAttack(), boss_renataki::boss_renatakiAI::CanAlwaysBeDetectable(), boss_renataki::boss_renatakiAI::CanBeSeen(), boss_renataki::boss_renatakiAI::CanSeeAlways(), CharmInfo::CharmInfo(), Player::CharmSpellInitialize(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), boss_shade_of_aran::DamageTaken(), boss_brutallus::boss_brutallusAI::DamageTaken(), boss_kiljaeden::boss_kiljaedenAI::EnterEvadeMode(), Pet::FillPetInfo(), boss_ick::boss_ickAI::KilledUnit(), npc_chesspiece::OnCharmed(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::OwnerAttackedBy(), Player::PetSpellInitialize(), npc_imprisoned_beryl_sorcerer::npc_imprisoned_beryl_sorcererAI::Reset(), Pet::SavePetToDB(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), boss_viscidus::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), npc_gunship_boarding_leader::npc_gunship_boarding_leaderAI::UpdateAI(), npc_gunship_boarding_add::npc_gunship_boarding_add_realAI::UpdateAI(), npc_gunship_mage::npc_gunship_mageAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_lady_vashj::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
2936{
2937 if (m_spawnId)
2938 {
2939 if (CreatureData const* data = sObjectMgr->GetCreatureData(m_spawnId))
2940 {
2941 x = data->posX;
2942 y = data->posY;
2943 z = data->posZ;
2944 if (ori)
2945 *ori = data->orientation;
2946 if (dist)
2947 *dist = data->wander_distance;
2948
2949 return;
2950 }
2951 }
2952
2953 // xinef: changed this from current position to home position, fixes world summons with infinite duration
2954 if (GetTransport())
2955 {
2956 x = GetPositionX();
2957 y = GetPositionY();
2958 z = GetPositionZ();
2959 if (ori)
2960 *ori = GetOrientation();
2961 }
2962 else
2963 {
2965 x = homePos.GetPositionX();
2966 y = homePos.GetPositionY();
2967 z = homePos.GetPositionZ();
2968 if (ori)
2969 *ori = homePos.GetOrientation();
2970 }
2971 if (dist)
2972 *dist = 0;
2973}
Position const homePos
Definition: boss_chromaggus.cpp:71
Position const & GetHomePosition() const
Definition: Creature.h:340
Definition: CreatureData.h:373
Transport * GetTransport() const
Definition: Object.h:599
Definition: Position.h:28

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

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

◆ GetRespawnTime()

time_t const & Creature::GetRespawnTime ( ) const
inline

◆ GetRespawnTimeEx()

time_t Creature::GetRespawnTimeEx ( ) const
2926{
2927 time_t now = GameTime::GetGameTime().count();
2928
2929 if (m_respawnTime > now)
2930 return m_respawnTime;
2931 else
2932 return now;
2933}

References GameTime::GetGameTime(), and m_respawnTime.

Referenced by npc_commandscript::HandleNpcInfoCommand().

◆ GetScriptId()

◆ GetScriptName()

std::string Creature::GetScriptName ( ) const

◆ GetShieldBlockValue()

uint32 Creature::GetShieldBlockValue ( ) const
inlineoverridevirtual

Implements Unit.

163 {
164 return (GetLevel() / 2 + uint32(GetStat(STAT_STRENGTH) / 20));
165 }
@ STAT_STRENGTH
Definition: SharedDefines.h:258
float GetStat(Stats stat) const
Definition: Unit.h:859
uint8 GetLevel() const
Definition: Unit.h:855

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

◆ GetSpawnId()

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

References m_spawnId.

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

◆ GetSpellCooldown()

uint32 Creature::GetSpellCooldown ( uint32  spell_id) const
2902{
2903 CreatureSpellCooldowns::const_iterator itr = m_CreatureSpellCooldowns.find(spell_id);
2904 if (itr == m_CreatureSpellCooldowns.end())
2905 return 0;
2906
2907 return itr->second.end > GameTime::GetGameTimeMS().count() ? itr->second.end - GameTime::GetGameTimeMS().count() : 0;
2908}

References GameTime::GetGameTimeMS(), and m_CreatureSpellCooldowns.

◆ GetSpellDamageMod()

float Creature::GetSpellDamageMod ( int32  Rank)
1607{
1608 switch (Rank) // define rates for each elite rank
1609 {
1620 default:
1622 }
1623}
@ RATE_CREATURE_NORMAL_SPELLDAMAGE
Definition: IWorld.h:497
@ RATE_CREATURE_ELITE_ELITE_SPELLDAMAGE
Definition: IWorld.h:498
@ RATE_CREATURE_ELITE_RAREELITE_SPELLDAMAGE
Definition: IWorld.h:499
@ RATE_CREATURE_ELITE_WORLDBOSS_SPELLDAMAGE
Definition: IWorld.h:500
@ RATE_CREATURE_ELITE_RARE_SPELLDAMAGE
Definition: IWorld.h:501

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.

3839{
3840 if (TempSummon const* temp = ToTempSummon())
3841 return temp->GetSummonerGUID();
3842
3843 LOG_DEBUG("entities.unit", "Creature::GetSummonerGUID() called by creature that is not a summon. Creature: {} ({})", GetEntry(), GetName());
3844 return ObjectGuid::Empty;
3845}

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::npc_collapsing_starAI::JustSummoned(), and npc_algalon_worm_hole::npc_algalon_worm_holeAI::JustSummoned().

◆ GetTrainerSpells()

TrainerSpellData const * Creature::GetTrainerSpells ( ) const
3128{
3129 return sObjectMgr->GetNpcTrainerSpells(GetEntry());
3130}

References Object::GetEntry(), and sObjectMgr.

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

◆ GetTransportHomePosition() [1/2]

Position const & Creature::GetTransportHomePosition ( ) const
inline

◆ GetTransportHomePosition() [2/2]

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

◆ GetVendorItemCurrentCount()

uint32 Creature::GetVendorItemCurrentCount ( VendorItem const *  vItem)
3056{
3057 if (!vItem->maxcount)
3058 return vItem->maxcount;
3059
3060 VendorItemCounts::iterator itr = m_vendorItemCounts.begin();
3061 for (; itr != m_vendorItemCounts.end(); ++itr)
3062 if (itr->itemId == vItem->item)
3063 break;
3064
3065 if (itr == m_vendorItemCounts.end())
3066 return vItem->maxcount;
3067
3068 VendorItemCount* vCount = &*itr;
3069
3070 time_t ptime = GameTime::GetGameTime().count();
3071
3072 if (time_t(vCount->lastIncrementTime + vItem->incrtime) <= ptime)
3073 {
3074 ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(vItem->item);
3075
3076 uint32 diff = uint32((ptime - vCount->lastIncrementTime) / vItem->incrtime);
3077 if ((vCount->count + diff * pProto->BuyCount) >= vItem->maxcount)
3078 {
3079 m_vendorItemCounts.erase(itr);
3080 return vItem->maxcount;
3081 }
3082
3083 vCount->count += diff * pProto->BuyCount;
3084 vCount->lastIncrementTime = ptime;
3085 }
3086
3087 return vCount->count;
3088}
Definition: CreatureData.h:499
time_t lastIncrementTime
Definition: CreatureData.h:504
uint32 count
Definition: CreatureData.h:503
Definition: ItemTemplate.h:619
uint32 BuyCount
Definition: ItemTemplate.h:629

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
3051{
3052 return sObjectMgr->GetNpcVendorItemList(GetEntry());
3053}

References Object::GetEntry(), and sObjectMgr.

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

◆ GetWanderDistance()

float Creature::GetWanderDistance ( ) const
inline

◆ GetWaypointPath()

◆ hasInvolvedQuest()

bool Creature::hasInvolvedQuest ( uint32  quest_id) const
overridevirtual

Reimplemented from Object.

1827{
1828 QuestRelationBounds qir = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(GetEntry());
1829 for (QuestRelations::const_iterator itr = qir.first; itr != qir.second; ++itr)
1830 {
1831 if (itr->second == quest_id)
1832 return true;
1833 }
1834 return false;
1835}
std::pair< QuestRelations::const_iterator, QuestRelations::const_iterator > QuestRelationBounds
Definition: ObjectMgr.h:525

References Object::GetEntry(), and sObjectMgr.

◆ HasLootMode()

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

References m_LootMode.

◆ hasLootRecipient()

◆ HasMechanicTemplateImmunity()

bool Creature::HasMechanicTemplateImmunity ( uint32  mask) const
2210{
2212}
uint32 MechanicImmuneMask
Definition: CreatureData.h:247
bool IsPlayer() const
Definition: ObjectGuid.h:168
ObjectGuid GetOwnerGUID() const
Definition: Unit.h:1210

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

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

◆ hasQuest()

bool Creature::hasQuest ( uint32  quest_id) const
overridevirtual

Reimplemented from Object.

1816{
1817 QuestRelationBounds qr = sObjectMgr->GetCreatureQuestRelationBounds(GetEntry());
1818 for (QuestRelations::const_iterator itr = qr.first; itr != qr.second; ++itr)
1819 {
1820 if (itr->second == quest_id)
1821 return true;
1822 }
1823 return false;
1824}

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.

2917{
2918 uint8 i;
2919 for (i = 0; i < MAX_CREATURE_SPELLS; ++i)
2920 if (spellID == m_spells[i])
2921 break;
2922 return i < MAX_CREATURE_SPELLS; //broke before end of iteration of known spells
2923}

References m_spells, and MAX_CREATURE_SPELLS.

Referenced by WorldSession::HandleCastSpellOpcode().

◆ HasSpellCooldown()

bool Creature::HasSpellCooldown ( uint32  spell_id) const
overridevirtual

◆ HasSpellFocus()

bool Creature::HasSpellFocus ( Spell const *  focusSpell = nullptr) const
3558{
3559 if (isDead()) // dead creatures cannot focus
3560 {
3561 return false;
3562 }
3563
3564 return focusSpell ? (focusSpell == _spellFocusInfo.Spell) : (_spellFocusInfo.Spell || _spellFocusInfo.Delay);
3565}
struct Creature::@222 _spellFocusInfo
bool isDead() const
Definition: Unit.h:1206

References _spellFocusInfo, and Unit::isDead().

Referenced by IsMovementPreventedByCasting().

◆ HasSwimmingFlagOutOfCombat()

bool Creature::HasSwimmingFlagOutOfCombat ( ) const
inline

◆ InitEntry()

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

change the entry of creature until respawn

440{
441 CreatureTemplate const* normalInfo = sObjectMgr->GetCreatureTemplate(Entry);
442 if (!normalInfo)
443 {
444 LOG_ERROR("sql.sql", "Creature::InitEntry creature entry {} does not exist.", Entry);
445 return false;
446 }
447
448 // get difficulty 1 mode entry
449 // Xinef: Skip for pets!
450 CreatureTemplate const* cinfo = normalInfo;
451 for (uint8 diff = uint8(GetMap()->GetSpawnMode()); diff > 0 && !IsPet();)
452 {
453 // we already have valid Map pointer for current creature!
454 if (normalInfo->DifficultyEntry[diff - 1])
455 {
456 cinfo = sObjectMgr->GetCreatureTemplate(normalInfo->DifficultyEntry[diff - 1]);
457 if (cinfo)
458 break; // template found
459
460 // check and reported at startup, so just ignore (restore normalInfo)
461 cinfo = normalInfo;
462 }
463
464 // for instances heroic to normal, other cases attempt to retrieve previous difficulty
465 if (diff >= RAID_DIFFICULTY_10MAN_HEROIC && GetMap()->IsRaid())
466 diff -= 2; // to normal raid difficulty cases
467 else
468 --diff;
469 }
470
471 SetEntry(Entry); // normal entry always
472 m_creatureInfo = cinfo; // map mode related always
473
474 // equal to player Race field, but creature does not have race
476
477 // known valid are: CLASS_WARRIOR, CLASS_PALADIN, CLASS_ROGUE, CLASS_MAGE
479
480 // Cancel load if no model defined
481 if (!(cinfo->GetFirstValidModel()))
482 {
483 LOG_ERROR("sql.sql", "Creature (Entry: {}) has no model defined in table `creature_template_model`, can't load. ", Entry);
484 return false;
485 }
486
487 CreatureModel model = *ObjectMgr::ChooseDisplayId(cinfo, data);
488 CreatureModelInfo const* mInfo = sObjectMgr->GetCreatureModelRandomGender(&model, cinfo);
489 if (!mInfo) // Cancel load if no model defined
490 {
491 LOG_ERROR("sql.sql", "Creature (Entry: {}) has no model {} defined in table `creature_template_model`, can't load. ", Entry, model.CreatureDisplayID);
492 return false;
493 }
494
497
498 // Load creature equipment
499 if (!data)
500 {
501 LoadEquipment(); // use default from the template
502 }
503 else if (data->equipmentId == 0)
504 {
505 LoadEquipment(0); // 0 means no equipment for creature table
506 }
507 else
508 {
511 }
512
513 SetName(normalInfo->Name); // at normal entry always
514
516
518 SetSpeed(MOVE_RUN, cinfo->speed_run);
521
522 // Will set UNIT_FIELD_BOUNDINGRADIUS and UNIT_FIELD_COMBATREACH
524
526
527 // checked at loading
531
532 for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
534
535 return true;
536}
MovementGeneratorType
Definition: MotionMaster.h:36
@ RANDOM_MOTION_TYPE
Definition: MotionMaster.h:38
@ MOVE_FLIGHT
Definition: UnitDefines.h:334
@ MOVE_SWIM
Definition: UnitDefines.h:331
@ MOVE_WALK
Definition: UnitDefines.h:328
@ UNIT_FIELD_BYTES_0
Definition: UpdateFields.h:95
@ UNIT_MOD_CAST_SPEED
Definition: UpdateFields.h:137
@ UNIT_FIELD_HOVERHEIGHT
Definition: UpdateFields.h:173
void SetObjectScale(float scale) override
Definition: Creature.cpp:3486
void LoadEquipment(int8 id=1, bool force=false)
Definition: Creature.cpp:1793
uint32 CreatureDisplayID
Definition: CreatureData.h:182
float speed_run
Definition: CreatureData.h:204
std::string Name
Definition: CreatureData.h:194
uint32 spells[MAX_CREATURE_SPELLS]
Definition: CreatureData.h:231
CreatureModel const * GetFirstValidModel() const
Definition: Creature.cpp:144
float speed_swim
Definition: CreatureData.h:205
uint32 MovementType
Definition: CreatureData.h:237
uint32 unit_class
Definition: CreatureData.h:216
float speed_walk
Definition: CreatureData.h:203
float HoverHeight
Definition: CreatureData.h:239
float speed_flight
Definition: CreatureData.h:206
int8 equipmentId
Definition: CreatureData.h:381
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition: Object.cpp:750
void SetFloatValue(uint16 index, float value)
Definition: Object.cpp:737
void SetEntry(uint32 entry)
Definition: Object.h:113
void SetName(std::string const &newname)
Definition: Object.h:459
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition: Unit.cpp:14383

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

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

◆ InitializeReactState()

void Creature::InitializeReactState ( )

Check if the creature has the specified ReactState.

2202{
2203 if ((IsTotem() || IsTrigger() || IsCritter() || IsSpiritService()) && GetAIName() != "SmartAI" && !GetScriptId())
2205 else
2207}
@ REACT_PASSIVE
Definition: Unit.h:548
bool IsTrigger() const
Definition: Creature.h:78
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition: Creature.h:97
bool IsCritter() const
Definition: Unit.h:1094
bool IsSpiritService() const
Definition: Unit.h:737

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.

1889{
1891 {
1892 return true;
1893 }
1894
1895 if (IsAIEnabled && AI()->CanAlwaysBeDetectable(seer))
1896 {
1897 return true;
1898 }
1899
1900 return false;
1901}
bool IsAlwaysDetectableFor(WorldObject const *seer) const override
Definition: Unit.cpp:14171

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

◆ IsAvoidingAOE()

◆ isCanInteractWithBattleMaster()

bool Creature::isCanInteractWithBattleMaster ( Player player,
bool  msg 
) const
1213{
1214 if (!IsBattleMaster())
1215 return false;
1216
1217 BattlegroundTypeId bgTypeId = sBattlegroundMgr->GetBattleMasterBG(GetEntry());
1218 if (!msg)
1219 return player->GetBGAccessByLevel(bgTypeId);
1220
1221 if (!player->GetBGAccessByLevel(bgTypeId))
1222 {
1223 ClearGossipMenuFor(player);
1224 switch (bgTypeId)
1225 {
1226 case BATTLEGROUND_AV:
1227 SendGossipMenuFor(player, 7616, this);
1228 break;
1229 case BATTLEGROUND_WS:
1230 SendGossipMenuFor(player, 7599, this);
1231 break;
1232 case BATTLEGROUND_AB:
1233 SendGossipMenuFor(player, 7642, this);
1234 break;
1235 case BATTLEGROUND_EY:
1236 case BATTLEGROUND_NA:
1237 case BATTLEGROUND_BE:
1238 case BATTLEGROUND_AA:
1239 case BATTLEGROUND_RL:
1240 case BATTLEGROUND_SA:
1241 case BATTLEGROUND_DS:
1242 case BATTLEGROUND_RV:
1243 SendGossipMenuFor(player, 10024, this);
1244 break;
1245 default:
1246 break;
1247 }
1248 return false;
1249 }
1250 return true;
1251}
#define sBattlegroundMgr
Definition: BattlegroundMgr.h:188
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:3479
@ BATTLEGROUND_AA
Definition: SharedDefines.h:3486
@ BATTLEGROUND_WS
Definition: SharedDefines.h:3482
@ BATTLEGROUND_EY
Definition: SharedDefines.h:3487
@ BATTLEGROUND_AV
Definition: SharedDefines.h:3481
@ BATTLEGROUND_BE
Definition: SharedDefines.h:3485
@ BATTLEGROUND_RV
Definition: SharedDefines.h:3491
@ BATTLEGROUND_NA
Definition: SharedDefines.h:3484
@ BATTLEGROUND_DS
Definition: SharedDefines.h:3490
@ BATTLEGROUND_SA
Definition: SharedDefines.h:3489
@ BATTLEGROUND_AB
Definition: SharedDefines.h:3483
@ BATTLEGROUND_RL
Definition: SharedDefines.h:3488
bool GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const
Definition: Player.cpp:12314
bool IsBattleMaster() const
Definition: Unit.h:722

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

◆ isCanTrainingAndResetTalentsOf()

bool Creature::isCanTrainingAndResetTalentsOf ( Player player) const
1254{
1255 return player->GetLevel() >= 10
1257 && player->IsClass((Classes)GetCreatureTemplate()->trainer_class, CLASS_CONTEXT_CLASS_TRAINER);
1258}
@ CLASS_CONTEXT_CLASS_TRAINER
Definition: UnitDefines.h:222
Classes
Definition: SharedDefines.h:139
@ TRAINER_TYPE_CLASS
Definition: SharedDefines.h:2617
uint32 trainer_type
Definition: CreatureData.h:221
bool IsClass(Classes playerClass, ClassContext context=CLASS_CONTEXT_NONE) const override
Definition: Player.cpp:1280

References CLASS_CONTEXT_CLASS_TRAINER, GetCreatureTemplate(), Unit::GetLevel(), Player::IsClass(), CreatureTemplate::trainer_type, and TRAINER_TYPE_CLASS.

Referenced by WorldSession::HandleTalentWipeConfirmOpcode().

◆ 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:209

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

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

◆ IsEvadingAttacks()

bool Creature::IsEvadingAttacks ( ) const
inline

◆ IsFreeToMove()

bool Creature::IsFreeToMove ( )
933{
935 // Do not reposition ourself when we are not allowed to move
937 (GetMotionMaster()->GetCurrentMovementGeneratorType() != CHASE_MOTION_TYPE ||
938 moveFlags & MOVEMENTFLAG_SPLINE_ENABLED))
939 {
940 return false;
941 }
942
943 return true;
944}
@ MOVEMENTFLAG_SPLINE_ENABLED
Definition: UnitDefines.h:371
bool IsCombatMovementAllowed() const
Definition: Creature.h:427
bool IsMovementPreventedByCasting() const override
Definition: Creature.cpp:3625
uint32 GetMovementFlags() const
Definition: Object.h:330
MovementInfo m_movementInfo
Definition: Object.h:609
bool CanFreeMove() const
Definition: Unit.h:938
bool isMoving() const
Definition: Unit.h:1696

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

◆ IsImmunedToSpell()

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

Reimplemented from Unit.

2245{
2246 if (!spellInfo)
2247 return false;
2248
2249 if (spellInfo->HasAttribute(SPELL_ATTR0_CU_BYPASS_MECHANIC_IMMUNITY))
2250 {
2251 return false;
2252 }
2253
2254 // Xinef: this should exclude self casts...
2255 // Spells that don't have effectMechanics.
2256 if (spellInfo->Mechanic > MECHANIC_NONE && HasMechanicTemplateImmunity(1 << (spellInfo->Mechanic - 1)))
2257 return true;
2258
2259 // This check must be done instead of 'if (GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1)))' for not break
2260 // the check of mechanic immunity on DB (tested) because GetCreatureTemplate()->MechanicImmuneMask and m_spellImmune[IMMUNITY_MECHANIC] don't have same data.
2261 bool immunedToAllEffects = true;
2262 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
2263 if (spellInfo->Effects[i].IsEffect() && !IsImmunedToSpellEffect(spellInfo, i))
2264 {
2265 immunedToAllEffects = false;
2266 break;
2267 }
2268 if (immunedToAllEffects)
2269 return true;
2270
2271 return Unit::IsImmunedToSpell(spellInfo, spell);
2272}
@ SPELL_ATTR0_CU_BYPASS_MECHANIC_IMMUNITY
Definition: SpellInfo.h:208
@ MECHANIC_NONE
Definition: SharedDefines.h:1325
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1637
bool HasMechanicTemplateImmunity(uint32 mask) const
Definition: Creature.cpp:2209
bool IsImmunedToSpellEffect(SpellInfo const *spellInfo, uint32 index) const override
Definition: Creature.cpp:2274
virtual bool IsImmunedToSpell(SpellInfo const *spellInfo, Spell const *spell=nullptr)
Definition: Unit.cpp:12873

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 
) const
overridevirtual

Reimplemented from Unit.

Reimplemented in Totem.

2275{
2276 // Xinef: this should exclude self casts...
2277 if (spellInfo->Effects[index].Mechanic > MECHANIC_NONE && HasMechanicTemplateImmunity(1 << (spellInfo->Effects[index].Mechanic - 1)))
2278 return true;
2279
2280 if (GetCreatureTemplate()->type == CREATURE_TYPE_MECHANICAL && spellInfo->Effects[index].Effect == SPELL_EFFECT_HEAL)
2281 return true;
2282
2283 return Unit::IsImmunedToSpellEffect(spellInfo, index);
2284}
@ SPELL_EFFECT_HEAL
Definition: SharedDefines.h:788
@ CREATURE_TYPE_MECHANICAL
Definition: SharedDefines.h:2636
virtual bool IsImmunedToSpellEffect(SpellInfo const *spellInfo, uint32 index) const
Definition: Unit.cpp:12963

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

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

◆ IsImmuneToKnockback()

bool Creature::IsImmuneToKnockback ( ) const
3167{
3168 if (GetOwnerGUID().IsPlayer())
3169 return false;
3170
3171 CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(GetEntry());
3172 return cinfo && (cinfo->flags_extra & CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK);
3173}
@ CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK
Definition: CreatureData.h:76

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

◆ IsInEvadeMode()

◆ IsInvisibleDueToDespawn()

bool Creature::IsInvisibleDueToDespawn ( ) const
overrideprotectedvirtual

Reimplemented from WorldObject.

1870{
1872 return true;
1873
1875 return false;
1876
1877 return true;
1878}
virtual bool IsInvisibleDueToDespawn() const
Definition: Object.h:664

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

◆ IsMoveInLineOfSightDisabled()

bool Creature::IsMoveInLineOfSightDisabled ( )
inline

◆ IsMoveInLineOfSightStrictlyDisabled()

bool Creature::IsMoveInLineOfSightStrictlyDisabled ( )
inline

◆ IsMovementPreventedByCasting()

bool Creature::IsMovementPreventedByCasting ( ) const
overridevirtual

Reimplemented from Unit.

3626{
3628 // first check if currently a movement allowed channel is active and we're not casting
3629 if (spell && spell->getState() != SPELL_STATE_FINISHED && spell->IsChannelActive() && spell->GetSpellInfo()->IsActionAllowedChannel())
3630 {
3631 return false;
3632 }
3633
3634 if (HasSpellFocus())
3635 {
3636 return true;
3637 }
3638
3640 {
3641 return true;
3642 }
3643
3644 return false;
3645}
@ CURRENT_CHANNELED_SPELL
Definition: Unit.h:539
@ UNIT_STATE_CASTING
Definition: UnitDefines.h:164
@ SPELL_STATE_FINISHED
Definition: Spell.h:226
bool HasSpellFocus(Spell const *focusSpell=nullptr) const
Definition: Creature.cpp:3557
Spell * m_currentSpells[CURRENT_MAX_SPELL]
Definition: Unit.h:1865
Definition: Spell.h:284
SpellInfo const * GetSpellInfo() const
Definition: Spell.h:575
uint32 getState() const
Definition: Spell.h:482
bool IsChannelActive() const
Definition: Spell.h:554
bool IsActionAllowedChannel() const
Definition: SpellInfo.cpp:1260

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

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

◆ IsNotReachableAndNeedRegen()

bool Creature::IsNotReachableAndNeedRegen ( ) const
3669{
3670 if (CanNotReachTarget())
3671 {
3673 }
3674
3675 return false;
3676}
constexpr auto IN_MILLISECONDS
Definition: Common.h:53
@ CONFIG_NPC_REGEN_TIME_IF_NOT_REACHABLE_IN_RAID
Definition: IWorld.h:417

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

Referenced by Update().

◆ IsRacialLeader()

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

References GetCreatureTemplate(), and CreatureTemplate::RacialLeader.

Referenced by Player::RewardHonor().

◆ isRegeneratingHealth()

bool Creature::isRegeneratingHealth ( )
inline

◆ IsReputationGainDisabled()

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

References DisableReputationGain.

Referenced by Player::RewardReputation().

◆ IsRooted()

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

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

Referenced by SetDisableGravity(), SetHover(), and UpdateEntry().

◆ IsSpellProhibited()

bool Creature::IsSpellProhibited ( SpellSchoolMask  idSchoolMask) const
2824{
2825 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
2826 {
2827 if (idSchoolMask & (1 << i))
2828 {
2830 {
2831 return true;
2832 }
2833 }
2834 }
2835
2836 return false;
2837}

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

Referenced by CanCastSpell(), and Spell::CheckCast().

◆ isTappedBy()

bool Creature::isTappedBy ( Player const *  player) const
1377{
1378 if (player->GetGUID() == m_lootRecipient)
1379 return true;
1380
1381 Group const* playerGroup = player->GetGroup();
1382 if (!playerGroup || playerGroup != GetLootRecipientGroup()) // if we dont have a group we arent the recipient
1383 return false; // if creature doesnt have group bound it means it was solo killed by someone else
1384
1385 return true;
1386}
Group * GetLootRecipientGroup() const
Definition: Creature.cpp:1308
Definition: Group.h:169

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

Referenced by Unit::PatchValuesUpdate().

◆ IsTrigger()

◆ IsValidTrainerForPlayer()

bool Creature::IsValidTrainerForPlayer ( Player player,
uint32 npcFlags = nullptr 
) const
1261{
1262 if (!IsTrainer())
1263 {
1264 return false;
1265 }
1266
1268 {
1269 case TRAINER_TYPE_CLASS:
1270 case TRAINER_TYPE_PETS:
1272 {
1273 if (npcFlags)
1274 *npcFlags &= ~UNIT_NPC_FLAG_TRAINER_CLASS;
1275
1276 return false;
1277 }
1278 break;
1281 {
1282 return false;
1283 }
1284 break;
1287 {
1288 if (npcFlags)
1289 *npcFlags &= ~UNIT_NPC_FLAG_TRAINER_PROFESSION;
1290
1291 return false;
1292 }
1293 break;
1294 default:
1295 break;
1296 }
1297
1298 return true;
1299}
@ TRAINER_TYPE_TRADESKILLS
Definition: SharedDefines.h:2619
@ TRAINER_TYPE_PETS
Definition: SharedDefines.h:2620
@ TRAINER_TYPE_MOUNTS
Definition: SharedDefines.h:2618
uint32 trainer_spell
Definition: CreatureData.h:222
uint32 trainer_class
Definition: CreatureData.h:223
uint32 trainer_race
Definition: CreatureData.h:224
bool HasSpell(uint32 spell) const override
Definition: Player.cpp:3859
bool IsTrainer() const
Definition: Unit.h:717
uint8 getRace(bool original=false) const
Definition: Unit.cpp:20962

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

Referenced by Unit::PatchValuesUpdate().

◆ isVendorWithIconSpeak()

bool Creature::isVendorWithIconSpeak ( ) const
1683{
1685}
@ UNIT_NPC_FLAG_VENDOR
Definition: UnitDefines.h:301
std::string IconName
Definition: CreatureData.h:196
uint32 npcflag
Definition: CreatureData.h:393

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 
)
1688{
1689 if (!allowDuplicate)
1690 {
1691 // If an alive instance of this spawnId is already found, skip creation
1692 // If only dead instance(s) exist, despawn them and spawn a new (maybe also dead) version
1693 const auto creatureBounds = map->GetCreatureBySpawnIdStore().equal_range(spawnId);
1694 std::vector <Creature*> despawnList;
1695
1696 if (creatureBounds.first != creatureBounds.second)
1697 {
1698 for (auto itr = creatureBounds.first; itr != creatureBounds.second; ++itr)
1699 {
1700 if (itr->second->IsAlive())
1701 {
1702 LOG_DEBUG("maps", "Would have spawned {} but {} already exists", spawnId, creatureBounds.first->second->GetGUID().ToString());
1703 return false;
1704 }
1705 else
1706 {
1707 despawnList.push_back(itr->second);
1708 LOG_DEBUG("maps", "Despawned dead instance of spawn {} ({})", spawnId, itr->second->GetGUID().ToString());
1709 }
1710 }
1711
1712 for (Creature* despawnCreature : despawnList)
1713 {
1714 despawnCreature->AddObjectToRemoveList();
1715 }
1716 }
1717 }
1718
1719 CreatureData const* data = sObjectMgr->GetCreatureData(spawnId);
1720 if (!data)
1721 {
1722 LOG_ERROR("sql.sql", "Creature (SpawnId: {}) not found in table `creature`, can't load. ", spawnId);
1723 return false;
1724 }
1725
1726 // xinef: this has to be assigned before Create function, properly loads equipment id from DB
1727 m_creatureData = data;
1728 m_spawnId = spawnId;
1729
1730 // Add to world
1731 uint32 entry = GetRandomId(data->id1, data->id2, data->id3);
1732
1733 if (!Create(map->GenerateLowGuid<HighGuid::Unit>(), map, data->phaseMask, entry, 0, data->posX, data->posY, data->posZ, data->orientation, data))
1734 return false;
1735
1736 //We should set first home position, because then AI calls home movement
1737 SetHomePosition(data->posX, data->posY, data->posZ, data->orientation);
1738
1740
1742 m_deathState = DeathState::Alive;
1743
1745 if (m_respawnTime) // respawn on Update
1746 {
1747 m_deathState = DeathState::Dead;
1748 if (CanFly())
1749 {
1750 float tz = map->GetHeight(GetPhaseMask(), data->posX, data->posY, data->posZ, true, MAX_FALL_DISTANCE);
1751 if (data->posZ - tz > 0.1f && Acore::IsValidMapCoord(tz))
1752 {
1753 Relocate(data->posX, data->posY, tz);
1754 }
1755 }
1756 }
1757
1758 uint32 curhealth;
1759
1760 if (!m_regenHealth)
1761 {
1762 curhealth = data->curhealth;
1763 if (curhealth)
1764 {
1765 curhealth = uint32(curhealth * _GetHealthMod(GetCreatureTemplate()->rank));
1766 if (curhealth < 1)
1767 curhealth = 1;
1768 }
1769 SetPower(POWER_MANA, data->curmana);
1770 }
1771 else
1772 {
1773 curhealth = GetMaxHealth();
1775 }
1776
1777 SetHealth(m_deathState == DeathState::Alive ? curhealth : 0);
1778
1779 // checked at creature_template loading
1781
1782 if (addToMap && !GetMap()->AddToMap(this))
1783 return false;
1784 return true;
1785}
#define MAX_FALL_DISTANCE
Definition: Map.h:166
@ POWER_MANA
Definition: SharedDefines.h:269
bool IsValidMapCoord(float c)
Definition: GridDefines.h:216
void SetHomePosition(float x, float y, float z, float o)
Definition: Creature.h:337
static float _GetHealthMod(int32 Rank)
Definition: Creature.cpp:1568
bool Create(ObjectGuid::LowType guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 vehId, float x, float y, float z, float ang, const CreatureData *data=nullptr)
Definition: Creature.cpp:1123
uint32 GetRandomId(uint32 id1, uint32 id2, uint32 id3)
Definition: Creature.cpp:3722
float wander_distance
Definition: CreatureData.h:387
uint32 phaseMask
Definition: CreatureData.h:379
uint32 spawntimesecs
Definition: CreatureData.h:386
uint8 movementType
Definition: CreatureData.h:391
uint32 id2
Definition: CreatureData.h:376
uint32 curhealth
Definition: CreatureData.h:389
float orientation
Definition: CreatureData.h:385
uint32 curmana
Definition: CreatureData.h:390
uint32 id3
Definition: CreatureData.h:377
float posY
Definition: CreatureData.h:383
float posX
Definition: CreatureData.h:382
float posZ
Definition: CreatureData.h:384
uint32 id1
Definition: CreatureData.h:375
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition: Unit.cpp:15521
uint32 GetMaxHealth() const
Definition: Unit.h:870
DeathState m_deathState
Definition: Unit.h:1854
void SetHealth(uint32 val)
Definition: Unit.cpp:15433
uint32 GetMaxPower(Powers power) const
Definition: Unit.h:892
float GetHeight(float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
Definition: Map.cpp:2040
time_t GetCreatureRespawnTime(ObjectGuid::LowType dbGuid) const
Definition: Map.h:573
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:638

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

Referenced by ObjectMgr::AddCreData(), MotionTransport::CreateNPCPassenger(), GameEventMgr::GameEventSpawn(), npc_commandscript::HandleNpcAddCommand(), wp_commandscript::HandleWpModifyCommand(), wp_commandscript::HandleWpShowCommand(), LoadFromDB(), PoolGroup< T >::Spawn1Object(), 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.

2706{
2707 CreatureAddon const* cainfo = GetCreatureAddon();
2708 if (!cainfo)
2709 return false;
2710
2711 if (cainfo->mount != 0)
2712 Mount(cainfo->mount);
2713
2714 if (cainfo->bytes1 != 0)
2715 {
2716 // 0 StandState
2717 // 1 FreeTalentPoints Pet only, so always 0 for default creature
2718 // 2 StandFlags
2719 // 3 StandMiscFlags
2720
2722 //SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_PET_TALENTS, uint8((cainfo->bytes1 >> 8) & 0xFF));
2726
2732 if (CanHover())
2734 }
2735
2736 if (cainfo->bytes2 != 0)
2737 {
2738 // 0 SheathState
2739 // 1 Bytes2Flags
2740 // 2 UnitRename Pet only, so always 0 for default creature
2741 // 3 ShapeshiftForm Must be determined/set by shapeshift spell/aura
2742
2743 SetByteValue(UNIT_FIELD_BYTES_2, 0, uint8(cainfo->bytes2 & 0xFF));
2744 //SetByteValue(UNIT_FIELD_BYTES_2, 1, uint8((cainfo->bytes2 >> 8) & 0xFF));
2745 //SetByteValue(UNIT_FIELD_BYTES_2, 2, uint8((cainfo->bytes2 >> 16) & 0xFF));
2747 //SetByteValue(UNIT_FIELD_BYTES_2, 3, uint8((cainfo->bytes2 >> 24) & 0xFF));
2749 }
2750
2752
2753 // Check if visibility distance different
2754 if (cainfo->visibilityDistanceType != VisibilityDistanceType::Normal)
2755 {
2757 }
2758
2759 //Load Path
2760 if (cainfo->path_id != 0)
2761 {
2763 setActive(true);
2764 m_path_id = cainfo->path_id;
2765 }
2766
2767 if (!cainfo->auras.empty())
2768 {
2769 for (std::vector<uint32>::const_iterator itr = cainfo->auras.begin(); itr != cainfo->auras.end(); ++itr)
2770 {
2771 SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(*itr);
2772 if (!AdditionalSpellInfo)
2773 {
2774 LOG_ERROR("sql.sql", "Creature ({}) has wrong spell {} defined in `auras` field.", GetGUID().ToString(), *itr);
2775 continue;
2776 }
2777
2778 // skip already applied aura
2779 if (HasAura(*itr))
2780 {
2781 if (!reload)
2782 LOG_ERROR("sql.sql", "Creature ({}) has duplicate aura (spell {}) in `auras` field.", GetGUID().ToString(), *itr);
2783
2784 continue;
2785 }
2786
2787 AddAura(*itr, this);
2788 LOG_DEBUG("entities.unit", "Spell: {} added to creature ({})", *itr, GetGUID().ToString());
2789 }
2790 }
2791
2792 return true;
2793}
@ CONFIG_SET_ALL_CREATURES_WITH_WAYPOINT_MOVEMENT_ACTIVE
Definition: IWorld.h:167
@ MOVEMENTFLAG_HOVER
Definition: UnitDefines.h:374
@ UNIT_BYTES_1_OFFSET_ANIM_TIER
Definition: UnitDefines.h:26
@ UNIT_BYTES_1_OFFSET_PET_TALENTS
Definition: UnitDefines.h:24
@ UNIT_BYTES_1_OFFSET_STAND_STATE
Definition: UnitDefines.h:23
@ UNIT_BYTES_1_OFFSET_VIS_FLAG
Definition: UnitDefines.h:25
@ 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:85
CreatureAddon const * GetCreatureAddon() const
Definition: Creature.cpp:2692
std::vector< uint32 > auras
Definition: CreatureData.h:449
uint32 mount
Definition: CreatureData.h:445
uint32 emote
Definition: CreatureData.h:448
uint32 path_id
Definition: CreatureData.h:444
VisibilityDistanceType visibilityDistanceType
Definition: CreatureData.h:450
uint32 bytes1
Definition: CreatureData.h:446
uint32 bytes2
Definition: CreatureData.h:447
void setActive(bool isActiveObject)
Definition: Object.cpp:1085
void SetVisibilityDistanceOverride(VisibilityDistanceType type)
Definition: Object.cpp:1122
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:18819
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5669
void Mount(uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
Definition: Unit.cpp:13422
void AddUnitMovementFlag(uint32 f)
Definition: Unit.h:1611
void SetUInt32Value(uint16 index, uint32 value)
Definition: Unit.cpp:21256

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

Referenced by CreatureAI::_EnterEvadeMode(), Create(), HomeMovementGenerator< Creature >::DoFinalize(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode(), npc_pet_hunter_snake_trap::EnterEvadeMode(), 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 
)
1794{
1795 if (id == 0)
1796 {
1797 if (force)
1798 {
1799 for (uint8 i = 0; i < MAX_EQUIPMENT_ITEMS; ++i)
1801 m_equipmentId = 0;
1802 }
1803 return;
1804 }
1805
1806 EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(GetEntry(), id);
1807 if (!einfo)
1808 return;
1809
1810 m_equipmentId = id;
1811 for (uint8 i = 0; i < 3; ++i)
1813}
@ UNIT_VIRTUAL_ITEM_SLOT_ID
Definition: UpdateFields.h:116
#define MAX_EQUIPMENT_ITEMS
Definition: CreatureData.h:36
Definition: CreatureData.h:363
uint32 ItemEntry[MAX_EQUIPMENT_ITEMS]
Definition: CreatureData.h:364

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_unworthy_initiate::npc_unworthy_initiateAI::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(), npc_unworthy_initiate::npc_unworthy_initiateAI::Reset(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::Reset(), boss_thekal::Reset(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::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::npc_forest_frogAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI(), and npc_koltira_deathweaver::npc_koltira_deathweaverAI::WaypointReached().

◆ LoadFromDB()

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

References LoadCreatureFromDB().

Referenced by LoadHelper().

◆ LoadPath()

◆ LoadSpellTemplateImmunity()

void Creature::LoadSpellTemplateImmunity ( )
2215{
2216 // uint32 max used for "spell id", the immunity system will not perform SpellInfo checks against invalid spells
2217 // used so we know which immunities were loaded from template
2218 static uint32 const placeholderSpellId = std::numeric_limits<uint32>::max();
2219
2220 // unapply template immunities (in case we're updating entry)
2221 for (uint8 i = SPELL_SCHOOL_NORMAL; i <= SPELL_SCHOOL_ARCANE; ++i)
2222 {
2223 ApplySpellImmune(placeholderSpellId, IMMUNITY_SCHOOL, i, false);
2224 }
2225
2226 // don't inherit immunities for hunter pets
2227 if (GetOwnerGUID().IsPlayer() && IsHunterPet())
2228 {
2229 return;
2230 }
2231
2232 if (uint8 mask = GetCreatureTemplate()->SpellSchoolImmuneMask)
2233 {
2234 for (uint8 i = SPELL_SCHOOL_NORMAL; i <= SPELL_SCHOOL_ARCANE; ++i)
2235 {
2236 if (mask & (1 << i))
2237 {
2238 ApplySpellImmune(placeholderSpellId, IMMUNITY_SCHOOL, 1 << i, true);
2239 }
2240 }
2241 }
2242}
@ SPELL_SCHOOL_ARCANE
Definition: SharedDefines.h:289
@ IMMUNITY_SCHOOL
Definition: SharedDefines.h:1396
bool IsHunterPet() const
Definition: Unit.h:711
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
Definition: Unit.cpp:13346

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

Referenced by UpdateEntry().

◆ LowerPlayerDamageReq()

void Creature::LowerPlayerDamageReq ( uint32  unDamage,
bool  damagedByPlayer = true 
)
3794{
3795 if (_playerDamageReq)
3796 _playerDamageReq > unDamage ? _playerDamageReq -= unDamage : _playerDamageReq = 0;
3797
3798 if (!_damagedByPlayer)
3799 {
3800 _damagedByPlayer = damagedByPlayer;
3801 }
3802}

References _damagedByPlayer, and _playerDamageReq.

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

◆ ModifyThreatPercentTemp()

void Creature::ModifyThreatPercentTemp ( Unit victim,
int32  percent,
Milliseconds  duration 
)
3773{
3774 if (victim)
3775 {
3776 float currentThreat = GetThreatMgr().GetThreat(victim);
3777
3778 if (percent != 0.0f)
3779 {
3780 GetThreatMgr().ModifyThreatByPercent(victim, percent);
3781 }
3782
3783 TemporaryThreatModifierEvent* pEvent = new TemporaryThreatModifierEvent(*this, victim->GetGUID(), currentThreat);
3784 m_Events.AddEvent(pEvent, m_Events.CalculateTime(duration.count()));
3785 }
3786}
float GetThreat(Unit *victim, bool alsoSearchOfflineList=false)
Definition: ThreatMgr.cpp:525
void ModifyThreatByPercent(Unit *victim, int32 percent)
Definition: ThreatMgr.cpp:508
Definition: Creature.h:550
ThreatMgr & GetThreatMgr()
Definition: Unit.h:839

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

◆ Motion_Initialize()

void Creature::Motion_Initialize ( )
1109{
1110 if (!m_formation)
1112 else if (m_formation->GetLeader() == this)
1113 {
1114 m_formation->FormationReset(false, true);
1116 }
1117 else if (m_formation->IsFormed())
1118 GetMotionMaster()->MoveIdle(); //wait the order of leader
1119 else
1121}
Creature * GetLeader() const
Definition: CreatureGroups.h:98
void FormationReset(bool dismiss, bool initMotionMaster)
Definition: CreatureGroups.cpp:321
bool IsFormed() const
Definition: CreatureGroups.h:102
void Initialize()
Definition: MotionMaster.cpp:73
void MoveIdle()
Definition: MotionMaster.cpp:232

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

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

◆ ProhibitSpellSchool()

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

Reimplemented from Unit.

2813{
2814 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
2815 {
2816 if (idSchoolMask & (1 << i))
2817 {
2818 m_ProhibitSchoolTime[i] = GameTime::GetGameTimeMS().count() + unTimeMs;
2819 }
2820 }
2821}

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

◆ reachWithSpellAttack()

SpellInfo const * Creature::reachWithSpellAttack ( Unit victim)
2287{
2288 if (!victim)
2289 return nullptr;
2290
2291 for (uint32 i = 0; i < MAX_CREATURE_SPELLS; ++i)
2292 {
2293 if (!m_spells[i])
2294 continue;
2295 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]);
2296 if (!spellInfo)
2297 {
2298 LOG_ERROR("entities.unit", "WORLD: unknown spell id {}", m_spells[i]);
2299 continue;
2300 }
2301
2302 bool bcontinue = true;
2303 for (uint32 j = 0; j < MAX_SPELL_EFFECTS; j++)
2304 {
2305 if ((spellInfo->Effects[j].Effect == SPELL_EFFECT_SCHOOL_DAMAGE) ||
2306 (spellInfo->Effects[j].Effect == SPELL_EFFECT_INSTAKILL) ||
2307 (spellInfo->Effects[j].Effect == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) ||
2308 (spellInfo->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH)
2309 )
2310 {
2311 bcontinue = false;
2312 break;
2313 }
2314 }
2315 if (bcontinue)
2316 continue;
2317
2318 if (spellInfo->ManaCost > GetPower(POWER_MANA))
2319 continue;
2320 float range = spellInfo->GetMaxRange(false);
2321 float minrange = spellInfo->GetMinRange(false);
2322 float dist = GetDistance(victim);
2323 if (dist > range || dist < minrange)
2324 continue;
2326 continue;
2328 continue;
2329 return spellInfo;
2330 }
2331 return nullptr;
2332}
@ UNIT_FLAG_PACIFIED
Definition: UnitDefines.h:246
@ SPELL_EFFECT_HEALTH_LEECH
Definition: SharedDefines.h:787
@ SPELL_EFFECT_ENVIRONMENTAL_DAMAGE
Definition: SharedDefines.h:785
@ SPELL_EFFECT_SCHOOL_DAMAGE
Definition: SharedDefines.h:780
@ SPELL_EFFECT_INSTAKILL
Definition: SharedDefines.h:779
@ SPELL_PREVENTION_TYPE_SILENCE
Definition: SharedDefines.h:1554
@ SPELL_PREVENTION_TYPE_PACIFY
Definition: SharedDefines.h:1555
float GetDistance(WorldObject const *obj) const
Definition: Object.cpp:1245
uint32 PreventionType
Definition: SpellInfo.h:390
float GetMinRange(bool positive=false) const
Definition: SpellInfo.cpp:2313
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition: SpellInfo.h:393
float GetMaxRange(bool positive=false, Unit *caster=nullptr, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:2322
uint32 ManaCost
Definition: SpellInfo.h:363

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)
2335{
2336 if (!victim)
2337 return nullptr;
2338
2339 for (uint32 i = 0; i < MAX_CREATURE_SPELLS; ++i)
2340 {
2341 if (!m_spells[i])
2342 continue;
2343 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]);
2344 if (!spellInfo)
2345 {
2346 LOG_ERROR("entities.unit", "WORLD: unknown spell id {}", m_spells[i]);
2347 continue;
2348 }
2349
2350 bool bcontinue = true;
2351 for (uint32 j = 0; j < MAX_SPELL_EFFECTS; j++)
2352 {
2353 if ((spellInfo->Effects[j].Effect == SPELL_EFFECT_HEAL))
2354 {
2355 bcontinue = false;
2356 break;
2357 }
2358 }
2359 if (bcontinue)
2360 continue;
2361
2362 if (spellInfo->ManaCost > GetPower(POWER_MANA))
2363 continue;
2364
2365 float range = spellInfo->GetMaxRange(true);
2366 float minrange = spellInfo->GetMinRange(true);
2367 float dist = GetDistance(victim);
2368
2369 if (dist > range || dist < minrange)
2370 continue;
2372 continue;
2374 continue;
2375 return spellInfo;
2376 }
2377 return nullptr;
2378}

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)
3267{
3268 if (!_isMissingSwimmingFlagOutOfCombat || recheck)
3270
3271 // Check if the creature has UNIT_FLAG_SWIMMING and add it if it's missing
3272 // Creatures must be able to chase a target in water if they can enter water
3275}
@ UNIT_FLAG_SWIMMING
Definition: UnitDefines.h:244
bool CanEnterWater() const override
Definition: Creature.cpp:3258

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

◆ Regenerate()

void Creature::Regenerate ( Powers  power)
protected
947{
948 uint32 curValue = GetPower(power);
949 uint32 maxValue = GetMaxPower(power);
950
951 // Xinef: implement power regeneration flag
953 return;
954
955 if (!m_regenPower)
956 {
957 return;
958 }
959
960 if (curValue >= maxValue)
961 return;
962
963 float addvalue = 0.0f;
964
965 switch (power)
966 {
967 case POWER_FOCUS:
968 {
969 // For hunter pets.
970 addvalue = 24 * sWorld->getRate(RATE_POWER_FOCUS);
971 break;
972 }
973 case POWER_ENERGY:
974 {
975 // For deathknight's ghoul.
976 addvalue = 20;
977 break;
978 }
979 case POWER_MANA:
980 {
981 // Combat and any controlled creature
983 {
985 {
986 addvalue = uint32((GetStat(STAT_SPIRIT) / (IsUnderLastManaUseEffect() ? 8.0f : 5.0f) + 17.0f));
987 }
988 else if (!IsUnderLastManaUseEffect())
989 {
990 float ManaIncreaseRate = sWorld->getRate(RATE_POWER_MANA);
991 float Spirit = GetStat(STAT_SPIRIT);
992
993 addvalue = uint32((Spirit / 5.0f + 17.0f) * ManaIncreaseRate);
994 }
995 }
996 else
997 addvalue = maxValue / 3;
998 break;
999 }
1000 default:
1001 return;
1002 }
1003
1004 // Apply modifiers (if any).
1006 for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
1007 if (Powers((*i)->GetMiscValue()) == power)
1008 AddPct(addvalue, (*i)->GetAmount());
1009
1011
1012 ModifyPower(power, int32(addvalue));
1013}
T AddPct(T &base, U pct)
Definition: Util.h:67
@ RATE_POWER_MANA
Definition: IWorld.h:433
@ RATE_POWER_FOCUS
Definition: IWorld.h:438
@ UNIT_FLAG2_REGENERATE_POWER
Definition: UnitDefines.h:278
constexpr Milliseconds PET_FOCUS_REGEN_INTERVAL
Definition: CreatureData.h:38
@ NPC_WATER_ELEMENTAL_TEMP
Definition: PetDefines.h:104
@ NPC_IMP
Definition: PetDefines.h:95
@ NPC_WATER_ELEMENTAL_PERM
Definition: PetDefines.h:106
@ SPELL_AURA_MOD_POWER_REGEN
Definition: SpellAuraDefines.h:148
@ SPELL_AURA_MOD_POWER_REGEN_PERCENT
Definition: SpellAuraDefines.h:173
Powers
Definition: SharedDefines.h:268
@ POWER_ENERGY
Definition: SharedDefines.h:272
@ POWER_FOCUS
Definition: SharedDefines.h:271
@ STAT_SPIRIT
Definition: SharedDefines.h:262
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition: Unit.cpp:14106
bool IsUnderLastManaUseEffect() const
Definition: Unit.cpp:17199
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1362
bool HasUnitFlag2(UnitFlags2 flags) const
Definition: Unit.h:688
int32 GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const
Definition: Unit.cpp:5985
std::list< AuraEffect * > AuraEffectList
Definition: Unit.h:646

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

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

◆ RegenerateHealth()

void Creature::RegenerateHealth ( )
protected
1016{
1017 if (!isRegeneratingHealth())
1018 return;
1019
1020 uint32 curValue = GetHealth();
1021 uint32 maxValue = GetMaxHealth();
1022
1023 if (curValue >= maxValue)
1024 return;
1025
1026 uint32 addvalue = 0;
1027
1028 // Not only pet, but any controlled creature
1029 // Xinef: fix polymorph rapid regen
1031 addvalue = maxValue / 3;
1032 else //if (GetCharmerOrOwnerGUID())
1033 {
1034 float HealthIncreaseRate = sWorld->getRate(RATE_HEALTH);
1035 float Spirit = GetStat(STAT_SPIRIT);
1036
1037 if (GetPower(POWER_MANA) > 0)
1038 addvalue = uint32(Spirit * 0.25 * HealthIncreaseRate);
1039 else
1040 addvalue = uint32(Spirit * 0.80 * HealthIncreaseRate);
1041 }
1042
1043 // Apply modifiers (if any).
1045 for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
1046 AddPct(addvalue, (*i)->GetAmount());
1047
1049
1050 ModifyHealth(addvalue);
1051}
@ RATE_HEALTH
Definition: IWorld.h:432
@ SPELL_AURA_MOD_HEALTH_REGEN_PERCENT
Definition: SpellAuraDefines.h:151
@ SPELL_AURA_MOD_REGEN
Definition: SpellAuraDefines.h:147
bool isRegeneratingHealth()
Definition: Creature.h:318
int32 ModifyHealth(int32 val)
Definition: Unit.cpp:14048
bool IsPolymorphed() const
Definition: Unit.cpp:16697
uint32 GetHealth() const
Definition: Unit.h:869

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

Referenced by Update().

◆ ReleaseFocus()

void Creature::ReleaseFocus ( Spell const *  focusSpell)
3568{
3569 // focused to something else
3570 if (focusSpell != _focusSpell)
3571 return;
3572
3573 _focusSpell = nullptr;
3574 if (Unit* victim = GetVictim())
3575 SetGuidValue(UNIT_FIELD_TARGET, victim->GetGUID());
3576 else
3578
3579 if (focusSpell->GetSpellInfo()->HasAttribute(SPELL_ATTR5_AI_DOESNT_FACE_TARGET))
3581}
void ClearUnitState(uint32 f)
Definition: Unit.h:674

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

◆ RemoveCorpse()

void Creature::RemoveCorpse ( bool  setSpawnTime = true,
bool  skipVisibility = false 
)
402{
403 if (getDeathState() != DeathState::Corpse)
404 return;
405
407 setDeathState(DeathState::Dead);
409 if (!skipVisibility) // pussywizard
410 DestroyForNearbyPlayers(); // pussywizard: previous UpdateObjectVisibility()
411 loot.clear();
412 uint32 respawnDelay = m_respawnDelay;
413 if (IsAIEnabled)
414 AI()->CorpseRemoved(respawnDelay);
415
416 // Should get removed later, just keep "compatibility" with scripts
417 if (setSpawnTime)
418 {
419 m_respawnTime = GameTime::GetGameTime().count() + respawnDelay;
420 //SaveRespawnTime();
421 }
422
423 float x, y, z, o;
424 GetRespawnPosition(x, y, z, &o);
425 SetHomePosition(x, y, z, o);
426 SetPosition(x, y, z, o);
427
428 // xinef: relocate notifier
429 m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f);
430
431 // pussywizard: if corpse was removed during falling then the falling will continue after respawn, so stop falling is such case
432 if (IsFalling())
433 StopMoving();
434}
virtual void CorpseRemoved(uint32 &)
== Triggered Actions Requested ==================
Definition: CreatureAI.h:192
void GetRespawnPosition(float &x, float &y, float &z, float *ori=nullptr, float *dist=nullptr) const
Definition: Creature.cpp:2935
void SetPosition(float x, float y, float z, float o)
Definition: Creature.cpp:3149
DeathState getDeathState()
Definition: Unit.h:1207
void StopMoving()
Definition: Unit.cpp:16606
Position m_last_notify_position
Definition: Unit.h:1811
void RemoveAllAuras()
Definition: Unit.cpp:5290
bool IsFalling() const
Definition: Unit.cpp:19910
void clear()
Definition: LootMgr.h:343

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

Referenced by OPvPCapturePoint::DelCreature(), DisappearAndDie(), RespawnEvent::Execute(), ForcedDespawn(), AuraEffect::HandleAuraControlVehicle(), boss_skeram::JustDied(), npc_qiraj_war_spawn::npc_qiraj_war_spawnAI::JustDied(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), npc_illidari_spawn::npc_illidari_spawnAI::JustDied(), npc_nether_drake::npc_nether_drakeAI::MovementInform(), ValithriaDespawner::operator()(), Respawn(), npc_simone::npc_simoneAI::RespawnPet(), and Update().

◆ RemoveFromWorld()

void Creature::RemoveFromWorld ( )
overridevirtual

Reimplemented from Object.

Reimplemented in TempSummon, Minion, Puppet, and Pet.

348{
349 if (IsInWorld())
350 {
351 sScriptMgr->OnCreatureRemoveWorld(this);
352
353 if (GetZoneScript())
355
356 if (m_formation)
357 sFormationMgr->RemoveCreatureFromGroup(m_formation, this);
358
359 if (Transport* transport = GetTransport())
360 transport->RemovePassenger(this, true);
361
363
364 if (m_spawnId)
365 Acore::Containers::MultimapErasePair(GetMap()->GetCreatureBySpawnIdStore(), m_spawnId, this);
366
368 }
369}
#define sFormationMgr
Definition: CreatureGroups.h:126
void MultimapErasePair(M< K, V, Rest... > &multimap, K const &key, V const &value)
Definition: Containers.h:226
bool Remove(KEY_TYPE const &handle)
Definition: TypeContainer.h:139
Definition: Transport.h:29
void RemoveFromWorld() override
Definition: Unit.cpp:15651
virtual void OnCreatureRemove(Creature *)
Definition: ZoneScript.h:36

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

Referenced by TempSummon::RemoveFromWorld().

◆ RemoveLootMode()

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

References m_LootMode.

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

◆ ResetLootMode()

◆ ResetPickPocketLootTime()

void Creature::ResetPickPocketLootTime ( )
inline

References lootPickPocketRestoreTime.

Referenced by Respawn().

◆ ResetPlayerDamageReq()

◆ Respawn()

void Creature::Respawn ( bool  force = false)
Parameters
forceForce the respawn by killing the creature.
2031{
2032 if (force)
2033 {
2034 if (IsAlive())
2035 {
2036 setDeathState(DeathState::JustDied);
2037 }
2038 else if (getDeathState() != DeathState::Corpse)
2039 {
2040 setDeathState(DeathState::Corpse);
2041 }
2042 }
2043
2044 ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_RESPAWN, GetEntry());
2045
2046 if (!sConditionMgr->IsObjectMeetToConditions(this, conditions) && !force)
2047 {
2048 // Creature should not respawn, reset respawn timer. Conditions will be checked again the next time it tries to respawn.
2050 return;
2051 }
2052
2053 bool allowed = !IsAIEnabled || AI()->CanRespawn(); // First check if there are any scripts that prevent us respawning
2054 if (!allowed && !force) // Will be rechecked on next Update call
2055 return;
2056
2057 ObjectGuid dbtableHighGuid = ObjectGuid::Create<HighGuid::Unit>(m_creatureData ? m_creatureData->id1 : GetEntry(), m_spawnId);
2058 time_t linkedRespawntime = GetMap()->GetLinkedRespawnTime(dbtableHighGuid);
2059
2060 CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(GetEntry());
2061
2062 if (!linkedRespawntime || (cInfo && cInfo->HasFlagsExtra(CREATURE_FLAG_EXTRA_HARD_RESET)) || force) // Should respawn
2063 {
2064 RemoveCorpse(false, false);
2065
2066 if (getDeathState() == DeathState::Dead)
2067 {
2068 if (m_spawnId)
2069 {
2071 CreatureData const* data = sObjectMgr->GetCreatureData(m_spawnId);
2072 // Respawn check if spawn has 2 entries
2073 if (data->id2)
2074 {
2075 uint32 entry = GetRandomId(data->id1, data->id2, data->id3);
2076 UpdateEntry(entry, data, true); // Select Random Entry
2077 m_defaultMovementType = MovementGeneratorType(data->movementType); // Reload Movement Type
2078 LoadEquipment(data->equipmentId); // Reload Equipment
2079 AIM_Initialize(); // Reload AI
2080 }
2081 else
2082 {
2083 if (m_originalEntry != GetEntry())
2085 }
2086 }
2087
2088 LOG_DEBUG("entities.unit", "Respawning creature {} (SpawnId: {}, {})", GetName(), GetSpawnId(), GetGUID().ToString());
2089 m_respawnTime = 0;
2091 loot.clear();
2092 SelectLevel();
2093
2094 setDeathState(DeathState::JustRespawned);
2095
2096 // MDic - Acidmanifesto: Do not override transform auras
2098 {
2100 CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&display, GetCreatureTemplate());
2101 if (minfo) // Cancel load if no model defined
2102 {
2103 SetDisplayId(display.CreatureDisplayID, display.DisplayScale);
2104 SetNativeDisplayId(display.CreatureDisplayID);
2105 }
2106 }
2107
2109
2110 //Call AI respawn virtual function
2111 if (IsAIEnabled)
2112 {
2113 //reset the AI to be sure no dirty or uninitialized values will be used till next tick
2114 AI()->Reset();
2115 TriggerJustRespawned = true; //delay event to next tick so all creatures are created on the map before processing
2116 }
2117
2118 uint32 poolid = m_spawnId ? sPoolMgr->IsPartOfAPool<Creature>(m_spawnId) : 0;
2119 if (poolid)
2120 sPoolMgr->UpdatePool<Creature>(poolid, m_spawnId);
2121
2122 //Re-initialize reactstate that could be altered by movementgenerators
2124
2126 }
2128 // xinef: relocate notifier, fixes npc appearing in corpse position after forced respawn (instead of spawn)
2129 m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f);
2131
2132 }
2133 else // the master is dead
2134 {
2135 ObjectGuid targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid);
2136 if (targetGuid == dbtableHighGuid) // if linking self, never respawn (check delayed to next day)
2137 {
2139 }
2140 else
2141 {
2142 time_t now = GameTime::GetGameTime().count();
2143 m_respawnTime = (now > linkedRespawntime ? now : linkedRespawntime) + urand(5, MINUTE); // else copy time from master and add a little
2144 }
2145 SaveRespawnTime(); // also save to DB immediately
2146 }
2147}
constexpr auto DAY
Definition: Common.h:49
constexpr auto MINUTE
Definition: Common.h:47
#define sConditionMgr
Definition: ConditionMgr.h:289
@ CONDITION_SOURCE_TYPE_CREATURE_RESPAWN
Definition: ConditionMgr.h:151
std::list< Condition * > ConditionList
Definition: ConditionMgr.h:236
#define sPoolMgr
Definition: PoolMgr.h:163
@ CREATURE_FLAG_EXTRA_HARD_RESET
Definition: CreatureData.h:77
@ SPELL_AURA_TRANSFORM
Definition: SpellAuraDefines.h:119
virtual void Reset()
Definition: UnitAI.h:206
virtual bool CanRespawn()
Definition: CreatureAI.h:116
void SaveRespawnTime() override
Definition: Creature.cpp:2612
void SetRespawnTime(uint32 respawn)
Definition: Creature.cpp:3762
void SelectLevel(bool changelevel=true)
Definition: Creature.cpp:1505
void InitializeReactState()
Check if the creature has the specified ReactState.
Definition: Creature.cpp:2201
void ResetPickPocketLootTime()
Definition: Creature.h:236
Definition: ObjectGuid.h:118
void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false) override
Definition: Unit.cpp:19086
time_t GetLinkedRespawnTime(ObjectGuid guid) const
Definition: Map.cpp:3581
void InitDefault()
Definition: MotionMaster.cpp:87

References AI(), AIM_Initialize(), CreatureAI::CanRespawn(), Loot::clear(), CONDITION_SOURCE_TYPE_CREATURE_RESPAWN, CREATURE_FLAG_EXTRA_HARD_RESET, CreatureModel::CreatureDisplayID, DAY, CreatureModel::DisplayScale, CreatureData::equipmentId, Unit::GetAuraEffectsByType(), GetCreatureTemplate(), Unit::getDeathState(), Object::GetEntry(), GameTime::GetGameTime(), Object::GetGUID(), Map::GetLinkedRespawnTime(), WorldObject::GetMap(), Unit::GetMotionMaster(), WorldObject::GetName(), Unit::GetNativeDisplayId(), GetNativeObjectScale(), GetRandomId(), GetSpawnId(), CreatureTemplate::HasFlagsExtra(), CreatureData::id1, CreatureData::id2, CreatureData::id3, MotionMaster::InitDefault(), InitializeReactState(), Unit::IsAIEnabled, Unit::IsAlive(), 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(), SaveRespawnTime(), sConditionMgr, SelectLevel(), setDeathState(), SetDisplayId(), Unit::SetNativeDisplayId(), SetRespawnTime(), sObjectMgr, SPELL_AURA_TRANSFORM, sPoolMgr, Position::ToString(), TriggerJustRespawned, UpdateEntry(), Unit::UpdateObjectVisibility(), and urand().

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

◆ ResumeChasingVictim()

void Creature::ResumeChasingVictim ( )
inline

Helper to resume chasing current victim.

void MoveChase(Unit *target, std::optional< ChaseRange > dist={}, std::optional< ChaseAngle > angle={})
Force the unit to chase this target. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition: MotionMaster.cpp:313

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

Referenced by boss_julianne::DoAction(), boss_shade_of_aran::JustEngagedWith(), boss_grandmaster_vorpil::JustEngagedWith(), boss_ayamiss::MovementInform(), boss_leotheras_the_blind::Reset(), boss_high_astromancer_solarian::Reset(), and boss_laj::ScheduleTasks().

◆ SaveRespawnTime()

◆ SaveToDB() [1/2]

void Creature::SaveToDB ( )
1389{
1390 // this should only be used when the creature has already been loaded
1391 // preferably after adding to map, because mapid may not be valid otherwise
1392 CreatureData const* data = sObjectMgr->GetCreatureData(m_spawnId);
1393 if (!data)
1394 {
1395 LOG_ERROR("entities.unit", "Creature::SaveToDB failed, cannot get creature data!");
1396 return;
1397 }
1398
1400 SaveToDB(mapId, data->spawnMask, GetPhaseMask());
1401}
void SaveToDB()
Definition: Creature.cpp:1388
uint8 spawnMask
Definition: CreatureData.h:392
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:137
MotionTransport * ToMotionTransport()
Definition: GameObject.h:328
uint32 mapID
Definition: GameObjectData.h:223
struct GameObjectTemplate::@227::@242 moTransport
uint32 GetMapId() const
Definition: Position.h:276

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

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

◆ SaveToDB() [2/2]

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

Reimplemented in TempSummon, and Pet.

1404{
1405 // update in loaded data
1406 if (!m_spawnId)
1407 m_spawnId = sObjectMgr->GenerateCreatureSpawnId();
1408
1409 CreatureData& data = sObjectMgr->NewOrExistCreatureData(m_spawnId);
1410
1411 uint32 displayId = GetNativeDisplayId();
1412 uint32 npcflag = GetNpcFlags();
1413 uint32 unit_flags = GetUnitFlags();
1414 uint32 dynamicflags = GetDynamicFlags();
1415
1416 // check if it's a custom model and if not, use 0 for displayId
1417 CreatureTemplate const* cinfo = GetCreatureTemplate();
1418 if (cinfo)
1419 {
1420 for (CreatureModel model : cinfo->Models)
1421 if (displayId && displayId == model.CreatureDisplayID)
1422 displayId = 0;
1423
1424 if (npcflag == cinfo->npcflag)
1425 npcflag = 0;
1426
1427 if (unit_flags == cinfo->unit_flags)
1428 unit_flags = 0;
1429
1430 if (dynamicflags == cinfo->dynamicflags)
1431 dynamicflags = 0;
1432 }
1433
1434 data.id1 = GetEntry();
1435 data.mapid = mapid;
1436 data.phaseMask = phaseMask;
1437 data.displayid = displayId;
1439 if (!GetTransport())
1440 {
1441 data.posX = GetPositionX();
1442 data.posY = GetPositionY();
1443 data.posZ = GetPositionZ();
1444 data.orientation = GetOrientation();
1445 }
1446 else
1447 {
1448 data.posX = GetTransOffsetX();
1449 data.posY = GetTransOffsetY();
1450 data.posZ = GetTransOffsetZ();
1452 }
1453
1455 // prevent add data integrity problems
1457 data.currentwaypoint = 0;
1458 data.curhealth = GetHealth();
1459 data.curmana = GetPower(POWER_MANA);
1460 // prevent add data integrity problems
1463 data.spawnMask = spawnMask;
1464 data.npcflag = npcflag;
1465 data.unit_flags = unit_flags;
1466 data.dynamicflags = dynamicflags;
1467
1468 // update in DB
1469 WorldDatabaseTransaction trans = WorldDatabase.BeginTransaction();
1470
1472 stmt->SetData(0, m_spawnId);
1473 trans->Append(stmt);
1474
1475 uint8 index = 0;
1476
1477 stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_CREATURE);
1478 stmt->SetData(index++, m_spawnId);
1479 stmt->SetData(index++, GetEntry());
1480 stmt->SetData(index++, 0);
1481 stmt->SetData(index++, 0);
1482 stmt->SetData(index++, uint16(mapid));
1483 stmt->SetData(index++, spawnMask);
1484 stmt->SetData(index++, GetPhaseMask());
1485 stmt->SetData(index++, int32(GetCurrentEquipmentId()));
1486 stmt->SetData(index++, GetPositionX());
1487 stmt->SetData(index++, GetPositionY());
1488 stmt->SetData(index++, GetPositionZ());
1489 stmt->SetData(index++, GetOrientation());
1490 stmt->SetData(index++, m_respawnDelay);
1491 stmt->SetData(index++, m_wanderDistance);
1492 stmt->SetData(index++, 0);
1493 stmt->SetData(index++, GetHealth());
1494 stmt->SetData(index++, GetPower(POWER_MANA));
1495 stmt->SetData(index++, uint8(GetDefaultMovementType()));
1496 stmt->SetData(index++, npcflag);
1497 stmt->SetData(index++, unit_flags);
1498 stmt->SetData(index++, dynamicflags);
1499 trans->Append(stmt);
1500
1501 WorldDatabase.CommitTransaction(trans);
1502 sScriptMgr->OnCreatureSaveToDB(this);
1503}
@ WORLD_INS_CREATURE
Definition: WorldDatabase.h:92
uint8 GetCurrentEquipmentId()
Definition: Creature.h:195
MovementGeneratorType GetDefaultMovementType() const override
-------—End of Pet responses methods-------—
Definition: Creature.h:88
uint32 unit_flags
Definition: CreatureData.h:217
uint32 npcflag
Definition: CreatureData.h:202
std::vector< CreatureModel > Models
Definition: CreatureData.h:193
uint32 dynamicflags
Definition: CreatureData.h:219
uint32 dynamicflags
Definition: CreatureData.h:395
uint32 displayid
Definition: CreatureData.h:380
uint32 unit_flags
Definition: CreatureData.h:394
uint32 currentwaypoint
Definition: CreatureData.h:388
uint16 mapid
Definition: CreatureData.h:378
float GetTransOffsetX() const
Definition: Object.h:600
float GetTransOffsetY() const
Definition: Object.h:601
float GetTransOffsetZ() const
Definition: Object.h:602
float GetTransOffsetO() const
Definition: Object.h:603
NPCFlags GetNpcFlags() const
Definition: Unit.h:693
UnitFlags GetUnitFlags() const
Definition: Unit.h:681
uint32 GetDynamicFlags() const override
Definition: Unit.h:699

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

◆ SearchFormation()

void Creature::SearchFormation ( )
382{
383 if (IsSummon())
384 {
385 return;
386 }
387
389 if (!spawnId)
390 {
391 return;
392 }
393
394 CreatureGroupInfoType::const_iterator frmdata = sFormationMgr->CreatureGroupMap.find(spawnId);
395 if (frmdata != sFormationMgr->CreatureGroupMap.end())
396 {
397 sFormationMgr->AddCreatureToGroup(frmdata->second.leaderGUID, this);
398 }
399}
uint32 LowType
Definition: ObjectGuid.h:122

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)
1506{
1507 CreatureTemplate const* cInfo = GetCreatureTemplate();
1508
1509 uint32 rank = IsPet() ? 0 : cInfo->rank;
1510
1511 // level
1512 uint8 minlevel = std::min(cInfo->maxlevel, cInfo->minlevel);
1513 uint8 maxlevel = std::max(cInfo->maxlevel, cInfo->minlevel);
1514 uint8 level = minlevel == maxlevel ? minlevel : urand(minlevel, maxlevel);
1515
1516 sScriptMgr->OnBeforeCreatureSelectLevel(cInfo, this, level);
1517
1518 if (changelevel)
1519 SetLevel(level);
1520
1521 CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(level, cInfo->unit_class);
1522
1523 // health
1524 float healthmod = _GetHealthMod(rank);
1525
1526 uint32 basehp = std::max<uint32>(1, stats->GenerateHealth(cInfo));
1527 uint32 health = uint32(basehp * healthmod);
1528
1529 SetCreateHealth(health);
1530 SetMaxHealth(health);
1531 SetHealth(health);
1533
1534 // mana
1535 uint32 mana = stats->GenerateMana(cInfo);
1536
1537 SetCreateMana(mana);
1538 SetMaxPower(POWER_MANA, mana); //MAX Mana
1539 SetPower(POWER_MANA, mana);
1540
1542
1545
1546 // damage
1547
1548 float basedamage = stats->GenerateBaseDamage(cInfo);
1549
1550 float weaponBaseMinDamage = basedamage;
1551 float weaponBaseMaxDamage = basedamage * 1.5;
1552
1553 SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, weaponBaseMinDamage);
1554 SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, weaponBaseMaxDamage);
1555
1556 SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, weaponBaseMinDamage);
1557 SetBaseWeaponDamage(OFF_ATTACK, MAXDAMAGE, weaponBaseMaxDamage);
1558
1559 SetBaseWeaponDamage(RANGED_ATTACK, MINDAMAGE, weaponBaseMinDamage);
1560 SetBaseWeaponDamage(RANGED_ATTACK, MAXDAMAGE, weaponBaseMaxDamage);
1561
1564
1565 sScriptMgr->Creature_SelectLevel(cInfo, this);
1566}
@ UNIT_MOD_ATTACK_POWER
Definition: Unit.h:163
@ UNIT_MOD_HEALTH
Definition: Unit.h:148
@ UNIT_MOD_MANA
Definition: Unit.h:149
@ UNIT_MOD_ATTACK_POWER_RANGED
Definition: Unit.h:164
void ResetPlayerDamageReq()
Definition: Creature.cpp:3804
uint8 minlevel
Definition: CreatureData.h:198
uint8 maxlevel
Definition: CreatureData.h:199
Definition: CreatureData.h:306
uint32 RangedAttackPower
Definition: CreatureData.h:311
uint32 AttackPower
Definition: CreatureData.h:310
float GenerateBaseDamage(CreatureTemplate const *info) const
Definition: CreatureData.h:335
uint32 GenerateMana(CreatureTemplate const *info) const
Definition: CreatureData.h:321
uint32 GenerateHealth(CreatureTemplate const *info) const
Definition: CreatureData.h:316
void SetCreateHealth(uint32 val)
Definition: Unit.h:1433
void SetBaseWeaponDamage(WeaponAttackType attType, WeaponDamageRange damageRange, float value, uint8 damageIndex=0)
Definition: Unit.h:922
void SetMaxPower(Powers power, uint32 val)
Definition: Unit.cpp:15586
void SetCreateMana(uint32 val)
Definition: Unit.h:1435
void SetLevel(uint8 lvl, bool showLevelChange=true)
Definition: Unit.cpp:15415
void SetModifierValue(UnitMods unitMod, UnitModifierType modifierType, float value)
Definition: Unit.h:902
void SetMaxHealth(uint32 val)
Definition: Unit.cpp:15483

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

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

◆ SelectNearestTarget()

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

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

2384{
2385 if (dist == 0.0f)
2386 {
2388 }
2389
2390 Unit* target = nullptr;
2391
2392 Acore::NearestHostileUnitCheck u_check(this, dist, playerOnly);
2393 Acore::UnitLastSearcher<Acore::NearestHostileUnitCheck> searcher(this, target, u_check);
2394 Cell::VisitAllObjects(this, searcher, dist);
2395 return target;
2396}
#define MAX_VISIBILITY_DISTANCE
Definition: ObjectDefines.h:31
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:207
Definition: GridNotifiers.h:406
Definition: GridNotifiers.h:1192

References MAX_VISIBILITY_DISTANCE, and Cell::VisitAllObjects().

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

◆ SelectNearestTargetInAttackDistance()

Unit * Creature::SelectNearestTargetInAttackDistance ( float  dist) const

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

2402{
2403 if (dist < ATTACK_DISTANCE)
2404 dist = ATTACK_DISTANCE;
2405 if (dist > MAX_SEARCHER_DISTANCE)
2406 dist = MAX_SEARCHER_DISTANCE;
2407
2408 Unit* target = nullptr;
2411 Cell::VisitAllObjects(this, searcher, std::max(dist, ATTACK_DISTANCE));
2412
2413 return target;
2414}
#define MAX_SEARCHER_DISTANCE
Definition: ObjectDefines.h:33
Definition: GridNotifiers.h:1221

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

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

◆ SelectVictim()

Unit * Creature::SelectVictim ( )
14689{
14690 // function provides main threat functionality
14691 // next-victim-selection algorithm and evade mode are called
14692 // threat list sorting etc.
14693
14694 Unit* target = nullptr;
14695
14696 // First checking if we have some taunt on us
14698 if (!tauntAuras.empty())
14699 for (Unit::AuraEffectList::const_reverse_iterator itr = tauntAuras.rbegin(); itr != tauntAuras.rend(); ++itr)
14700 if (Unit* caster = (*itr)->GetCaster())
14701 if (CanCreatureAttack(caster) && !caster->HasAuraTypeWithCaster(SPELL_AURA_IGNORED, GetGUID()))
14702 {
14703 target = caster;
14704 break;
14705 }
14706
14707 if (CanHaveThreatList())
14708 {
14709 if (!target && !m_ThreatMgr.isThreatListEmpty())
14710 target = m_ThreatMgr.getHostileTarget();
14711 }
14712 else if (!HasReactState(REACT_PASSIVE))
14713 {
14714 // we have player pet probably
14715 target = getAttackerForHelper();
14716 if (!target && IsSummon())
14717 if (Unit* owner = ToTempSummon()->GetOwner())
14718 {
14719 if (owner->IsInCombat())
14720 target = owner->getAttackerForHelper();
14721 if (!target)
14722 for (ControlSet::const_iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr)
14723 if ((*itr)->IsInCombat())
14724 {
14725 target = (*itr)->getAttackerForHelper();
14726 if (target)
14727 break;
14728 }
14729 }
14730 }
14731 else
14732 return nullptr;
14733
14734 if (target && CanCreatureAttack(target))
14735 {
14736 SetInFront(target);
14737 return target;
14738 }
14739
14740 // last case when creature must not go to evade mode:
14741 // it in combat but attacker not make any damage and not enter to aggro radius to have record in threat list
14742 // Note: creature does not have targeted movement generator but has attacker in this case
14743 for (AttackerSet::const_iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr)
14744 if ((*itr) && CanCreatureAttack(*itr) && !(*itr)->IsPlayer() && !(*itr)->ToCreature()->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
14745 return nullptr;
14746
14747 if (GetVehicle())
14748 return nullptr;
14749
14750 // pussywizard: not sure why it's here
14751 // pussywizard: can't evade when having invisibility aura with duration? o_O
14753 if (!iAuras.empty())
14754 {
14755 for (Unit::AuraEffectList::const_iterator itr = iAuras.begin(); itr != iAuras.end(); ++itr)
14756 if ((*itr)->GetBase()->IsPermanent())
14757 {
14759 break;
14760 }
14761 return nullptr;
14762 }
14763
14764 // Last chance: creature group
14765 if (CreatureGroup* group = GetFormation())
14766 {
14767 if (Unit* groupTarget = group->GetNewTargetForMember(this))
14768 {
14769 SetInFront(groupTarget);
14770 return groupTarget;
14771 }
14772 }
14773
14774 // enter in evade mode in other case
14775 AI()->EnterEvadeMode();
14776
14777 return nullptr;
14778}
@ UNIT_MASK_CONTROLABLE_GUARDIAN
Definition: UnitDefines.h:143
@ SPELL_AURA_MOD_INVISIBILITY
Definition: SpellAuraDefines.h:81
@ SPELL_AURA_IGNORED
Definition: SpellAuraDefines.h:284
@ EVADE_REASON_NO_HOSTILES
Definition: CreatureAI.h:90
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Definition: CreatureAI.cpp:197
Unit * getHostileTarget()
Definition: ThreatMgr.cpp:515
bool isThreatListEmpty() const
Definition: ThreatMgr.h:225
CreatureGroup const * GetFormation() const
Definition: Creature.h:354
Definition: CreatureGroups.h:89
Vehicle * GetVehicle() const
Definition: Unit.h:1673
ThreatMgr m_ThreatMgr
Definition: Unit.h:1894
AttackerSet m_attackers
Definition: Unit.h:1851

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

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

◆ SendAIReaction()

void Creature::SendAIReaction ( AiReaction  reactionType)
2417{
2418 WorldPacket data(SMSG_AI_REACTION, 12);
2419
2420 data << GetGUID();
2421 data << uint32(reactionType);
2422
2423 ((WorldObject*)this)->SendMessageToSet(&data, true);
2424
2425 LOG_DEBUG("network", "WORLD: Sent SMSG_AI_REACTION, type {}.", reactionType);
2426}
@ SMSG_AI_REACTION
Definition: Opcodes.h:346
Definition: Object.h:405

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.

2797{
2799 data << (uint32)GetAreaId();
2800 sWorld->SendGlobalMessage(&data, nullptr, (attacker->GetTeamId() == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE));
2801}
@ TEAM_ALLIANCE
Definition: SharedDefines.h:760
@ TEAM_HORDE
Definition: SharedDefines.h:761
@ SMSG_ZONE_UNDER_ATTACK
Definition: Opcodes.h:626
uint32 GetAreaId() const
Definition: Object.cpp:3152
TeamId GetTeamId(bool original=false) const
Definition: Player.h:2088

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

Referenced by GuardAI::JustDied().

◆ SetAssistanceTimer()

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

References m_assistanceTimer.

Referenced by Unit::Attack().

◆ SetCanDualWield()

void Creature::SetCanDualWield ( bool  value)
overridevirtual

◆ SetCanFly()

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

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

Doesn't inform the client.

movement counter

Reimplemented from Unit.

3278{
3279 if (!Unit::SetCanFly(enable))
3280 return false;
3281
3282 if (m_movedByPlayer)
3283 {
3284 sScriptMgr->AnticheatSetCanFlybyServer(m_movedByPlayer->ToPlayer(), enable);
3285
3286 if (!enable)
3288
3290 data << GetPackGUID();
3291 data << uint32(0);
3293
3294 data.Initialize(MSG_MOVE_UPDATE_CAN_FLY, 64);
3295 data << GetPackGUID();
3296 BuildMovementPacket(&data);
3297 m_movedByPlayer->ToPlayer()->SendMessageToSet(&data, false);
3298 return true;
3299 }
3300
3302 data << GetPackGUID();
3303 SendMessageToSet(&data, false);
3304 return true;
3305}
@ MSG_MOVE_UPDATE_CAN_FLY
Definition: Opcodes.h:971
@ SMSG_SPLINE_MOVE_SET_FLYING
Definition: Opcodes.h:1088
@ SMSG_MOVE_SET_CAN_FLY
Definition: Opcodes.h:865
@ SMSG_SPLINE_MOVE_UNSET_FLYING
Definition: Opcodes.h:1089
@ SMSG_MOVE_UNSET_CAN_FLY
Definition: Opcodes.h:866
PackedGuid const & GetPackGUID() const
Definition: Object.h:111
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition: Object.cpp:2080
void SetFallInformation(uint32 time, float z)
Definition: Player.h:2316
void SendMessageToSet(WorldPacket const *data, bool self) const override
Definition: Player.cpp:5656
virtual bool SetCanFly(bool enable, bool packetOnly=false)
Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pre...
Definition: Unit.cpp:20563
SafeUnitPointer m_movedByPlayer
Definition: Unit.h:1778
void BuildMovementPacket(ByteBuffer *data) const
Definition: Unit.cpp:19858

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

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

◆ SetCannotReachTarget()

void Creature::SetCannotReachTarget ( ObjectGuid const &  target = ObjectGuid::Empty)
3648{
3649 if (cannotReach == m_cannotReachTarget)
3650 {
3651 return;
3652 }
3653
3654 m_cannotReachTarget = cannotReach;
3656
3657 if (cannotReach)
3658 {
3659 LOG_DEBUG("entities.unit", "Creature::SetCannotReachTarget() called with true. Details: {}", GetDebugInfo());
3660 }
3661}
std::string GetDebugInfo() const override
Definition: Creature.cpp:3847

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

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

◆ SetCombatMovement()

void Creature::SetCombatMovement ( bool  allowMovement)
3834{
3835 _isCombatMovementAllowed = allowMovement;
3836}

References _isCombatMovementAllowed.

Referenced by boss_victor_nefarius::boss_victor_nefariusAI::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_tentacleAI::boss_yoggsaron_constrictor_tentacleAI(), boss_yoggsaron_corruptor_tentacle::boss_yoggsaron_corruptor_tentacleAI::boss_yoggsaron_corruptor_tentacleAI(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::boss_yoggsaron_crusher_tentacleAI(), boss_jedoga_shadowseeker::DamageTaken(), boss_illidan_stormrage::DoAction(), npc_toxic_slime::InitializeAI(), npc_escortAI::JustRespawned(), FollowerAI::JustRespawned(), npc_flame_of_azzinoth::JustSummoned(), boss_ayamiss::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), npc_amanitar_mushrooms::npc_amanitar_mushrooms(), 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_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_target_dummy::npc_target_dummyAI::npc_target_dummyAI(), 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_training_dummy::npc_training_dummyAI::npc_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_ayamiss::Reset(), boss_quartermaster_zigris::UpdateAI(), and boss_jormungarAI::UpdateAI().

◆ SetCombatPulseDelay()

void Creature::SetCombatPulseDelay ( uint32  delay)
inline
297 {
298 m_combatPulseDelay = delay;
299 if (m_combatPulseTime == 0 || m_combatPulseTime > delay)
300 m_combatPulseTime = delay;
301 }

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 npc_raging_flames::InitializeAI(), npc_flame_of_azzinoth::IsSummonedBy(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustDied(), npc_hor_raging_ghoul::npc_hor_raging_ghoulAI::JustDied(), npc_hor_risen_witch_doctor::npc_hor_risen_witch_doctorAI::JustDied(), npc_hor_lumbering_abomination::npc_hor_lumbering_abominationAI::JustDied(), npc_mindless_ghoul::npc_mindless_ghoulAI::JustDied(), boss_hazzarah::JustSummoned(), npc_anubarak_spike::npc_anubarak_spikeAI::npc_anubarak_spikeAI(), npc_frost_sphere::npc_frost_sphereAI::npc_frost_sphereAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::npc_highlord_darion_mograineAI(), npc_mindless_ghoul::npc_mindless_ghoulAI::npc_mindless_ghoulAI(), instance_black_temple::instance_black_temple_InstanceMapScript::OnCreatureCreate(), 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::npc_swarm_scarabAI::Reset(), npc_nerubian_burrower::npc_nerubian_burrowerAI::Reset(), npc_lk_wicked_spirit::npc_lk_wicked_spiritAI::Reset(), npc_valithria_cloud::npc_valithria_cloudAI::Reset(), npc_argent_captainAI::Reset(), npc_heated_battle::npc_heated_battleAI::Reset(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::Reset(), and boss_svala::boss_svalaAI::UpdateAI().

◆ SetCorpseRemoveTime()

void Creature::SetCorpseRemoveTime ( uint32  delay)

◆ SetCurrentEquipmentId()

void Creature::SetCurrentEquipmentId ( uint8  id)
inline

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

1961{
1962 Unit::setDeathState(state, despawn);
1963
1964 if (state == DeathState::JustDied)
1965 {
1968
1969 // always save boss respawn time at death to prevent crash cheating
1970 if (GetMap()->IsDungeon() || isWorldBoss() || GetCreatureTemplate()->rank >= CREATURE_ELITE_ELITE)
1972
1973 SetTarget(); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState)
1975
1976 Dismount(); // if creature is mounted on a virtual mount, remove it at death
1977
1978 setActive(false);
1979
1981 {
1982 SetNoSearchAssistance(false);
1983 }
1984
1985 //Dismiss group if is leader
1986 if (m_formation && m_formation->GetLeader() == this)
1987 m_formation->FormationReset(true, false);
1988
1989 bool needsFalling = !despawn && (IsFlying() || IsHovering()) && !IsUnderWater();
1990 SetHover(false, false, false);
1991 SetDisableGravity(false, false, false);
1992
1993 if (needsFalling)
1994 GetMotionMaster()->MoveFall(0, true);
1995
1996 Unit::setDeathState(DeathState::Corpse, despawn);
1997 }
1998 else if (state == DeathState::JustRespawned)
1999 {
2000 SetFullHealth();
2001 SetLootRecipient(nullptr);
2004 CreatureTemplate const* cinfo = GetCreatureTemplate();
2005 // Xinef: npc run by default
2006 //SetWalk(true);
2007
2008 // pussywizard:
2011
2013
2017
2018 Unit::setDeathState(DeathState::Alive, despawn);
2019
2021 LoadCreaturesAddon(true);
2022 if (GetCreatureData() && GetPhaseMask() != GetCreatureData()->phaseMask)
2023 SetPhaseMask(GetCreatureData()->phaseMask, false);
2024 }
2025}
@ MOVEMENTFLAG_FALLING
Definition: UnitDefines.h:356
NPCFlags
Non Player Character flags.
Definition: UnitDefines.h:292
@ UNIT_NPC_FLAG_NONE
Definition: UnitDefines.h:293
@ UNIT_STATE_ALL_STATE
Definition: UnitDefines.h:199
@ UNIT_STATE_NO_ENVIRONMENT_UPD
Definition: UnitDefines.h:177
SpellSchools
Definition: SharedDefines.h:282
bool HasSearchedAssistance()
Definition: Creature.h:270
void SetLootRecipient(Unit *unit, bool withGroup=true)
Definition: Creature.cpp:1315
bool SetDisableGravity(bool disable, bool packetOnly=false, bool updateAnimationTier=true) override
Enable or disable the creature's fly mode by adding or removing: MOVEMENTFLAG_FLYING....
Definition: Creature.cpp:3192
void SetCannotReachTarget(ObjectGuid const &target=ObjectGuid::Empty)
Definition: Creature.cpp:3647
bool SetHover(bool enable, bool packetOnly=false, bool updateAnimationTier=true) override
Definition: Creature.cpp:3357
void SetMeleeDamageSchool(SpellSchools school)
Definition: Creature.h:168
uint32 dmgschool
Definition: CreatureData.h:210
virtual void setDeathState(DeathState s, bool despawn=false)
Definition: Unit.cpp:14507
void SetFullHealth()
Definition: Unit.h:884
void Dismount()
Definition: Unit.cpp:13481
bool HasUnitMovementFlag(uint32 f) const
Definition: Unit.h:1613
virtual bool IsUnderWater() const
Definition: Unit.cpp:4326
void RemoveUnitMovementFlag(uint32 f)
Definition: Unit.h:1612
void ReplaceAllNpcFlags(NPCFlags flags)
Definition: Unit.h:697
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:624

References Unit::ClearUnitState(), 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(), LoadCreaturesAddon(), m_corpseDelay, m_corpseRemoveTime, m_formation, m_respawnDelay, m_respawnTime, Motion_Initialize(), MotionMaster::MoveFall(), MOVEMENTFLAG_FALLING, CreatureTemplate::npcflag, Unit::RemoveUnitMovementFlag(), Unit::ReplaceAllNpcFlags(), ResetPlayerDamageReq(), SaveRespawnTime(), WorldObject::setActive(), SetCannotReachTarget(), Unit::setDeathState(), SetDisableGravity(), Unit::SetFullHealth(), SetHover(), SetLootRecipient(), SetMeleeDamageSchool(), SetNoSearchAssistance(), Unit::SetPhaseMask(), SetTarget(), UNIT_NPC_FLAG_NONE, UNIT_STATE_ALL_STATE, UNIT_STATE_IGNORE_PATHFINDING, UNIT_STATE_NO_ENVIRONMENT_UPD, and UpdateMovementFlags().

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

◆ SetDefaultMovementType()

◆ SetDetectionDistance()

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

References m_detectionDistance.

Referenced by UpdateEntry().

◆ SetDisableGravity()

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

Enable or disable the creature's fly mode by adding or removing: MOVEMENTFLAG_FLYING. Infom also the client.

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

movement counter

Reimplemented from Unit.

3193{
3196 if (!packetOnly && !Unit::SetDisableGravity(disable))
3197 return false;
3198
3199 if (m_movedByPlayer)
3200 {
3202 data << GetPackGUID();
3203 data << uint32(0);
3205
3206 data.Initialize(MSG_MOVE_GRAVITY_CHNG, 64);
3207 data << GetPackGUID();
3208 BuildMovementPacket(&data);
3209 m_movedByPlayer->ToPlayer()->SendMessageToSet(&data, false);
3210 return true;
3211 }
3212
3213 if (updateAnimationTier && IsAlive() && !HasUnitState(UNIT_STATE_ROOT) && !IsRooted())
3214 {
3215 if (IsLevitating())
3217 else if (IsHovering())
3219 else
3221 }
3222
3224 data << GetPackGUID();
3225 SendMessageToSet(&data, false);
3226 return true;
3227}
@ UNIT_BYTE1_FLAG_FLY
Definition: UnitDefines.h:61
@ UNIT_BYTE1_FLAG_GROUND
Definition: UnitDefines.h:58
@ UNIT_BYTE1_FLAG_HOVER
Definition: UnitDefines.h:60
@ UNIT_STATE_ROOT
Definition: UnitDefines.h:159
@ SMSG_SPLINE_MOVE_GRAVITY_DISABLE
Definition: Opcodes.h:1265
@ SMSG_MOVE_GRAVITY_DISABLE
Definition: Opcodes.h:1260
@ SMSG_MOVE_GRAVITY_ENABLE
Definition: Opcodes.h:1262
@ SMSG_SPLINE_MOVE_GRAVITY_ENABLE
Definition: Opcodes.h:1266
@ MSG_MOVE_GRAVITY_CHNG
Definition: Opcodes.h:1264
bool IsRooted() const
Definition: Creature.h:86
bool IsLevitating() const
Definition: Unit.h:1694
virtual bool SetDisableGravity(bool disable, bool packetOnly=false, bool updateAnimationTier=true)
Definition: Unit.cpp:20520

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

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

◆ SetDisableReputationGain()

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

References DisableReputationGain.

◆ SetDisplayFromModel()

void Creature::SetDisplayFromModel ( uint32  modelIdx)
3527{
3528 if (CreatureModel const* model = GetCreatureTemplate()->GetModelByIdx(modelIdx))
3529 SetDisplayId(model->CreatureDisplayID, model->DisplayScale);
3530}

References GetCreatureTemplate(), and SetDisplayId().

Referenced by npc_eye_of_acherus::npc_eye_of_acherus(), and npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::npc_scarlet_miner_cartAI().

◆ SetDisplayId()

void Creature::SetDisplayId ( uint32  displayId,
float  displayScale = 1.f 
)
overridevirtual

Reimplemented from Unit.

Reimplemented in Pet.

3506{
3507 Unit::SetDisplayId(modelId, displayScale);
3508
3509 float combatReach = DEFAULT_WORLD_OBJECT_SIZE;
3510
3511 if (CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelInfo(modelId))
3512 {
3513 SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, (IsPet() ? 1.0f : minfo->bounding_radius) * GetObjectScale());
3514 if (minfo->combat_reach > 0)
3515 combatReach = minfo->combat_reach;
3516 }
3517
3518 if (IsPet())
3519 combatReach = DEFAULT_COMBAT_REACH;
3520
3521 SetObjectScale(displayScale);
3522
3524}
@ UNIT_FIELD_COMBATREACH
Definition: UpdateFields.h:123
@ UNIT_FIELD_BOUNDINGRADIUS
Definition: UpdateFields.h:122
#define DEFAULT_WORLD_OBJECT_SIZE
Definition: ObjectDefines.h:45
#define DEFAULT_COMBAT_REACH
Definition: ObjectDefines.h:46
float GetObjectScale() const
Definition: Object.h:115
virtual void SetDisplayId(uint32 modelId, float displayScale=1.f)
Definition: Unit.cpp:16718

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

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

◆ SetFeatherFall()

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

movement counter

Reimplemented from Unit.

3333{
3334 if (!packetOnly && !Unit::SetFeatherFall(enable))
3335 return false;
3336
3337 if (m_movedByPlayer)
3338 {
3340 data << GetPackGUID();
3341 data << uint32(0);
3343
3344 data.Initialize(MSG_MOVE_FEATHER_FALL, 64);
3345 data << GetPackGUID();
3346 BuildMovementPacket(&data);
3347 m_movedByPlayer->ToPlayer()->SendMessageToSet(&data, false);
3348 return true;
3349 }
3350
3352 data << GetPackGUID();
3353 SendMessageToSet(&data, true);
3354 return true;
3355}
@ SMSG_MOVE_FEATHER_FALL
Definition: Opcodes.h:272
@ SMSG_MOVE_NORMAL_FALL
Definition: Opcodes.h:273
@ MSG_MOVE_FEATHER_FALL
Definition: Opcodes.h:718
@ SMSG_SPLINE_MOVE_NORMAL_FALL
Definition: Opcodes.h:804
@ SMSG_SPLINE_MOVE_FEATHER_FALL
Definition: Opcodes.h:803
virtual bool SetFeatherFall(bool enable, bool packetOnly=false)
Definition: Unit.cpp:20607

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

◆ SetFormation()

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

References m_formation.

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

◆ SetHomePosition() [1/2]

void Creature::SetHomePosition ( const Position pos)
inline

◆ SetHomePosition() [2/2]

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

References m_homePosition, and Position::Relocate().

Referenced by Battleground::AddCreature(), boss_loatheb::boss_loathebAI::boss_loathebAI(), MotionTransport::CreateNPCPassenger(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::DestroyDoor(), boss_taldaram::DoAction(), npc_icc_spire_frostwyrm::DoAction(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), boss_nightbane::EnterEvadeMode(), boss_ayamiss::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::GoSiphon(), WorldSession::HandleBattlemasterHelloOpcode(), WorldSession::HandleGossipHelloOpcode(), spell_item_toxic_wasteling::HandleJump(), WorldSession::HandleQuestgiverHelloOpcode(), boss_eck::boss_eckAI::InitializeAI(), boss_flame_leviathan::boss_flame_leviathanAI::InitializeAI(), boss_aeonus::IsSummonedBy(), npc_simone::npc_simoneAI::JustDied(), boss_mandokir::boss_mandokirAI::JustEngagedWith(), boss_urom::boss_uromAI::JustEngagedWith(), boss_flame_leviathan::boss_flame_leviathanAI::JustEngagedWith(), boss_kelthuzad::boss_kelthuzadAI::JustSummoned(), npc_daphne_stilwell::npc_daphne_stilwellAI::JustSummoned(), npc_hor_lich_king::npc_hor_lich_kingAI::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustSummoned(), CreatureGroup::LeaderMoveTo(), LoadCreatureFromDB(), boss_nalorakk::MoveInLineOfSight(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::MoveInLineOfSight(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::MoveInLineOfSight(), boss_mandokir::boss_mandokirAI::MovementInform(), npc_enslaved_proto_drake::npc_enslaved_proto_drakeAI::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(), boss_ghazan::MovementInform(), npc_escortAI::MovementInform(), SmartAI::MovepointReached(), RemoveCorpse(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::Reposition(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::Reposition(), boss_arlokk::boss_arlokkAI::Reset(), boss_jeklik::Reset(), npc_simone::npc_simoneAI::RespawnPet(), WorldSession::SendListInventory(), gunship_npc_AI::SetData(), NPCStaveQuestAI::SetHomePosition(), Battlefield::SpawnCreature(), boss_urom::boss_uromAI::SpellHit(), boss_majordomo::boss_majordomoAI::SpellHit(), boss_ionar::boss_ionarAI::Split(), WaypointMovementGenerator< Creature >::StartMove(), Map::SummonCreature(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::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(), violet_hold_trashAI::UpdateAI(), npc_azure_saboteur::npc_azure_saboteurAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), and MotionTransport::UpdatePassengerPositions().

◆ SetHover()

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

Reimplemented from Unit.

3358{
3359 if (!packetOnly && !Unit::SetHover(enable))
3360 return false;
3361
3362 if (updateAnimationTier && IsAlive() && !HasUnitState(UNIT_STATE_ROOT) && !IsRooted())
3363 {
3364 if (IsLevitating())
3366 else if (IsHovering())
3368 else
3370 }
3371
3373 data << GetPackGUID();
3374 SendMessageToSet(&data, false);
3375 return true;
3376}
@ SMSG_SPLINE_MOVE_SET_HOVER
Definition: Opcodes.h:805
@ SMSG_SPLINE_MOVE_UNSET_HOVER
Definition: Opcodes.h:806
virtual bool SetHover(bool enable, bool packetOnly=false, bool updateAnimationTier=true)
Definition: Unit.cpp:20629

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

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

◆ SetInCombatWithZone()

void Creature::SetInCombatWithZone ( )

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

2807{
2808 if (IsAIEnabled)
2809 AI()->DoZoneInCombat();
2810}
void DoZoneInCombat(Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
Definition: CreatureAI.cpp:95

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

Referenced by npc_mograine::npc_mograineAI::DamageTaken(), npc_ghostly_priest::npc_ghostly_priestAI::DoAction(), npc_phantom_mage::npc_phantom_mageAI::DoAction(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::DoAction(), npc_spectral_footman::npc_spectral_footmanAI::DoAction(), npc_tortured_rifleman::npc_tortured_riflemanAI::DoAction(), boss_dorothee::DoAction(), boss_roar::DoAction(), boss_strawman::DoAction(), boss_tinhead::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::DoAction(), npc_risen_archmage::npc_risen_archmageAI::DoAction(), npc_living_constellation::npc_living_constellationAI::DoAction(), boss_the_lurker_below::DoAction(), boss_broggok::DoAction(), boss_grand_warlock_nethekurse::DoAction(), boss_leotheras_the_blind::DoAction(), boss_drakkari_colossus::boss_drakkari_colossusAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), boss_palehoof::boss_palehoofAI::DoAction(), npc_massive_jormungar::npc_massive_jormungarAI::DoAction(), npc_ferocious_rhino::npc_ferocious_rhinoAI::DoAction(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::DoAction(), npc_frenzied_worgen::npc_frenzied_worgenAI::DoAction(), boss_skadi::boss_skadiAI::DoAction(), boss_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_algalon_the_observer::boss_algalon_the_observerAI::EnterEvadeMode(), npc_little_ooze::npc_little_oozeAI::EnterEvadeMode(), npc_big_ooze::npc_big_oozeAI::EnterEvadeMode(), RestoreFight::Execute(), spell_teron_gorefiend_shadowy_construct::HandleEffectApply(), spell_mutate_explode_bug::HandleOnHit(), spell_the_lich_king_vile_spirit_move_target_search::HandleScript(), spell_putricide_mutated_transformation::HandleSummon(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::InitFight(), boss_glob_of_viscidus::InitializeAI(), brann_bronzebeard::brann_bronzebeardAI::InitializeEvent(), npc_corrupted_totem::IsSummonedBy(), npc_living_inferno::npc_living_infernoAI::IsSummonedBy(), npc_parasitic_shadowfiend::IsSummonedBy(), npc_blade_of_azzinoth::IsSummonedBy(), npc_flame_of_azzinoth::IsSummonedBy(), npc_supremus_punch_invisible_stalker::IsSummonedBy(), boss_felblood_kaelthas::JustEngagedWith(), boss_headless_horseman::JustEngagedWith(), boss_volazj::JustEngagedWith(), boss_twilight_halion::boss_twilight_halionAI::JustEngagedWith(), boss_faction_championsAI::JustEngagedWith(), npc_risen_archmage::npc_risen_archmageAI::JustEngagedWith(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::JustEngagedWith(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::JustEngagedWith(), boss_drakos::boss_drakosAI::JustEngagedWith(), boss_eregos::boss_eregosAI::JustEngagedWith(), boss_urom::boss_uromAI::JustEngagedWith(), boss_varos::boss_varosAI::JustEngagedWith(), boss_bjarngrim::boss_bjarngrimAI::JustEngagedWith(), boss_ionar::boss_ionarAI::JustEngagedWith(), boss_loken::boss_lokenAI::JustEngagedWith(), boss_volkhan::boss_volkhanAI::JustEngagedWith(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustEngagedWith(), boss_flame_leviathan::boss_flame_leviathanAI::JustEngagedWith(), boss_freya::boss_freyaAI::JustEngagedWith(), boss_vezax::boss_vezaxAI::JustEngagedWith(), boss_razorscale::boss_razorscaleAI::JustEngagedWith(), boss_xt002::boss_xt002AI::JustEngagedWith(), boss_skadi::boss_skadiAI::JustEngagedWith(), boss_skadi_grauf::boss_skadi_graufAI::JustEngagedWith(), boss_svala::boss_svalaAI::JustEngagedWith(), npc_frozen_orb::npc_frozen_orbAI::JustEngagedWith(), boss_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(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::JustEngagedWith(), boss_trollgore::boss_trollgoreAI::JustEngagedWith(), boss_sindragosa::boss_sindragosaAI::JustEngagedWith(), boss_gluth::boss_gluthAI::JustEngagedWith(), boss_gothik::boss_gothikAI::JustEngagedWith(), boss_grobbulus::boss_grobbulusAI::JustEngagedWith(), boss_heigan::boss_heiganAI::JustEngagedWith(), boss_loatheb::boss_loathebAI::JustEngagedWith(), boss_maexxna::boss_maexxnaAI::JustEngagedWith(), boss_patchwerk::boss_patchwerkAI::JustEngagedWith(), boss_thaddius::boss_thaddiusAI::JustEngagedWith(), boss_steelbreaker::boss_steelbreakerAI::JustEngagedWith(), boss_runemaster_molgeim::boss_runemaster_molgeimAI::JustEngagedWith(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::JustEngagedWith(), boss_fathomlord_karathress::JustEngagedWith(), boss_magtheridon::JustEngagedWith(), boss_anubrekhan::boss_anubrekhanAI::JustSummoned(), boss_grobbulus::boss_grobbulusAI::JustSummoned(), boss_loatheb::boss_loathebAI::JustSummoned(), boss_maexxna::boss_maexxnaAI::JustSummoned(), boss_auriaya::boss_auriayaAI::JustSummoned(), npc_ouro_spawner::JustSummoned(), npc_dirt_mound::JustSummoned(), boss_dalronn_the_controller::boss_dalronn_the_controllerAI::JustSummoned(), boss_urom::boss_uromAI::JustSummoned(), npc_hor_lich_king::npc_hor_lich_kingAI::JustSummoned(), boss_curator::JustSummoned(), npc_demonic_vapor_trail::npc_demonic_vapor_trailAI::JustSummoned(), npc_kiljaeden_controller::npc_kiljaeden_controllerAI::JustSummoned(), boss_muru::boss_muruAI::JustSummoned(), boss_halazzi::JustSummoned(), boss_hazzarah::JustSummoned(), boss_anetheron::JustSummoned(), npc_hive_zara_larva::JustSummoned(), boss_anub_arak::boss_anub_arakAI::JustSummoned(), boss_novos::boss_novosAI::JustSummoned(), boss_slad_ran::boss_slad_ranAI::JustSummoned(), boss_professor_putricide::boss_professor_putricideAI::JustSummoned(), boss_gothik::boss_gothikAI::JustSummoned(), boss_noth::boss_nothAI::JustSummoned(), boss_magus_telestra::boss_magus_telestraAI::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_nalorakk::MoveInLineOfSight(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::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(), npc_ulduar_saronite_animus::npc_ulduar_saronite_animusAI::npc_ulduar_saronite_animusAI(), instance_karazhan::instance_karazhan_InstanceMapScript::OnCreatureCreate(), boss_nightbane::PathEndReached(), boss_julianne::Reset(), boss_headless_horseman_head::Reset(), npc_twilight_summon::npc_twilight_summonAI::Reset(), boss_twilight_halion::boss_twilight_halionAI::Reset(), boss_yoggsaron_guardian_of_ys::boss_yoggsaron_guardian_of_ysAI::Reset(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::Reset(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::Reset(), npc_tainted_elemental::Reset(), instance_naxxramas::instance_naxxramas_InstanceMapScript::SetBossState(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::SetData(), npc_argent_captainAI::SpellHit(), spell_putricide_ooze_channel::StartAttack(), brann_bronzebeard::brann_bronzebeardAI::SummonCreatures(), Update(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), boss_entropius::boss_entropiusAI::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), boss_krik_thir::boss_krik_thirAI::UpdateAI(), boss_falric::boss_falricAI::UpdateAI(), boss_marwyn::boss_marwynAI::UpdateAI(), npc_phantom_hallucination::npc_phantom_hallucinationAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_vengeful_shade::npc_vengeful_shadeAI::UpdateAI(), npc_little_ooze::npc_little_oozeAI::UpdateAI(), npc_big_ooze::npc_big_oozeAI::UpdateAI(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_flame_leviathan::boss_flame_leviathanAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_anzu::UpdateAI(), and npc_onyx_flamecaller::npc_onyx_flamecallerAI::WaypointReached().

◆ SetLastLeashExtensionTimePtr()

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

References m_lastLeashExtensionTime.

Referenced by AssistDelayEvent::Execute().

◆ SetLootMode()

◆ SetLootRecipient()

void Creature::SetLootRecipient ( Unit unit,
bool  withGroup = true 
)
1316{
1317 // set the player whose group should receive the right
1318 // to loot the creature after it dies
1319 // should be set to nullptr after the loot disappears
1320
1321 if (!unit)
1322 {
1327 return;
1328 }
1329
1331 if (!player) // normal creature, no player involved
1332 return;
1333
1334 m_lootRecipient = player->GetGUID();
1335
1336 Map* map = GetMap();
1337 if (map && map->IsDungeon() && (isWorldBoss() || IsDungeonBoss()))
1338 {
1340 }
1341
1342 if (withGroup)
1343 {
1344 if (Group* group = player->GetGroup())
1345 {
1346 m_lootRecipientGroup = group->GetGUID().GetCounter();
1347
1348 if (map && map->IsDungeon() && (isWorldBoss() || IsDungeonBoss()))
1349 {
1350 Map::PlayerList const& PlayerList = map->GetPlayers();
1351 for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
1352 {
1353 if (Player* groupMember = i->GetSource())
1354 {
1355 if (groupMember->IsGameMaster() || groupMember->IsSpectator())
1356 {
1357 continue;
1358 }
1359
1360 if (groupMember->GetGroup() == group)
1361 {
1362 AddAllowedLooter(groupMember->GetGUID());
1363 }
1364 }
1365 }
1366 }
1367 }
1368 }
1369 else
1371
1373}
@ UNIT_DYNFLAG_TAPPED
Definition: SharedDefines.h:3123
@ UNIT_DYNFLAG_LOOTABLE
Definition: SharedDefines.h:3121
Definition: LinkedList.h:139
bool IsDungeonBoss() const
Definition: Creature.cpp:3157
virtual void RemoveDynamicFlag(uint32 flag)
Definition: Object.h:121
virtual void SetDynamicFlag(uint32 flag)
Definition: Object.h:120
void ResetAllowedLooters()
Definition: Object.cpp:3195
void AddAllowedLooter(ObjectGuid guid)
Definition: Object.cpp:3185
void Clear()
Definition: ObjectGuid.h:138
Group * GetGroup()
Definition: Player.h:2448
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition: Unit.cpp:10578
Definition: Map.h:313
bool IsDungeon() const
Definition: Map.h:448
PlayerList const & GetPlayers() const
Definition: Map.h:486
Definition: MapRefMgr.h:26
iterator begin()
Definition: MapRefMgr.h:36
iterator end()
Definition: MapRefMgr.h:37

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

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

◆ SetMeleeDamageSchool()

void Creature::SetMeleeDamageSchool ( SpellSchools  school)
inline

◆ SetNoCallAssistance()

◆ SetNoSearchAssistance()

void Creature::SetNoSearchAssistance ( bool  val)
inline

◆ SetObjectScale()

void Creature::SetObjectScale ( float  scale)
overridevirtual

◆ SetOriginalEntry()

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

References m_originalEntry.

Referenced by CreateFromProto().

◆ SetPickPocketLootTime()

void Creature::SetPickPocketLootTime ( )
3753{
3755}
time_t const & GetRespawnTime() const
Definition: Creature.h:286
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 ( const Position pos)
inline

◆ SetPosition() [2/2]

void Creature::SetPosition ( float  x,
float  y,
float  z,
float  o 
)
3150{
3151 if (!Acore::IsValidMapCoord(x, y, z, o))
3152 return;
3153
3154 GetMap()->CreatureRelocation(this, x, y, z, o);
3155}
void CreatureRelocation(Creature *creature, float x, float y, float z, float o)
Definition: Map.cpp:1022

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

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

◆ 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
97{ m_reactState = state; }

References m_reactState.

Referenced by boss_halion::boss_halionAI::AttackStart(), boss_faction_championsAI::boss_faction_championsAI(), boss_felmyst::boss_felmystAI::boss_felmystAI(), boss_glob_of_viscidus::boss_glob_of_viscidus(), boss_gormok::boss_gormokAI::boss_gormokAI(), boss_grand_champion::boss_grand_championAI::boss_grand_championAI(), boss_icehowl::boss_icehowlAI::boss_icehowlAI(), boss_jaraxxus::boss_jaraxxusAI::boss_jaraxxusAI(), boss_jarien::boss_jarien(), boss_jormungarAI::boss_jormungarAI(), boss_kiljaeden::boss_kiljaedenAI::boss_kiljaedenAI(), boss_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_felblood_kaelthas::DamageTaken(), boss_kiljaeden::boss_kiljaedenAI::DamageTaken(), boss_jedoga_shadowseeker::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), npc_crystalline_frayer::npc_crystalline_frayerAI::DamageTaken(), boss_algalon_the_observer::boss_algalon_the_observerAI::DamageTaken(), boss_freya::boss_freyaAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), boss_taerar::boss_taerarAI::DamageTaken(), boss_thekal::DamageTaken(), boss_viscidus::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), boss_shade_of_aran::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_bug_trio::DamageTaken(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::Deactivate(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::DoAction(), boss_thekal::DoAction(), boss_archimonde::DoAction(), boss_bug_trio::DoAction(), boss_twinemperorsAI::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), npc_living_constellation::npc_living_constellationAI::DoAction(), boss_the_lurker_below::DoAction(), boss_broggok::DoAction(), boss_leotheras_the_blind::DoAction(), npc_living_mojo::npc_living_mojoAI::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(), RestoreAttack::Execute(), OrcMoveEvent::Execute(), RestoreFight::Execute(), UtherBatteredHiltEvent::Execute(), StartMovementEvent::Execute(), VileSpiritActivateEvent::Execute(), SACActivateEvent::Execute(), SACDeactivateEvent::Execute(), AssistanceDistractMovementGenerator::Finalize(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::FlyAway(), boss_volkhan::boss_volkhanAI::GoToAnvil(), spell_mc_play_dead_aura::HandleEffectApply(), spell_uldaman_stoned::spell_uldaman_stoned_AuraScript::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::spell_uldaman_stoned_AuraScript::HandleEffectRemove(), boss_ragnaros::boss_ragnarosAI::HandleEmerge(), spell_mutate_explode_bug::HandleOnHit(), WorldSession::HandlePetActionHelper(), spell_item_draenic_pale_ale::HandleSummon(), Battlefield::HideNpc(), npc_wounded_skirmisher::Initialize(), npc_frozen_core::Initialize(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::InitializeAI(), npc_general_andorov::InitializeAI(), boss_eck::boss_eckAI::InitializeAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::InitializeAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::InitializeAI(), boss_prince_valanar_icc::boss_prince_valanarAI::InitializeAI(), boss_sapphiron::boss_sapphironAI::InitializeAI(), npc_lord_arete::npc_lord_areteAI::InitializeAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), InitializeReactState(), Minion::InitStats(), Guardian::InitStats(), Puppet::InitStats(), Guardian::InitStatsForLevel(), Totem::InitSummon(), boss_jarien::IsSummonedBy(), boss_sothos::IsSummonedBy(), boss_aeonus::IsSummonedBy(), npc_parasitic_shadowfiend::IsSummonedBy(), npc_blade_of_azzinoth::IsSummonedBy(), npc_flame_of_azzinoth::IsSummonedBy(), npc_supremus_punch_invisible_stalker::IsSummonedBy(), npc_maiev_illidan::IsSummonedBy(), npc_lk_wicked_spirit::npc_lk_wicked_spiritAI::JustDied(), boss_venoxis::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(), npc_akama_illidan::JustReachedHome(), npc_lk_wicked_spirit::npc_lk_wicked_spiritAI::JustRespawned(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), boss_skeram::JustSummoned(), boss_majordomo::boss_majordomoAI::JustSummoned(), boss_selin_fireheart::JustSummoned(), boss_hazzarah::JustSummoned(), boss_jindo::JustSummoned(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustSummoned(), boss_novos::boss_novosAI::JustSummoned(), boss_bronjahm::boss_bronjahmAI::JustSummoned(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustSummoned(), boss_prince_valanar_icc::boss_prince_valanarAI::JustSummoned(), boss_professor_putricide::boss_professor_putricideAI::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), boss_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(), Pet::LoadPetFromDB(), boss_nalorakk::MoveInLineOfSight(), npc_shattered_hand_scout::MoveInLineOfSight(), boss_ayamiss::MovementInform(), boss_bug_trio::MovementInform(), boss_grand_champion::boss_grand_championAI::MovementInform(), boss_eck::boss_eckAI::MovementInform(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::MovementInform(), boss_sister_svalna::boss_sister_svalnaAI::MovementInform(), boss_four_horsemen::boss_four_horsemenAI::MovementInform(), boss_volkhan::boss_volkhanAI::MovementInform(), boss_illidan_stormrage::MovementInform(), boss_lady_vashj::MovementInform(), boss_nazan::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_rimefang::npc_rimefangAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), gunship_npc_AI::MovementInform(), npc_gunship_boarding_addAI::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), boss_warchief_kargath_bladefist::MovementInform(), boss_icehowl::boss_icehowlAI::MovementInform(), MotionMaster::MoveSeekAssistance(), npc_anubarak_spike::npc_anubarak_spikeAI::npc_anubarak_spikeAI(), npc_arcanite_dragonling::npc_arcanite_dragonling(), npc_argent_soldier::npc_argent_soldierAI::npc_argent_soldierAI(), npc_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_eye_of_acherus::npc_eye_of_acherus(), npc_frost_freeze_trap::npc_frost_freeze_trapAI::npc_frost_freeze_trapAI(), npc_grand_magister_rommath::npc_grand_magister_rommathAI::npc_grand_magister_rommathAI(), npc_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_koltira_deathweaver::npc_koltira_deathweaverAI::npc_koltira_deathweaverAI(), npc_living_constellation::npc_living_constellationAI::npc_living_constellationAI(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::npc_lk_spirit_bombAI(), npc_memory::npc_memoryAI::npc_memoryAI(), npc_nexus_lord::npc_nexus_lordAI::npc_nexus_lordAI(), npc_pet_gen_valkyr_guardian::npc_pet_gen_valkyr_guardian(), npc_pilgrims_bounty_chair::npc_pilgrims_bounty_chair(), npc_putricide_oozeAI::npc_putricide_oozeAI(), npc_q24545_vegard::npc_q24545_vegardAI::npc_q24545_vegardAI(), npc_saurfang_event::npc_saurfang_eventAI::npc_saurfang_eventAI(), npc_scarlet_miner::npc_scarlet_minerAI::npc_scarlet_minerAI(), npc_scion_of_eternity::npc_scion_of_eternityAI::npc_scion_of_eternityAI(), npc_snobold_vassal::npc_snobold_vassalAI::npc_snobold_vassalAI(), npc_suppresser::npc_suppresserAI::npc_suppresserAI(), npc_taldaram_flamesphere::npc_taldaram_flamesphere(), npc_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_expedition_commander::npc_ulduar_expedition_commanderAI::npc_ulduar_expedition_commanderAI(), npc_ulduar_hodir_druid::npc_ulduar_hodir_druidAI::npc_ulduar_hodir_druidAI(), npc_ulduar_hodir_mage::npc_ulduar_hodir_mageAI::npc_ulduar_hodir_mageAI(), npc_ulduar_hodir_priest::npc_ulduar_hodir_priestAI::npc_ulduar_hodir_priestAI(), npc_ulduar_hodir_shaman::npc_ulduar_hodir_shamanAI::npc_ulduar_hodir_shamanAI(), npc_unworthy_initiate::npc_unworthy_initiateAI::npc_unworthy_initiateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::npc_valkyr_shadowguardAI(), npc_zafod_boombox::npc_zafod_boomboxAI::npc_zafod_boomboxAI(), NullCreatureAI::NullCreatureAI(), spell_halion_twilight_phasing_aura::OnApply(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::OnCreatureCreate(), instance_zulfarrak::instance_zulfarrak_InstanceMapScript::OnCreatureCreate(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), boss_shade_of_aran::OnPowerUpdate(), spell_halion_twilight_phasing_aura::OnRemove(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::PassengerBoarded(), PassiveAI::PassiveAI(), boss_nightbane::PathEndReached(), boss_jeklik::PathEndReached(), npc_akama_illidan::PathEndReached(), boss_nefarian::PathEndReached(), PossessedAI::PossessedAI(), npc_dark_iron_attack_generator::PrepareEvent(), PretendToDie(), boss_alar::PretendToDie(), SmartScript::ProcessAction(), boss_lord_valthalak::boss_lord_valthalakAI::Reset(), boss_nefarian::Reset(), boss_vaelastrasz::boss_vaelAI::Reset(), boss_ragnaros::boss_ragnarosAI::Reset(), boss_mr_smite::boss_mr_smiteAI::Reset(), npc_chesspiece::Reset(), boss_midnight::Reset(), boss_nightbane::Reset(), npc_crusade_persuaded::npc_crusade_persuadedAI::Reset(), boss_felmyst::boss_felmystAI::Reset(), boss_kalecgos::boss_kalecgosAI::Reset(), boss_muru::boss_muruAI::Reset(), boss_entropius::boss_entropiusAI::Reset(), boss_nalorakk::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(), npc_amanitar_mushrooms::Reset(), boss_jedoga_shadowseeker::Reset(), boss_halion::boss_halionAI::Reset(), boss_twilight_halion::boss_twilight_halionAI::Reset(), boss_saviana_ragefire::boss_saviana_ragefireAI::Reset(), boss_eadric::boss_eadricAI::Reset(), boss_paletress::boss_paletressAI::Reset(), boss_black_knight::boss_black_knightAI::Reset(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::Reset(), boss_grand_champion::boss_grand_championAI::Reset(), boss_devourer_of_souls::boss_devourer_of_soulsAI::Reset(), boss_garfrost::boss_garfrostAI::Reset(), boss_ick::boss_ickAI::Reset(), boss_prince_keleseth_icc::boss_prince_kelesethAI::Reset(), boss_prince_taldaram_icc::boss_prince_taldaramAI::Reset(), boss_prince_valanar_icc::boss_prince_valanarAI::Reset(), npc_dark_nucleus::npc_dark_nucleusAI::Reset(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::Reset(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::Reset(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::Reset(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::Reset(), boss_lord_marrowgar::Reset(), boss_professor_putricide::boss_professor_putricideAI::Reset(), boss_sindragosa::boss_sindragosaAI::Reset(), npc_spinestalker::npc_spinestalkerAI::Reset(), npc_rimefang::npc_rimefangAI::Reset(), 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_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::Reset(), boss_volkhan::boss_volkhanAI::Reset(), brann_bronzebeard::brann_bronzebeardAI::Reset(), boss_algalon_the_observer::boss_algalon_the_observerAI::Reset(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::Reset(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::Reset(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::Reset(), boss_thorim_sif::boss_thorim_sifAI::Reset(), npc_beryl_sorcerer::npc_beryl_sorcererAI::Reset(), npc_imprisoned_beryl_sorcerer::npc_imprisoned_beryl_sorcererAI::Reset(), npc_venture_co_straggler::npc_venture_co_stragglerAI::Reset(), npc_voidtraveler::Reset(), npc_akama_illidan::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_lord_sanguinar::Reset(), npc_capernian::Reset(), npc_telonicus::Reset(), npc_thaladred::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::npc_pet_dk_ebon_gargoyleAI::Reset(), emerald_dragonAI::Reset(), Resurrect(), boss_magtheridon::ScheduleCombatEvents(), boss_the_lurker_below::SchedulerPhaseOne(), boss_laj::ScheduleTasks(), Unit::SetCharmedBy(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::SetData(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::SetData(), gunship_npc_AI::SetData(), npc_gunship_boarding_addAI::SetData(), CreatureAI::SetGazeOn(), BfGraveyard::SetSpirit(), Battlefield::ShowNpc(), boss_viscidus::SoftReset(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::SpellHit(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::SpellHit(), npc_ulduar_vx001::npc_ulduar_vx001AI::SpellHit(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::SpellHit(), npc_crusade_persuaded::npc_crusade_persuadedAI::SpellHit(), npc_venture_co_straggler::npc_venture_co_stragglerAI::SpellHit(), npc_enslaved_netherwing_drake::SpellHit(), boss_garfrost::boss_garfrostAI::SpellHitTarget(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), boss_ick::boss_ickAI::SpellHitTarget(), npc_wounded_blood_elf::npc_wounded_blood_elfAI::sQuestAccept(), boss_noth::boss_nothAI::StartBalconyPhase(), instance_violet_hold::instance_violet_hold_InstanceMapScript::StartBossEncounter(), boss_lord_valthalak::boss_lord_valthalakAI::StartFighting(), boss_heigan::boss_heiganAI::StartFightPhase(), boss_noth::boss_nothAI::StartGroundPhase(), boss_lord_valthalak::boss_lord_valthalakAI::StartTalking(), boss_ouro::Submerge(), boss_jedoga_shadowseeker::SummonedCreatureDies(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), boss_entropius::boss_entropiusAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_grilek::boss_grilekAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), npc_hallows_end_soh::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_onyxia::UpdateAI(), npc_belnistrasz::npc_belnistraszAI::UpdateAI(), boss_sartura::UpdateAI(), npc_sartura_royal_guard::UpdateAI(), boss_skeram::UpdateAI(), npc_murkdeep::npc_murkdeepAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), npc_memory::npc_memoryAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_pos_tyrannus_events::npc_pos_tyrannus_eventsAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), npc_crystalline_frayer::npc_crystalline_frayerAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_lurgglbr::npc_lurgglbrAI::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), boss_taerar::boss_taerarAI::UpdateAI(), CreatureAI::UpdateVictimWithGaze(), npc_arthas::npc_arthasAI::WaypointReached(), npc_general_andorov::WaypointReached(), and npc_apothecary_hanes::npc_Apothecary_HanesAI::WaypointReached().

◆ SetRegeneratingHealth()

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

References m_regenHealth.

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

◆ SetRegeneratingPower()

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

References m_regenPower.

Referenced by boss_moam::Reset().

◆ SetRespawnDelay()

◆ SetRespawnTime()

◆ SetSwim()

bool Creature::SetSwim ( bool  enable)
overridevirtual

Reimplemented from Unit.

3230{
3231 if (!Unit::SetSwim(enable))
3232 return false;
3233
3235 data << GetPackGUID();
3236 SendMessageToSet(&data, true);
3237 return true;
3238}
@ SMSG_SPLINE_MOVE_STOP_SWIM
Definition: Opcodes.h:810
@ SMSG_SPLINE_MOVE_START_SWIM
Definition: Opcodes.h:809
virtual bool SetSwim(bool enable)
Definition: Unit.cpp:20538

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

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

◆ SetTarget()

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

Implements Unit.

3533{
3534 if (!_focusSpell)
3536}

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

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

◆ SetTransportHomePosition() [1/2]

void Creature::SetTransportHomePosition ( const Position pos)
inline

◆ SetTransportHomePosition() [2/2]

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

◆ SetWalk()

bool Creature::SetWalk ( bool  enable)
overridevirtual

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

Reimplemented from Unit.

3179{
3180 if (!Unit::SetWalk(enable))
3181 return false;
3182
3184 data << GetPackGUID();
3185 SendMessageToSet(&data, false);
3186 return true;
3187}
@ SMSG_SPLINE_MOVE_SET_RUN_MODE
Definition: Opcodes.h:811
@ SMSG_SPLINE_MOVE_SET_WALK_MODE
Definition: Opcodes.h:812
virtual bool SetWalk(bool enable)
Definition: Unit.cpp:20506

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

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

◆ SetWanderDistance()

void Creature::SetWanderDistance ( float  dist)
inline

◆ SetWaterWalking()

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

Allow to walk on water. Doesn't inform the client. Need to use SendMovementWaterWalking() if it's for players.

movement counter

Reimplemented from Unit.

3308{
3309 if (!packetOnly && !Unit::SetWaterWalking(enable))
3310 return false;
3311
3312 if (m_movedByPlayer)
3313 {
3315 data << GetPackGUID();
3316 data << uint32(0);
3318
3319 data.Initialize(MSG_MOVE_WATER_WALK, 64);
3320 data << GetPackGUID();
3321 BuildMovementPacket(&data);
3322 m_movedByPlayer->ToPlayer()->SendMessageToSet(&data, false);
3323 return true;
3324 }
3325
3327 data << GetPackGUID();
3328 SendMessageToSet(&data, true);
3329 return true;
3330}
@ SMSG_MOVE_LAND_WALK
Definition: Opcodes.h:253
@ SMSG_SPLINE_MOVE_LAND_WALK
Definition: Opcodes.h:808
@ SMSG_MOVE_WATER_WALK
Definition: Opcodes.h:252
@ MSG_MOVE_WATER_WALK
Definition: Opcodes.h:719
@ SMSG_SPLINE_MOVE_WATER_WALK
Definition: Opcodes.h:807
virtual bool SetWaterWalking(bool enable, bool packetOnly=false)
Allow to walk on water. Doesn't inform the client. Need to use SendMovementWaterWalking() if it's for...
Definition: Unit.cpp:20585

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

◆ Update()

void Creature::Update ( uint32  time)
overridevirtual

Reimplemented from WorldObject.

Reimplemented in Pet, TempSummon, Puppet, and Totem.

657{
659 {
660 TriggerJustRespawned = false;
661 AI()->JustRespawned();
662 if (m_vehicleKit)
664 }
665
666 switch (m_deathState)
667 {
668 case DeathState::JustRespawned:
669 // Must not be called, see Creature::setDeathState JUST_RESPAWNED -> ALIVE promoting.
670 LOG_ERROR("entities.unit", "Creature ({}) in wrong state: DeathState::JustRespawned (4)", GetGUID().ToString());
671 break;
672 case DeathState::JustDied:
673 // Must not be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting.
674 LOG_ERROR("entities.unit", "Creature ({}) in wrong state: DeathState::JustDead (1)", GetGUID().ToString());
675 break;
676 case DeathState::Dead:
677 {
678 time_t now = GameTime::GetGameTime().count();
679 if (m_respawnTime <= now)
680 {
681 Respawn();
682 }
683 break;
684 }
685 case DeathState::Corpse:
686 {
687 Unit::Update(diff);
688 // deathstate changed on spells update, prevent problems
689 if (m_deathState != DeathState::Corpse)
690 break;
691
693 {
694 if (m_groupLootTimer <= diff)
695 {
696 Group* group = sGroupMgr->GetGroupByGUID(lootingGroupLowGUID);
697 if (group)
698 group->EndRoll(&loot, GetMap());
701 }
702 else
703 {
704 m_groupLootTimer -= diff;
705 }
706 }
707 else if (m_corpseRemoveTime <= GameTime::GetGameTime().count())
708 {
709 RemoveCorpse(false);
710 LOG_DEBUG("entities.unit", "Removing corpse... {} ", GetUInt32Value(OBJECT_FIELD_ENTRY));
711 }
712 break;
713 }
714 case DeathState::Alive:
715 {
716 Unit::Update(diff);
717
718 // creature can be dead after Unit::Update call
719 // CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly)
720 if (!IsAlive())
721 break;
722
723 // if creature is charmed, switch to charmed AI
724 if (NeedChangeAI)
725 {
727 NeedChangeAI = false;
728 IsAIEnabled = true;
729
730 // xinef: update combat state, if npc is not in combat - return to spawn correctly by calling EnterEvadeMode
731 SelectVictim();
732 }
733
734 // if periodic combat pulse is enabled and we are both in combat and in a dungeon, do this now
735 if (m_combatPulseDelay > 0 && IsInCombat() && GetMap()->IsDungeon())
736 {
737 if (diff > m_combatPulseTime)
739 else
740 m_combatPulseTime -= diff;
741
742 if (m_combatPulseTime == 0)
743 {
744 if (AI())
745 AI()->DoZoneInCombat();
746 else
749 }
750 }
751
752 // periodic check to see if the creature has passed an evade boundary
753 if (IsAIEnabled && !IsInEvadeMode() && IsEngaged())
754 {
755 if (diff >= m_boundaryCheckTime)
756 {
757 AI()->CheckInRoom();
758 m_boundaryCheckTime = 2500;
759 }
760 else
761 m_boundaryCheckTime -= diff;
762 }
763
764 Unit* owner = GetCharmerOrOwner();
765 if (IsCharmed() && !IsWithinDistInMap(owner, GetMap()->GetVisibilityRange(), true, false))
766 {
768 }
769
770 if (Unit* victim = GetVictim())
771 {
772 // If we are closer than 50% of the combat reach we are going to reposition the victim
773 if (diff >= m_moveBackwardsMovementTime)
774 {
775 float MaxRange = GetCollisionRadius() + GetVictim()->GetCollisionRadius();
776
777 if (IsInDist(victim, MaxRange))
779
781 }
782 else
783 {
785 }
786
787 // Circling the target
788 if (diff >= m_moveCircleMovementTime)
789 {
790 AI()->MoveCircleChecks();
792 }
793 else
794 {
796 }
797 }
798
799 // Call for assistance if not disabled
801 {
802 if (m_assistanceTimer <= diff)
803 {
805 {
806 SetNoCallAssistance(false);
808 }
810 }
811 else
812 {
813 m_assistanceTimer -= diff;
814 }
815 }
816
817 if (!IsInEvadeMode() && IsAIEnabled)
818 {
819 // do not allow the AI to be changed during update
820 m_AI_locked = true;
821 i_AI->UpdateAI(diff);
822 m_AI_locked = false;
823 }
824
825 // creature can be dead after UpdateAI call
826 // CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly)
827 if (!IsAlive())
828 break;
829
830 m_regenTimer -= diff;
831 if (m_regenTimer <= 0)
832 {
833 if (!IsInEvadeMode())
834 {
835 // regenerate health if not in combat or if polymorphed)
836 if (!IsInCombat() || IsPolymorphed())
839 {
840 // regenerate health if cannot reach the target and the setting is set to do so.
841 // this allows to disable the health regen of raid bosses if pathfinding has issues for whatever reason
842 if (sWorld->getBoolConfig(CONFIG_REGEN_HP_CANNOT_REACH_TARGET_IN_RAID) || !GetMap()->IsRaid())
843 {
845 LOG_DEBUG("entities.unit", "RegenerateHealth() enabled because Creature cannot reach the target. Detail: {}", GetDebugInfo());
846 }
847 else
848 LOG_DEBUG("entities.unit", "RegenerateHealth() disabled even if the Creature cannot reach the target. Detail: {}", GetDebugInfo());
849 }
850 }
851
852 if (getPowerType() == POWER_ENERGY)
854 else
856
858 }
859
861 {
862 m_cannotReachTimer += diff;
864 {
865 Player* cannotReachPlayer = ObjectAccessor::GetPlayer(*this, m_cannotReachTarget);
866 if (cannotReachPlayer && IsEngagedBy(cannotReachPlayer) && IsAIEnabled && AI()->OnTeleportUnreacheablePlayer(cannotReachPlayer))
867 {
869 }
870 else if (!GetMap()->IsRaid())
871 {
872 auto EnterEvade = [&]()
873 {
874 if (CreatureAI* ai = AI())
875 {
877 }
878 };
879
880 if (GetThreatMgr().GetThreatListSize() <= 1)
881 {
882 EnterEvade();
883 }
884 else
885 {
886 if (HostileReference* ref = GetThreatMgr().GetOnlineContainer().getReferenceByTarget(m_cannotReachTarget))
887 {
888 ref->removeReference();
890 }
891 else
892 {
893 EnterEvade();
894 }
895 }
896 }
897 }
898 }
899 break;
900 }
901 default:
902 break;
903 }
904
906 {
907 // pussywizard:
908 if (GetOwnerGUID().IsPlayer())
909 {
910 if (m_transportCheckTimer <= diff)
911 {
914 if (newTransport != GetTransport())
915 {
916 if (GetTransport())
917 GetTransport()->RemovePassenger(this, true);
918 if (newTransport)
919 newTransport->AddPassenger(this, true);
921 //SendMovementFlagUpdate();
922 }
923 }
924 else
925 m_transportCheckTimer -= diff;
926 }
927
928 sScriptMgr->OnCreatureUpdate(this, diff);
929 }
930}
@ CONFIG_NPC_EVADE_IF_NOT_REACHABLE
Definition: IWorld.h:416
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_PERIOD
Definition: IWorld.h:288
@ CONFIG_REGEN_HP_CANNOT_REACH_TARGET_IN_RAID
Definition: IWorld.h:172
@ OBJECT_FIELD_ENTRY
Definition: UpdateFields.h:27
Player * GetPlayer(Map const *, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:223
virtual void UpdateAI(uint32)=0
Use to start attacking a target. Called just before JustEngagedWith()
void MoveCircleChecks()
Definition: CreatureAI.cpp:343
@ EVADE_REASON_NO_PATH
Definition: CreatureAI.h:93
virtual void JustRespawned()
Definition: CreatureAI.h:153
virtual bool CheckInRoom()
Definition: CreatureAI.cpp:395
void MoveBackwardsChecks()
Definition: CreatureAI.cpp:360
Definition: ThreatMgr.h:49
float GetThreatListSize() const
Definition: ThreatMgr.h:222
void SetInCombatWithZone()
Set in combat all units in the dungeon/raid. Affect only units with IsAIEnabled.
Definition: Creature.cpp:2806
void Respawn(bool force=false)
Definition: Creature.cpp:2030
void RegenerateHealth()
Definition: Creature.cpp:1015
void CallAssistance(Unit *target=nullptr)
Definition: Creature.cpp:2428
static constexpr uint32 MOVE_BACKWARDS_CHECK_INTERVAL
Definition: Creature.h:392
bool CanPeriodicallyCallForAssistance() const
Definition: Creature.cpp:3705
uint32 m_moveCircleMovementTime
Definition: Creature.h:393
uint32 m_moveBackwardsMovementTime
Definition: Creature.h:394
static constexpr uint32 MOVE_CIRCLE_CHECK_INTERVAL
Definition: Creature.h:391
Unit * SelectVictim()
Definition: Unit.cpp:14688
bool IsNotReachableAndNeedRegen() const
Definition: Creature.cpp:3668
void Regenerate(Powers power)
Definition: Creature.cpp:946
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:305
bool IsInDist(float x, float y, float z, float dist) const
Definition: Position.h:217
virtual void RemovePassenger(WorldObject *passenger, bool withAll=false)=0
virtual void AddPassenger(WorldObject *passenger, bool withAll=false)=0
bool NeedChangeAI
Definition: Unit.h:1802
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:21056
bool IsDuringRemoveFromWorld() const
Definition: Unit.h:1712
void UpdateCharmAI()
Definition: Unit.cpp:15740
Vehicle * m_vehicleKit
Definition: Unit.h:1899
void StopMovingOnCurrentPos()
Definition: Unit.cpp:16645
void Update(uint32 time) override
Definition: Unit.cpp:383
void RemoveCharmAuras()
Definition: Unit.cpp:11154
void EndRoll(Loot *loot, Map *allowedMap)
Definition: Group.cpp:1411
Transport * GetTransportForPos(uint32 phase, float x, float y, float z, WorldObject *worldobject=nullptr)
Definition: Map.cpp:2013

References Transport::AddPassenger(), AI(), CallAssistance(), CanNotReachTarget(), CanPeriodicallyCallForAssistance(), CreatureAI::CheckInRoom(), CONFIG_CREATURE_FAMILY_ASSISTANCE_PERIOD, CONFIG_NPC_EVADE_IF_NOT_REACHABLE, CONFIG_REGEN_HP_CANNOT_REACH_TARGET_IN_RAID, CREATURE_REGEN_INTERVAL, CreatureAI::DoZoneInCombat(), Group::EndRoll(), CreatureAI::EVADE_REASON_NO_PATH, Unit::GetCharmerOrOwner(), Unit::GetCollisionRadius(), GetDebugInfo(), GameTime::GetGameTime(), Object::GetGUID(), WorldObject::GetMap(), Unit::GetOwnerGUID(), WorldObject::GetPhaseMask(), ObjectAccessor::GetPlayer(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Unit::getPowerType(), ThreatMgr::GetThreatListSize(), Unit::GetThreatMgr(), WorldObject::GetTransport(), Map::GetTransportForPos(), Object::GetUInt32Value(), Unit::GetVictim(), WorldObject::GetVisibilityRange(), Unit::i_AI, IN_MILLISECONDS, Unit::IsAIEnabled, Unit::IsAlive(), Unit::IsCharmed(), Unit::IsDuringRemoveFromWorld(), Unit::IsEngaged(), Unit::IsEngagedBy(), Unit::IsInCombat(), Position::IsInDist(), IsInEvadeMode(), Object::IsInWorld(), IsNotReachableAndNeedRegen(), Object::IsPlayer(), Unit::IsPolymorphed(), WorldObject::IsWithinDistInMap(), CreatureAI::JustRespawned(), LOG_DEBUG, LOG_ERROR, loot, lootingGroupLowGUID, m_AI_locked, m_assistanceTimer, m_boundaryCheckTime, m_cannotReachTarget, m_cannotReachTimer, m_combatPulseDelay, m_combatPulseTime, m_corpseRemoveTime, Unit::m_deathState, 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(), SetCannotReachTarget(), SetInCombatWithZone(), SetNoCallAssistance(), sGroupMgr, sScriptMgr, Unit::StopMovingOnCurrentPos(), sWorld, Position::ToString(), TriggerJustRespawned, Unit::Update(), UnitAI::UpdateAI(), Unit::UpdateCharmAI(), and urand().

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

◆ UpdateAllStats()

bool Creature::UpdateAllStats ( )
overridevirtual

Implements Unit.

Reimplemented in Guardian, and Totem.

1015{
1019
1020 for (uint8 i = POWER_MANA; i < MAX_POWERS; ++i)
1022
1024
1025 return true;
1026}
@ MAX_POWERS
Definition: SharedDefines.h:276
void UpdateAttackPowerAndDamage(bool ranged=false) override
Definition: StatSystem.cpp:1059
void UpdateMaxPower(Powers power) override
Definition: StatSystem.cpp:1051
void UpdateMaxHealth() override
Definition: StatSystem.cpp:1045
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.

1040{
1041 float value = GetTotalAuraModValue(UNIT_MOD_ARMOR);
1042 SetArmor(int32(value));
1043}
@ UNIT_MOD_ARMOR
Definition: Unit.h:156
float GetTotalAuraModValue(UnitMods unitMod) const
Definition: Unit.cpp:15273
void SetArmor(int32 val)
Definition: Unit.h:862

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.

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

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

Referenced by UpdateAllStats().

◆ UpdateEntry() [1/2]

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

References UpdateEntry().

Referenced by UpdateEntry().

◆ UpdateEntry() [2/2]

bool Creature::UpdateEntry ( uint32  entry,
const CreatureData data = nullptr,
bool  changelevel = true,
bool  updateAI = false 
)
539{
540 if (!InitEntry(Entry, data))
541 return false;
542
543 CreatureTemplate const* cInfo = GetCreatureTemplate();
544
545 m_regenHealth = cInfo->RegenHealth;
546
547 // creatures always have melee weapon ready if any unless specified otherwise
548 if (!GetCreatureAddon())
550
551 SetFaction(cInfo->faction);
552
553 uint32 npcflag, unit_flags, dynamicflags;
554 ObjectMgr::ChooseCreatureFlags(cInfo, npcflag, unit_flags, dynamicflags, data);
555
557 ReplaceAllNpcFlags(NPCFlags(npcflag | sGameEventMgr->GetNPCFlag(this)));
558 else
560
561 // Xinef: NPC is in combat, keep this flag!
562 unit_flags &= ~UNIT_FLAG_IN_COMBAT;
563 if (IsInCombat())
564 unit_flags |= UNIT_FLAG_IN_COMBAT;
565
566 ReplaceAllUnitFlags(UnitFlags(unit_flags));
568
569 ReplaceAllDynamicFlags(dynamicflags);
570
574
575 uint32 previousHealth = GetHealth();
576 uint32 previousMaxHealth = GetMaxHealth();
577 uint32 previousPlayerDamageReq = _playerDamageReq;
578
579 SelectLevel(changelevel);
580 if (previousHealth > 0)
581 {
582 SetHealth(previousHealth);
583
584 if (previousMaxHealth && previousMaxHealth > GetMaxHealth())
585 {
586 _playerDamageReq = (uint32)(previousPlayerDamageReq * GetMaxHealth() / previousMaxHealth);
587 }
588 else
589 {
590 _playerDamageReq = previousPlayerDamageReq;
591 }
592 }
593
595 CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(GetLevel(), cInfo->unit_class);
596 float armor = stats->GenerateArmor(cInfo);
604
605 SetCanModifyStats(true);
607
608 // checked and error show at loading templates
609 if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->faction))
610 {
611 if (factionTemplate->factionFlags & FACTION_TEMPLATE_FLAG_ASSIST_PLAYERS)
612 SetPvP(true);
613 else
614 SetPvP(false);
615 }
616
617 // updates spell bars for vehicles and set player's faction - should be called here, to overwrite faction that is set from the new template
618 if (IsVehicle())
619 {
620 if (Player* owner = Creature::GetCharmerOrOwnerPlayerOrPlayerItself()) // this check comes in case we don't have a player
621 {
622 SetFaction(owner->GetFaction()); // vehicles should have same as owner faction
623 owner->VehicleSpellInitialize();
624 }
625 }
626
627 // trigger creature is always not selectable and can not be attacked
628 if (IsTrigger())
630
632
634 {
637 }
638
640
641 // Update movement
642 if (IsRooted())
645
647
648 if (updateAI)
649 {
651 }
652
653 return true;
654}
#define sGameEventMgr
Definition: GameEventMgr.h:186
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplateEntryfmt)
@ UNIT_MOD_RESISTANCE_SHADOW
Definition: Unit.h:161
@ UNIT_MOD_RESISTANCE_FROST
Definition: Unit.h:160
@ UNIT_MOD_RESISTANCE_HOLY
Definition: Unit.h:157
@ UNIT_MOD_RESISTANCE_ARCANE
Definition: Unit.h:162
@ UNIT_MOD_RESISTANCE_FIRE
Definition: Unit.h:158
@ UNIT_MOD_RESISTANCE_NATURE
Definition: Unit.h:159
UnitFlags2
Definition: UnitDefines.h:266
@ SHEATH_STATE_MELEE
Definition: UnitDefines.h:106
UnitFlags
Definition: UnitDefines.h:227
@ UNIT_FLAG_IN_COMBAT
Definition: UnitDefines.h:248
@ CREATURE_FLAG_EXTRA_NO_TAUNT
Definition: CreatureData.h:54
@ CREATURE_FLAG_EXTRA_WORLDEVENT
Definition: CreatureData.h:60
@ SPELL_SCHOOL_SHADOW
Definition: SharedDefines.h:288
@ SPELL_SCHOOL_NATURE
Definition: SharedDefines.h:286
@ SPELL_SCHOOL_FROST
Definition: SharedDefines.h:287
@ SPELL_SCHOOL_FIRE
Definition: SharedDefines.h:285
@ SPELL_SCHOOL_HOLY
Definition: SharedDefines.h:284
@ SPELL_EFFECT_ATTACK_ME
Definition: SharedDefines.h:892
@ IMMUNITY_STATE
Definition: SharedDefines.h:1395
@ IMMUNITY_EFFECT
Definition: SharedDefines.h:1394
@ FACTION_TEMPLATE_FLAG_ASSIST_PLAYERS
Definition: DBCEnums.h:330
bool UpdateAllStats() override
Definition: StatSystem.cpp:1014
bool InitEntry(uint32 entry, const CreatureData *data=nullptr)
Definition: Creature.cpp:439
void SetDetectionDistance(float dist)
Definition: Creature.h:208
void LoadSpellTemplateImmunity()
Definition: Creature.cpp:2214
uint32 RangeAttackTime
Definition: CreatureData.h:213
uint32 BaseAttackTime
Definition: CreatureData.h:212
float detection_range
Definition: CreatureData.h:207
int32 resistance[MAX_SPELL_SCHOOL]
Definition: CreatureData.h:230
bool RegenHealth
Definition: CreatureData.h:246
uint32 faction
Definition: CreatureData.h:201
uint32 unit_flags2
Definition: CreatureData.h:218
float GenerateArmor(CreatureTemplate const *info) const
Definition: CreatureData.h:330
void ReplaceAllDynamicFlags(uint32 flag) override
Definition: Unit.h:700
void SetFaction(uint32 faction)
Definition: Unit.cpp:10018
void SetPvP(bool state)
Definition: Unit.h:967
void ReplaceAllUnitFlags(UnitFlags flags)
Remove the Unit flag specify only.
Definition: Unit.h:685
virtual void SetSheath(SheathState sheathed)
Definition: Unit.h:945
void SetCanModifyStats(bool modifyStats)
Definition: Unit.h:910
void ReplaceAllUnitFlags2(UnitFlags2 flags)
Definition: Unit.h:691
void SetAttackTime(WeaponAttackType att, uint32 val)
Definition: Unit.h:806
static void ChooseCreatureFlags(CreatureTemplate const *cinfo, uint32 &npcflag, uint32 &unit_flags, uint32 &dynamicflags, CreatureData const *data=nullptr)
Definition: ObjectMgr.cpp:1660
Definition: DBCStructure.h:939

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

Referenced by CreateFromProto(), boss_yoggsaron_influence_tentacle::boss_yoggsaron_influence_tentacleAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), npc_forest_frog::npc_forest_frogAI::DoSpawnRandom(), npc_commandscript::HandleNpcSetEntryCommand(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::JustDied(), npc_scholomance_occultist::npc_scholomance_occultistAI::JustReachedHome(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::JustRespawned(), boss_yoggsaron_brain::boss_yoggsaron_brainAI::JustSummoned(), npc_kalecgos::MovementInform(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::OnCreatureCreate(), instance_forge_of_souls::instance_forge_of_souls_InstanceScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_pit_of_saron::instance_pit_of_saron_InstanceScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), instance_nexus::instance_nexus_InstanceMapScript::OnCreatureCreate(), instance_shattered_halls::instance_shattered_halls_InstanceMapScript::OnCreatureCreate(), npc_announcer_toc5::npc_announcer_toc5AI::Reset(), Respawn(), NPCStaveQuestAI::RevealForm(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::RollPath(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), npc_argent_captainAI::SpellHit(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::SpellHit(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::SpellHit(), npc_nether_drake::npc_nether_drakeAI::SpellHit(), 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.

1046{
1048 SetMaxHealth(uint32(value));
1049}

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.

1052{
1053 UnitMods unitMod = UnitMods(static_cast<uint16>(UNIT_MOD_POWER_START) + power);
1054
1055 float value = GetTotalAuraModValue(unitMod);
1056 SetMaxPower(power, uint32(value));
1057}
@ UNIT_MOD_POWER_START
Definition: Unit.h:174

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

Referenced by UpdateAllStats().

◆ UpdateMoveInLineOfSightState()

void Creature::UpdateMoveInLineOfSightState ( )
2584{
2585 // xinef: pets, guardians and units with scripts / smartAI should be skipped
2587 GetScriptId() || GetAIName() == "SmartAI")
2588 {
2591 return;
2592 }
2593
2594 if (IsTrigger() || IsCivilian() || GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET || IsCritter() || GetAIName() == "NullCreatureAI")
2595 {
2598 return;
2599 }
2600
2601 bool nonHostile = true;
2602 if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(GetFaction()))
2603 if (factionTemplate->hostileMask || factionTemplate->enemyFaction[0] || factionTemplate->enemyFaction[1] || factionTemplate->enemyFaction[2] || factionTemplate->enemyFaction[3])
2604 nonHostile = false;
2605
2606 if (nonHostile)
2608 else
2610}
@ UNIT_MASK_SUMMON
Definition: UnitDefines.h:135
@ UNIT_MASK_GUARDIAN
Definition: UnitDefines.h:137
@ UNIT_MASK_MINION
Definition: UnitDefines.h:136
uint32 GetCreatureType() const
Definition: Unit.cpp:15137
uint32 HasUnitTypeMask(uint32 mask) const
Definition: Unit.h:677

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

Referenced by Unit::SetFaction().

◆ UpdateMovementFlags()

void Creature::UpdateMovementFlags ( )
3424{
3425 // Do not update movement flags if creature is controlled by a player (charm/vehicle)
3426 if (m_movedByPlayer)
3427 return;
3428
3429 CreatureTemplate const* info = GetCreatureTemplate();
3430 if (!info)
3431 return;
3432
3433 // Creatures with CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE should control MovementFlags in your own scripts
3435 return;
3436
3437 float ground = GetFloorZ();
3438
3439 bool canHover = CanHover();
3440 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
3441
3442 if (GetMovementTemplate().IsFlightAllowed() && isInAir && !IsFalling())
3443 {
3444 if (GetMovementTemplate().Flight == CreatureFlightMovementType::CanFly)
3445 SetCanFly(true);
3446 else
3447 SetDisableGravity(true);
3448
3450 SetHover(false);
3451 }
3452 else
3453 {
3454 SetCanFly(false);
3455 SetDisableGravity(false);
3457 SetHover(true);
3458 }
3459
3460 if (!isInAir)
3462
3463 bool Swim = false;
3464 LiquidData const& liquidData = GetLiquidData();
3465 switch (liquidData.Status)
3466 {
3469 Swim = GetPositionZ() - liquidData.DepthLevel > GetCollisionHeight() * 0.75f; // Shallow water at ~75% of collision height
3470 break;
3472 Swim = true;
3473 break;
3474 default:
3475 break;
3476 }
3477
3478 SetSwim(CanSwim() && Swim);
3479}
@ LIQUID_MAP_UNDER_WATER
Definition: Map.h:148
@ LIQUID_MAP_IN_WATER
Definition: Map.h:147
@ LIQUID_MAP_WATER_WALK
Definition: Map.h:146
@ CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE
Definition: CreatureData.h:55
@ SPELL_AURA_HOVER
Definition: SpellAuraDefines.h:169
float const GROUND_HEIGHT_TOLERANCE
Definition: SharedDefines.h:26
bool SetCanFly(bool enable, bool packetOnly=false) override
Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pre...
Definition: Creature.cpp:3277
bool SetSwim(bool enable) override
Definition: Creature.cpp:3229
CreatureFlightMovementType Flight
Definition: CreatureData.h:126
float GetFloatValue(uint16 index) const
Definition: Object.cpp:317
LiquidData const & GetLiquidData() const
Definition: Object.cpp:3177
float GetFloorZ() const
Definition: Object.cpp:3133
float GetCollisionHeight() const override
Return collision height sent to client.
Definition: Unit.cpp:21062
Definition: Map.h:171
LiquidStatus Status
Definition: Map.h:178
float DepthLevel
Definition: Map.h:177

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

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

◆ UpdateResistances()

void Creature::UpdateResistances ( uint32  school)
overridevirtual

Implements Unit.

Reimplemented in Totem.

1029{
1030 if (school > SPELL_SCHOOL_NORMAL)
1031 {
1033 SetResistance(SpellSchools(school), int32(value));
1034 }
1035 else
1036 UpdateArmor();
1037}
@ UNIT_MOD_RESISTANCE_START
Definition: Unit.h:172
void UpdateArmor() override
Definition: StatSystem.cpp:1039
void SetResistance(SpellSchools school, int32 val)
Definition: Unit.h:866

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.

1010{
1011 return true;
1012}

◆ UpdateVendorItemCurrentCount()

uint32 Creature::UpdateVendorItemCurrentCount ( VendorItem const *  vItem,
uint32  used_count 
)
3091{
3092 if (!vItem->maxcount)
3093 return 0;
3094
3095 VendorItemCounts::iterator itr = m_vendorItemCounts.begin();
3096 for (; itr != m_vendorItemCounts.end(); ++itr)
3097 if (itr->itemId == vItem->item)
3098 break;
3099
3100 if (itr == m_vendorItemCounts.end())
3101 {
3102 uint32 new_count = vItem->maxcount > used_count ? vItem->maxcount - used_count : 0;
3103 m_vendorItemCounts.push_back(VendorItemCount(vItem->item, new_count));
3104 return new_count;
3105 }
3106
3107 VendorItemCount* vCount = &*itr;
3108
3109 time_t ptime = GameTime::GetGameTime().count();
3110
3111 if (time_t(vCount->lastIncrementTime + vItem->incrtime) <= ptime)
3112 {
3113 ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(vItem->item);
3114
3115 uint32 diff = uint32((ptime - vCount->lastIncrementTime) / vItem->incrtime);
3116 if ((vCount->count + diff * pProto->BuyCount) < vItem->maxcount)
3117 vCount->count += diff * pProto->BuyCount;
3118 else
3119 vCount->count = vItem->maxcount;
3120 }
3121
3122 vCount->count = vCount->count > used_count ? vCount->count - used_count : 0;
3123 vCount->lastIncrementTime = ptime;
3124 return vCount->count;
3125}

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

Referenced by Player::_StoreOrEquipNewItem().

◆ UpdateWaypointID()

void Creature::UpdateWaypointID ( uint32  wpID)
inline

Member Data Documentation

◆ _damagedByPlayer

bool Creature::_damagedByPlayer
private

◆ _focusSpell

Spell const* Creature::_focusSpell
private

◆ _isCombatMovementAllowed

bool Creature::_isCombatMovementAllowed
private

◆ _isMissingSwimmingFlagOutOfCombat

bool Creature::_isMissingSwimmingFlagOutOfCombat
private

‍Locks the target during spell cast for proper facing

Referenced by HasSwimmingFlagOutOfCombat(), and RefreshSwimmingFlag().

◆ _playerDamageReq

◆ 

struct { ... } Creature::_spellFocusInfo

Referenced by HasSpellFocus().

◆ Delay

uint32 Creature::Delay = 0

◆ DisableReputationGain

bool Creature::DisableReputationGain
protected

◆ loot

◆ lootingGroupLowGUID

uint32 Creature::lootingGroupLowGUID

Referenced by Update().

◆ lootPickPocketRestoreTime

uint32 Creature::lootPickPocketRestoreTime
protected

◆ m_AI_locked

bool Creature::m_AI_locked
protected

Referenced by AIM_Initialize(), and Update().

◆ m_AlreadyCallAssistance

bool Creature::m_AlreadyCallAssistance
protected

◆ m_AlreadySearchedAssistance

bool Creature::m_AlreadySearchedAssistance
protected

◆ m_assistanceTimer

uint32 Creature::m_assistanceTimer
private

Referenced by SetAssistanceTimer(), and Update().

◆ m_boundaryCheckTime

uint32 Creature::m_boundaryCheckTime
protected

Referenced by DoImmediateBoundaryCheck(), and Update().

◆ m_cannotReachTarget

ObjectGuid Creature::m_cannotReachTarget
private

◆ m_cannotReachTimer

uint32 Creature::m_cannotReachTimer
private

◆ m_CombatDistance

◆ m_combatPulseDelay

uint32 Creature::m_combatPulseDelay
protected

◆ m_combatPulseTime

uint32 Creature::m_combatPulseTime
protected

Referenced by SetCombatPulseDelay(), and Update().

◆ m_corpseDelay

uint32 Creature::m_corpseDelay
protected

◆ m_corpseRemoveTime

time_t Creature::m_corpseRemoveTime
protected

◆ m_creatureData

CreatureData const* Creature::m_creatureData
protected

◆ m_creatureInfo

◆ m_CreatureSpellCooldowns

◆ m_defaultMovementType

◆ m_detectionDistance

float Creature::m_detectionDistance
protected

◆ m_equipmentId

uint8 Creature::m_equipmentId
protected

◆ m_formation

◆ m_groupLootTimer

uint32 Creature::m_groupLootTimer

Referenced by Update().

◆ m_homePosition

Position Creature::m_homePosition
protected

◆ m_isTempWorldObject

bool Creature::m_isTempWorldObject

◆ m_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_transportCheckTimer

uint16 Creature::m_transportCheckTimer
protected

Referenced by Update().

◆ m_transportHomePosition

Position Creature::m_transportHomePosition
protected

◆ m_vendorItemCounts

VendorItemCounts Creature::m_vendorItemCounts
protected

◆ m_wanderDistance

float Creature::m_wanderDistance
protected

◆ m_waypointID

uint32 Creature::m_waypointID
private

◆ MOVE_BACKWARDS_CHECK_INTERVAL

constexpr uint32 Creature::MOVE_BACKWARDS_CHECK_INTERVAL = 2000
staticconstexpr

Referenced by Update().

◆ MOVE_CIRCLE_CHECK_INTERVAL

constexpr uint32 Creature::MOVE_CIRCLE_CHECK_INTERVAL = 3000
staticconstexpr

Referenced by Update().

◆ Orientation

float Creature::Orientation = 0.0f

◆ Spell

::Spell const* Creature::Spell = nullptr

◆ Target

ObjectGuid Creature::Target

◆ TriggerJustRespawned

bool Creature::TriggerJustRespawned
private

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