TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Creature Class Reference

#include <Creature.h>

Public Member Functions

 Creature (bool isWorldObject=false)
 
virtual ~Creature ()
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void SetObjectScale (float scale) override
 
void SetDisplayId (uint32 modelId) override
 
void DisappearAndDie ()
 
bool Create (ObjectGuid::LowType guidlow, Map *map, uint32 phaseMask, uint32 entry, float x, float y, float z, float ang, CreatureData const *data=nullptr, uint32 vehId=0)
 
bool LoadCreaturesAddon ()
 
void SelectLevel ()
 
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)
 
uint32 GetCorpseDelay () const
 
bool IsRacialLeader () const
 
bool IsCivilian () const
 
bool IsTrigger () const
 
bool IsGuard () const
 
bool CanWalk () const
 
bool CanSwim () const
 
bool CanFly () const override
 
void SetReactState (ReactStates st)
 
ReactStates GetReactState () const
 
bool HasReactState (ReactStates state) const
 
void InitializeReactState ()
 
bool isCanInteractWithBattleMaster (Player *player, bool msg) const
 
bool isCanTrainingAndResetTalentsOf (Player *player) const
 
bool CanCreatureAttack (Unit const *victim, bool force=true) const
 
bool IsImmunedToSpell (SpellInfo const *spellInfo) const override
 
bool IsImmunedToSpellEffect (SpellInfo const *spellInfo, uint32 index) const override
 
bool isElite () const
 
bool isWorldBoss () const
 
bool IsDungeonBoss () const
 
uint8 getLevelForTarget (WorldObject const *target) const override
 
bool IsInEvadeMode () const
 
bool AIM_Initialize (CreatureAI *ai=NULL)
 
void Motion_Initialize ()
 
CreatureAIAI () const
 
SpellSchoolMask GetMeleeDamageSchoolMask () const override
 
void SetMeleeDamageSchool (SpellSchools school)
 
bool HasSpell (uint32 spellID) const override
 
bool UpdateEntry (uint32 entry, CreatureData const *data=nullptr)
 
void UpdateMovementFlags ()
 
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) override
 
void SetCanDualWield (bool value) override
 
int8 GetOriginalEquipmentId () const
 
uint8 GetCurrentEquipmentId () const
 
void SetCurrentEquipmentId (uint8 id)
 
float GetSpellDamageMod (int32 Rank) const
 
VendorItemData constGetVendorItems () const
 
uint32 GetVendorItemCurrentCount (VendorItem const *vItem)
 
uint32 UpdateVendorItemCurrentCount (VendorItem const *vItem, uint32 used_count)
 
TrainerSpellData constGetTrainerSpells () const
 
CreatureTemplate constGetCreatureTemplate () const
 
CreatureData constGetCreatureData () const
 
CreatureAddon constGetCreatureAddon () const
 
std::string GetAIName () const
 
std::string GetScriptName () const
 
uint32 GetScriptId () const
 
std::string constGetNameForLocaleIdx (LocaleConstant locale_idx) const override
 
void setDeathState (DeathState s) override
 
bool LoadFromDB (ObjectGuid::LowType spawnId, Map *map)
 
bool LoadCreatureFromDB (ObjectGuid::LowType spawnId, Map *map, bool addToMap=true, bool allowDuplicate=false)
 
void SaveToDB ()
 
virtual void SaveToDB (uint32 mapid, uint32 spawnMask, uint32 phaseMask)
 
virtual void DeleteFromDB ()
 
void StartPickPocketRefillTimer ()
 
void ResetPickPocketRefillTimer ()
 
bool CanGeneratePickPocketLoot () const
 
void SetSkinner (ObjectGuid guid)
 
ObjectGuid GetSkinner () const
 
PlayerGetLootRecipient () const
 
GroupGetLootRecipientGroup () const
 
bool hasLootRecipient () const
 
bool isTappedBy (Player const *player) const
 
void SetLootRecipient (Unit *unit)
 
void AllLootRemovedFromCorpse ()
 
uint16 GetLootMode () const
 
bool HasLootMode (uint16 lootMode)
 
void SetLootMode (uint16 lootMode)
 
void AddLootMode (uint16 lootMode)
 
void RemoveLootMode (uint16 lootMode)
 
void ResetLootMode ()
 
SpellInfo constreachWithSpellAttack (Unit *victim)
 
SpellInfo constreachWithSpellCure (Unit *victim)
 
bool CanStartAttack (Unit const *u, bool force) const
 
float GetAttackDistance (Unit const *player) const
 
float GetAggroRange (Unit const *target) const
 
void SendAIReaction (AiReaction reactionType)
 
UnitSelectNearestTarget (float dist=0, bool playerOnly=false) const
 
UnitSelectNearestTargetInAttackDistance (float dist=0) const
 
PlayerSelectNearestPlayer (float distance=0) const
 
UnitSelectNearestHostileUnitInAggroRange (bool useLOS=false) const
 
void DoFleeToGetAssistance ()
 
void CallForHelp (float fRadius)
 
void CallAssistance ()
 
void SetNoCallAssistance (bool val)
 
void SetNoSearchAssistance (bool val)
 
bool HasSearchedAssistance () const
 
bool CanAssistTo (const Unit *u, const Unit *enemy, bool checkfaction=true) const
 
bool _IsTargetAcceptable (const Unit *target) const
 
MovementGeneratorType GetDefaultMovementType () const
 
void SetDefaultMovementType (MovementGeneratorType mgt)
 
void RemoveCorpse (bool setSpawnTime=true)
 
void DespawnOrUnsummon (uint32 msTimeToDespawn=0)
 
time_t constGetRespawnTime () const
 
time_t GetRespawnTimeEx () const
 
void SetRespawnTime (uint32 respawn)
 
void Respawn (bool force=false)
 
void SaveRespawnTime () override
 
uint32 GetRespawnDelay () const
 
void SetRespawnDelay (uint32 delay)
 
float GetRespawnRadius () const
 
void SetRespawnRadius (float dist)
 
void DoImmediateBoundaryCheck ()
 
uint32 GetCombatPulseDelay () const
 
void SetCombatPulseDelay (uint32 delay)
 
void SendZoneUnderAttackMessage (Player *attacker)
 Send a message to LocalDefense channel for players opposition team in the zone. More...
 
void SetInCombatWithZone ()
 
bool hasQuest (uint32 quest_id) const override
 
bool hasInvolvedQuest (uint32 quest_id) const override
 
bool isRegeneratingHealth ()
 
void setRegeneratingHealth (bool regenHealth)
 
virtual uint8 GetPetAutoSpellSize () const
 
virtual uint32 GetPetAutoSpellOnPos (uint8 pos) 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 constGetHomePosition () 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 constGetTransportHomePosition () const
 
uint32 GetWaypointPath () const
 
void LoadPath (uint32 pathid)
 
uint32 GetCurrentWaypointID () const
 
void UpdateWaypointID (uint32 wpID)
 
void SearchFormation ()
 
CreatureGroupGetFormation ()
 
void SetFormation (CreatureGroup *formation)
 
UnitSelectVictim ()
 
void SetDisableReputationGain (bool disable)
 
bool IsReputationGainDisabled () const
 
bool IsDamageEnoughForLootingAndReward () const
 
void LowerPlayerDamageReq (uint32 unDamage)
 
void ResetPlayerDamageReq ()
 
uint32 GetOriginalEntry () const
 
void SetOriginalEntry (uint32 entry)
 
void SetTarget (ObjectGuid const &guid) override
 
bool FocusTarget (Spell const *focusSpell, WorldObject const *target)
 
bool IsFocusing (Spell const *focusSpell=nullptr, bool withDelay=false)
 
void ReleaseFocus (Spell const *focusSpell=nullptr, bool withDelay=true)
 
CreatureTextRepeatIds GetTextRepeatGroup (uint8 textGroup)
 
void SetTextRepeatId (uint8 textGroup, uint8 id)
 
void ClearTextRepeatGroup (uint8 textGroup)
 
- Public Member Functions inherited from Unit
virtual ~Unit ()
 
UnitAIGetAI ()
 
void SetAI (UnitAI *newAI)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void CleanupBeforeRemoveFromMap (bool finalCleanup)
 
void CleanupsBeforeDelete (bool finalCleanup=true) override
 
void SendCombatLogMessage (WorldPackets::CombatLog::CombatLogServerPacket *combatLog) const
 
DiminishingLevels GetDiminishing (DiminishingGroup group)
 
void IncrDiminishing (DiminishingGroup group)
 
float ApplyDiminishingToDuration (DiminishingGroup group, int32 &duration, Unit *caster, DiminishingLevels Level, int32 limitduration)
 
void ApplyDiminishingAura (DiminishingGroup group, bool apply)
 
void ClearDiminishings ()
 
float GetSpellMaxRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
float GetSpellMinRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
void setAttackTimer (WeaponAttackType type, uint32 time)
 
void resetAttackTimer (WeaponAttackType type=BASE_ATTACK)
 
uint32 getAttackTimer (WeaponAttackType type) const
 
bool isAttackReady (WeaponAttackType type=BASE_ATTACK) const
 
bool haveOffhandWeapon () const
 
bool CanDualWield () const
 
float GetCombatReach () const
 
float GetMeleeReach () const
 
bool IsWithinCombatRange (const Unit *obj, float dist2compare) const
 
bool IsWithinMeleeRange (const Unit *obj, float dist=MELEE_RANGE) const
 
void GetRandomContactPoint (const Unit *target, float &x, float &y, float &z, float distance2dMin, float distance2dMax) const
 
void _addAttacker (Unit *pAttacker)
 
void _removeAttacker (Unit *pAttacker)
 
UnitgetAttackerForHelper () const
 
bool Attack (Unit *victim, bool meleeAttack)
 
void MustReacquireTarget ()
 
void CastStop (uint32 except_spellid=0)
 
bool AttackStop ()
 
void RemoveAllAttackers ()
 
AttackerSet constgetAttackers () const
 
bool isAttackingPlayer () const
 
UnitGetVictim () const
 
UnitEnsureVictim () const
 
void CombatStop (bool includingCast=false)
 
void CombatStopWithPets (bool includingCast=false)
 
void StopAttackFaction (uint32 faction_id)
 
UnitSelectNearbyTarget (Unit *exclude=NULL, float dist=NOMINAL_MELEE_RANGE) const
 
void SendMeleeAttackStop (Unit *victim=NULL)
 
void SendMeleeAttackStart (Unit *victim)
 
void AddUnitState (uint32 f)
 
bool HasUnitState (const uint32 f) const
 
void ClearUnitState (uint32 f)
 
bool CanFreeMove () const
 
uint32 HasUnitTypeMask (uint32 mask) const
 
void AddUnitTypeMask (uint32 mask)
 
bool IsSummon () const
 
bool IsGuardian () const
 
bool IsPet () const
 
bool IsHunterPet () const
 
bool IsTotem () const
 
bool IsVehicle () const
 
uint8 getLevel () const
 
uint8 getLevelForTarget (WorldObject const *) const override
 
void SetLevel (uint8 lvl)
 
uint8 getRace () const
 
uint32 getRaceMask () const
 
uint8 getClass () const
 
uint32 getClassMask () const
 
uint8 getGender () const
 
float GetStat (Stats stat) const
 
void SetStat (Stats stat, int32 val)
 
uint32 GetArmor () const
 
void SetArmor (int32 val)
 
uint32 GetResistance (SpellSchools school) const
 
uint32 GetResistance (SpellSchoolMask mask) const
 
void SetResistance (SpellSchools school, int32 val)
 
uint32 GetHealth () const
 
uint32 GetMaxHealth () const
 
bool IsFullHealth () const
 
bool HealthBelowPct (int32 pct) const
 
bool HealthBelowPctDamaged (int32 pct, uint32 damage) const
 
bool HealthAbovePct (int32 pct) const
 
bool HealthAbovePctHealed (int32 pct, uint32 heal) const
 
float GetHealthPct () const
 
uint32 CountPctFromMaxHealth (int32 pct) const
 
uint32 CountPctFromCurHealth (int32 pct) const
 
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)
 
int32 GetPower (Powers power) const
 
int32 GetMinPower (Powers power) const
 
int32 GetMaxPower (Powers power) const
 
float GetPowerPct (Powers power) const
 
int32 CountPctFromMaxPower (Powers power, int32 pct) const
 
void SetPower (Powers power, int32 val)
 
void SetMaxPower (Powers power, int32 val)
 
int32 ModifyPower (Powers power, int32 val)
 
int32 ModifyPowerPct (Powers power, float pct, bool apply=true)
 
uint32 GetAttackTime (WeaponAttackType att) const
 
void SetAttackTime (WeaponAttackType att, uint32 val)
 
void ApplyAttackTimePercentMod (WeaponAttackType att, float val, bool apply)
 
void ApplyCastTimePercentMod (float val, bool apply)
 
SheathState GetSheath () const
 
virtual void SetSheath (SheathState sheathed)
 
uint32 getFaction () const
 
void setFaction (uint32 faction)
 
FactionTemplateEntry constGetFactionTemplateEntry () const
 
ReputationRank GetReactionTo (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 IsPvP () const
 
bool IsFFAPvP () const
 
virtual void SetPvP (bool state)
 
uint32 GetCreatureType () const
 
uint32 GetCreatureTypeMask () const
 
UnitStandStateType GetStandState () const
 
bool IsSitState () const
 
bool IsStandState () const
 
void SetStandState (UnitStandStateType state, uint32 animKitID=0)
 
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 ()
 
MountCapabilityEntry constGetMountCapability (uint32 mountType) const
 
void SendDurabilityLoss (Player *receiver, uint32 percent)
 
void PlayOneShotAnimKitId (uint16 animKitId)
 
void SetAIAnimKitId (uint16 animKitId)
 
uint16 GetAIAnimKitId () const override
 
void SetMovementAnimKitId (uint16 animKitId)
 
uint16 GetMovementAnimKitId () const override
 
void SetMeleeAnimKitId (uint16 animKitId)
 
uint16 GetMeleeAnimKitId () const override
 
uint16 GetMaxSkillValueForLevel (Unit const *target=NULL) const
 
void DealDamageMods (Unit *victim, uint32 &damage, uint32 *absorb)
 
uint32 DealDamage (Unit *victim, uint32 damage, CleanDamage const *cleanDamage=NULL, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=NULL, bool durabilityLoss=true)
 
void Kill (Unit *victim, bool durabilityLoss=true)
 
void KillSelf (bool durabilityLoss=true)
 
int32 DealHeal (Unit *victim, uint32 addhealth)
 
void ProcDamageAndSpell (Unit *victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType=BASE_ATTACK, SpellInfo const *procSpell=NULL, SpellInfo const *procAura=NULL)
 
void ProcDamageAndSpellFor (bool isVictim, Unit *target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const *procSpell, uint32 damage, SpellInfo const *procAura=NULL)
 
void GetProcAurasTriggeredOnEvent (AuraApplicationList &aurasTriggeringProc, AuraApplicationList *procAuras, ProcEventInfo eventInfo)
 
void TriggerAurasProcOnEvent (CalcDamageInfo &damageInfo)
 
void TriggerAurasProcOnEvent (AuraApplicationList *myProcAuras, AuraApplicationList *targetProcAuras, Unit *actionTarget, uint32 typeMaskActor, uint32 typeMaskActionTarget, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell *spell, DamageInfo *damageInfo, HealInfo *healInfo)
 
void TriggerAurasProcOnEvent (ProcEventInfo &eventInfo, AuraApplicationList &procAuras)
 
void HandleEmoteCommand (uint32 anim_id)
 
void AttackerStateUpdate (Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false)
 
void CalculateMeleeDamage (Unit *victim, uint32 damage, CalcDamageInfo *damageInfo, WeaponAttackType attackType=BASE_ATTACK)
 
void DealMeleeDamage (CalcDamageInfo *damageInfo, bool durabilityLoss)
 
void HandleProcExtraAttackFor (Unit *victim)
 
void CalculateSpellDamageTaken (SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=BASE_ATTACK, bool crit=false)
 
void DealSpellDamage (SpellNonMeleeDamage const *damageInfo, bool durabilityLoss)
 
uint32 GetDamageReduction (uint32 damage) const
 
void ApplyResilience (Unit const *victim, int32 *damage) const
 
float MeleeSpellMissChance (Unit const *victim, WeaponAttackType attType, uint32 spellId) const
 
SpellMissInfo MeleeSpellHitResult (Unit *victim, SpellInfo const *spellInfo)
 
SpellMissInfo MagicSpellHitResult (Unit *victim, SpellInfo const *spellInfo)
 
SpellMissInfo SpellHitResult (Unit *victim, SpellInfo const *spellInfo, bool canReflect=false)
 
float GetUnitDodgeChanceAgainst (Unit const *attacker) const
 
float GetUnitParryChanceAgainst (Unit const *attacker) const
 
float GetUnitBlockChanceAgainst (Unit const *attacker) const
 
float GetUnitMissChance (WeaponAttackType attType) const
 
float GetUnitCriticalChance (WeaponAttackType attackType, const Unit *victim) const
 
int32 GetMechanicResistChance (SpellInfo const *spellInfo) const
 
bool CanUseAttackType (uint8 attacktype) const
 
virtual uint32 GetBlockPercent () const
 
float GetWeaponProcChance () const
 
float GetPPMProcChance (uint32 WeaponSpeed, float PPM, const SpellInfo *spellProto) const
 
MeleeHitOutcome RollMeleeOutcomeAgainst (Unit const *victim, WeaponAttackType attType) 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
 
bool IsCritter () const
 
bool IsInFlight () const
 
bool IsInCombat () const
 
bool IsInCombatWith (Unit const *who) const
 
void CombatStart (Unit *target, bool initialAggro=true)
 
void SetInCombatState (bool PvP, Unit *enemy=NULL)
 
void SetInCombatWith (Unit *enemy)
 
void ClearInCombat ()
 
uint32 GetCombatTimer () const
 
bool HasAuraTypeWithFamilyFlags (AuraType auraType, uint32 familyName, uint32 familyFlags) const
 
bool HasBreakableByDamageAuraType (AuraType type, uint32 excludeAura=0) const
 
bool HasBreakableByDamageCrowdControlAura (Unit *excludeCasterChannel=NULL) const
 
bool HasStealthAura () const
 
bool HasInvisibilityAura () const
 
bool isFeared () const
 
bool isInRoots () const
 
bool IsPolymorphed () const
 
bool isFrozen () const
 
bool isTargetableForAttack (bool checkFakeDeath=true) const
 
bool IsValidAttackTarget (Unit const *target) const
 
bool _IsValidAttackTarget (Unit const *target, SpellInfo const *bySpell, WorldObject const *obj=NULL) const
 
bool IsValidAssistTarget (Unit const *target) const
 
bool _IsValidAssistTarget (Unit const *target, SpellInfo const *bySpell) const
 
virtual bool IsInWater () const
 
virtual bool IsUnderWater () const
 
virtual void UpdateUnderwaterState (Map *m, float x, float y, float z)
 
bool isInAccessiblePlaceFor (Creature const *c) const
 
void SendHealSpellLog (Unit *victim, uint32 spellID, uint32 health, uint32 overHeal, uint32 absorbed, bool crit=false)
 
int32 HealBySpell (Unit *victim, SpellInfo const *spellInfo, uint32 addHealth, bool critical=false)
 
void SendEnergizeSpellLog (Unit *victim, uint32 spellID, int32 damage, Powers powertype)
 
void EnergizeBySpell (Unit *victim, uint32 SpellID, int32 Damage, Powers powertype)
 
void CastSpell (SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void CastSpell (Unit *victim, uint32 spellId, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void CastSpell (Unit *victim, uint32 spellId, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void CastSpell (Unit *victim, SpellInfo const *spellInfo, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void CastSpell (Unit *victim, SpellInfo const *spellInfo, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void CastSpell (float x, float y, float z, uint32 spellId, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void CastSpell (GameObject *go, uint32 spellId, bool triggered, Item *castItem=NULL, AuraEffect *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void CastCustomSpell (Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void CastCustomSpell (uint32 spellId, SpellValueMod mod, int32 value, Unit *victim, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void CastCustomSpell (uint32 spellId, SpellValueMod mod, int32 value, Unit *victim=NULL, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void CastCustomSpell (uint32 spellId, CustomSpellValues const &value, Unit *victim=NULL, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
 
AuraAddAura (uint32 spellId, Unit *target)
 
AuraAddAura (SpellInfo const *spellInfo, uint32 effMask, Unit *target)
 
void SetAuraStack (uint32 spellId, Unit *target, uint32 stack)
 
void SendPlaySpellVisualKit (uint32 id, uint32 type)
 
void DeMorph ()
 
void SendAttackStateUpdate (CalcDamageInfo *damageInfo)
 
void SendAttackStateUpdate (uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount)
 
void SendSpellNonMeleeDamageLog (SpellNonMeleeDamage const *log)
 
void SendPeriodicAuraLog (SpellPeriodicAuraLogInfo *pInfo)
 
void SendSpellMiss (Unit *target, uint32 spellID, SpellMissInfo missInfo)
 
void SendSpellDamageResist (Unit *target, uint32 spellId)
 
void SendSpellDamageImmune (Unit *target, uint32 spellId, bool isPeriodic)
 
void NearTeleportTo (float x, float y, float z, float orientation, bool casting=false)
 
void SendTeleportPacket (Position &pos)
 
virtual bool UpdatePosition (float x, float y, float z, float ang, bool teleport=false)
 
virtual 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 SendMoveKnockBack (Player *player, float speedXY, float speedZ, float vcos, float vsin)
 
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, bool withOrientation=false)
 
void MonsterMoveWithSpeed (float x, float y, float z, float speed, bool generatePath=false, bool forceDestination=false)
 
void SendSetPlayHoverAnim (bool enable)
 
bool IsLevitating () const
 
bool IsWalking () const
 
bool IsHovering () const
 
bool SetWalk (bool enable)
 
bool SetDisableGravity (bool disable, bool packetOnly=false)
 
bool SetFall (bool enable)
 
bool SetSwim (bool enable)
 
bool SetCanFly (bool enable)
 
bool SetWaterWalking (bool enable, bool packetOnly=false)
 
bool SetFeatherFall (bool enable, bool packetOnly=false)
 
bool SetHover (bool enable, bool packetOnly=false)
 
bool SetCollision (bool disable)
 
void SendSetVehicleRecId (uint32 vehicleId)
 
void SetInFront (WorldObject const *target)
 
void SetFacingTo (float ori)
 
void SetFacingToObject (WorldObject const *object)
 
void SendChangeCurrentVictimOpcode (HostileReference *pHostileReference)
 
void SendClearThreatListOpcode ()
 
void SendRemoveFromThreatListOpcode (HostileReference *pHostileReference)
 
void SendThreatListUpdate ()
 
void SendClearTarget ()
 
bool IsAlive () const
 
bool isDying () const
 
bool isDead () const
 
DeathState getDeathState () const
 
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
 
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< TempSummon * > &Minions, uint32 entry)
 
void RemoveAllMinionsByEntry (uint32 entry)
 
void SetCharm (Unit *target, bool apply)
 
UnitGetNextRandomRaidMemberOrPet (float radius)
 
bool SetCharmedBy (Unit *charmer, CharmType type, AuraApplication const *aurApp=NULL)
 
void RemoveCharmedBy (Unit *charmer)
 
void RestoreFaction ()
 
UnitGetFirstControlled () const
 
void RemoveAllControlled ()
 
bool IsCharmed () const
 
bool isPossessed () const
 
bool isPossessedByPlayer () const
 
bool isPossessing () const
 
bool isPossessing (Unit *u) const
 
CharmInfoGetCharmInfo ()
 
CharmInfoInitCharmInfo ()
 
void DeleteCharmInfo ()
 
void UpdateCharmAI ()
 
SharedVisionList constGetSharedVisionList ()
 
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, uint32 effMask, Unit *caster, int32 *baseAmount=NULL, Item *castItem=NULL, ObjectGuid casterGUID=ObjectGuid::Empty, int32 castItemLevel=-1)
 
void _AddAura (UnitAura *aura, Unit *caster)
 
AuraApplication_CreateAuraApplication (Aura *aura, uint32 effMask)
 
void _ApplyAuraEffect (Aura *aura, uint8 effIndex)
 
void _ApplyAura (AuraApplication *aurApp, uint32 effMask)
 
void _UnapplyAura (AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
 
void _UnapplyAura (AuraApplication *aurApp, AuraRemoveMode removeMode)
 
void _RemoveNoStackAuraApplicationsDueToAura (Aura *aura)
 
void _RemoveNoStackAurasDueToAura (Aura *aura)
 
bool _IsNoStackAuraDueToAura (Aura *appliedAura, Aura *existingAura) const
 
void _RegisterAuraEffect (AuraEffect *aurEff, bool apply)
 
AuraMapGetOwnedAuras ()
 
AuraMap constGetOwnedAuras () const
 
void RemoveOwnedAura (AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAura (Aura *aura, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
AuraGetOwnedAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, Aura *except=NULL) const
 
AuraApplicationMapGetAppliedAuras ()
 
AuraApplicationMap constGetAppliedAuras () const
 
void RemoveAura (AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (AuraApplication *aurApp, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (Aura *aur, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAppliedAuras (std::function< bool(AuraApplication const *)> const &check)
 
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 RemoveAurasByType (AuraType auraType, std::function< bool(AuraApplication const *)> const &check)
 
void RemoveAurasDueToSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAuraFromStack (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
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=NULL, bool negative=true, bool positive=true)
 
void RemoveNotOwnSingleTargetAuras (uint32 newPhase=0x0, bool phaseid=false)
 
void RemoveAurasWithInterruptFlags (uint32 flag, uint32 except=0)
 
void RemoveAurasWithAttribute (uint32 flags)
 
void RemoveAurasWithFamily (SpellFamilyNames family, flag128 const &familyFlag, ObjectGuid casterGUID)
 
void RemoveAurasWithMechanic (uint32 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
 
void RemoveMovementImpairingAuras ()
 
void RemoveAreaAurasDueToLeaveWorld ()
 
void RemoveAllAuras ()
 
void RemoveArenaAuras ()
 
void RemoveAllAurasOnDeath ()
 
void RemoveAllAurasRequiringDeadTarget ()
 
void RemoveAllAurasExceptType (AuraType type)
 
void RemoveAllAurasExceptType (AuraType type1, AuraType type2)
 
void DelayOwnedAuras (uint32 spellId, ObjectGuid caster, int32 delaytime)
 
void _RemoveAllAuraStatMods ()
 
void _ApplyAllAuraStatMods ()
 
AuraEffectList constGetAuraEffectsByType (AuraType type) const
 
AuraListGetSingleCastAuras ()
 
AuraList constGetSingleCastAuras () 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, flag128 const &familyFlag, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetDummyAuraEffect (SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
 
AuraApplicationGetAuraApplication (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraApplication *except=NULL) const
 
AuraGetAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
 
AuraApplicationGetAuraApplicationOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraApplication *except=NULL) const
 
AuraGetAuraOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
 
void GetDispellableAuraList (Unit *caster, uint32 dispelMask, DispelChargesList &dispelList)
 
bool HasAuraEffect (uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
 
uint32 GetAuraCount (uint32 spellId) const
 
bool HasAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 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 HasNegativeAuraWithInterruptFlag (uint32 flag, ObjectGuid guid=ObjectGuid::Empty) const
 
bool HasNegativeAuraWithAttribute (uint32 flag, ObjectGuid guid=ObjectGuid::Empty) const
 
bool HasAuraWithMechanic (uint32 mechanicMask) const
 
AuraEffectIsScriptOverriden (SpellInfo const *spell, int32 script) const
 
uint32 GetDiseasesByCaster (ObjectGuid casterGUID, bool remove=false)
 
uint32 GetDoTsByCaster (ObjectGuid casterGUID) const
 
int32 GetTotalAuraModifier (AuraType auratype) const
 
float GetTotalAuraMultiplier (AuraType auratype) const
 
int32 GetMaxPositiveAuraModifier (AuraType auratype) const
 
int32 GetMaxNegativeAuraModifier (AuraType auratype) const
 
int32 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=NULL) 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 GetPowerIndex (uint32 powerType) const
 
int32 GetCreatePowers (Powers power) const
 
float GetPosStat (Stats stat) const
 
float GetNegStat (Stats stat) const
 
float GetCreateStat (Stats stat) const
 
ObjectGuid GetChannelObjectGuid () const
 
void SetChannelObjectGuid (ObjectGuid guid)
 
void SetCurrentCastSpell (Spell *pSpell)
 
void InterruptSpell (CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true)
 
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)
 
SpellGetCurrentSpell (CurrentSpellTypes spellType) const
 
SpellGetCurrentSpell (uint32 spellType) const
 
SpellFindCurrentSpellBySpellId (uint32 spell_id) const
 
int32 GetCurrentSpellCastTime (uint32 spell_id) const
 
virtual SpellInfo constGetCastSpellInfo (SpellInfo const *spellInfo) const
 
SpellHistoryGetSpellHistory ()
 
SpellHistory constGetSpellHistory () const
 
ShapeshiftForm GetShapeshiftForm () const
 
void SetShapeshiftForm (ShapeshiftForm form)
 
bool IsInFeralForm () const
 
bool IsInDisallowedMountForm () const
 
bool HandleStatModifier (UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
 
void SetModifierValue (UnitMods unitMod, UnitModifierType modifierType, float value)
 
float GetModifierValue (UnitMods unitMod, UnitModifierType modifierType) const
 
float GetTotalStatValue (Stats stat) 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 void UpdateAllResistances ()
 
virtual void UpdateDamagePhysical (WeaponAttackType attType)
 
float GetTotalAttackPowerValue (WeaponAttackType attType) const
 
float GetWeaponDamageRange (WeaponAttackType attType, WeaponDamageRange type) const
 
void SetBaseWeaponDamage (WeaponAttackType attType, WeaponDamageRange damageRange, float value)
 
uint32 CalculateDamage (WeaponAttackType attType, bool normalized, bool addTotalPct)
 
float GetAPMultiplier (WeaponAttackType attType, bool normalized)
 
bool isInFrontInMap (Unit const *target, float distance, float arc=float(M_PI)) const
 
bool isInBackInMap (Unit const *target, float distance, float arc=float(M_PI)) const
 
bool IsVisible () const
 
void SetVisible (bool x)
 
bool SetInPhase (uint32 id, bool update, bool apply) override
 
void UpdateObjectVisibility (bool forced=true) override
 
bool CanHaveThreatList (bool skipAliveCheck=false) const
 
void AddThreat (Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=NULL)
 
float ApplyTotalThreatModifier (float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
void DeleteThreatList ()
 
void TauntApply (Unit *victim)
 
void TauntFadeOut (Unit *taunter)
 
ThreatManagergetThreatManager ()
 
void addHatedBy (HostileReference *pHostileReference)
 
void removeHatedBy (HostileReference *)
 
HostileRefManagergetHostileRefManager ()
 
VisibleAuraMap constGetVisibleAuras ()
 
AuraApplicationGetVisibleAura (uint8 slot) const
 
void SetVisibleAura (uint8 slot, AuraApplication *aur)
 
void RemoveVisibleAura (uint8 slot)
 
uint32 GetInterruptMask () const
 
void AddInterruptMask (uint32 mask)
 
void UpdateInterruptMask ()
 
uint32 GetDisplayId () const
 
uint32 GetNativeDisplayId () const
 
void RestoreDisplayId ()
 
void SetNativeDisplayId (uint32 modelId)
 
void setTransForm (uint32 spellid)
 
uint32 getTransForm () const
 
void _RegisterDynObject (DynamicObject *dynObj)
 
void _UnregisterDynObject (DynamicObject *dynObj)
 
DynamicObjectGetDynObject (uint32 spellId)
 
void 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=NULL, Unit const *Caster=NULL) const
 
void UnsummonAllTotems ()
 
bool IsMagnet () const
 
UnitGetMagicHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo)
 
UnitGetMeleeHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo=NULL)
 
int32 SpellBaseDamageBonusDone (SpellSchoolMask schoolMask) const
 
int32 SpellBaseDamageBonusTaken (SpellSchoolMask schoolMask) const
 
uint32 SpellDamageBonusDone (Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, SpellEffectInfo const *effect, uint32 stack=1) const
 
float SpellDamagePctDone (Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype) const
 
uint32 SpellDamageBonusTaken (Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, SpellEffectInfo const *effect, uint32 stack=1) const
 
int32 SpellBaseHealingBonusDone (SpellSchoolMask schoolMask) const
 
int32 SpellBaseHealingBonusTaken (SpellSchoolMask schoolMask) const
 
uint32 SpellHealingBonusDone (Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, SpellEffectInfo const *effect, uint32 stack=1) const
 
float SpellHealingPctDone (Unit *victim, SpellInfo const *spellProto) const
 
uint32 SpellHealingBonusTaken (Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, SpellEffectInfo const *effect, uint32 stack=1) const
 
uint32 MeleeDamageBonusDone (Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const *spellProto=NULL)
 
uint32 MeleeDamageBonusTaken (Unit *attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const *spellProto=NULL)
 
bool isSpellBlocked (Unit *victim, SpellInfo const *spellProto, WeaponAttackType attackType=BASE_ATTACK)
 
bool isBlockCritical ()
 
bool IsSpellCrit (Unit *victim, SpellInfo const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType=BASE_ATTACK) const
 
float GetUnitSpellCriticalChance (Unit *victim, SpellInfo const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType=BASE_ATTACK) const
 
uint32 SpellCriticalDamageBonus (SpellInfo const *spellProto, uint32 damage, Unit *victim)
 
uint32 SpellCriticalHealingBonus (SpellInfo const *spellProto, uint32 damage, Unit *victim)
 
void SetContestedPvP (Player *attackedPlayer=NULL)
 
uint32 GetCastingTimeForBonus (SpellInfo const *spellProto, DamageEffectType damagetype, uint32 CastingTime) const
 
float CalculateDefaultCoefficient (SpellInfo const *spellInfo, DamageEffectType damagetype) const
 
uint32 GetRemainingPeriodicAmount (ObjectGuid caster, uint32 spellId, AuraType auraType, uint8 effectIndex=0) const
 
void ApplySpellImmune (uint32 spellId, uint32 op, uint32 type, bool apply)
 
void ApplySpellDispelImmunity (const SpellInfo *spellProto, DispelType type, bool apply)
 
uint32 GetSchoolImmunityMask () const
 
uint32 GetMechanicImmunityMask () const
 
bool IsImmunedToDamage (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToDamage (SpellInfo const *spellInfo) const
 
bool IsDamageReducedByArmor (SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=NULL, uint8 effIndex=MAX_SPELL_EFFECTS)
 
uint32 CalcArmorReducedDamage (Unit *victim, const uint32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=MAX_ATTACK)
 
uint32 CalcSpellResistance (Unit *victim, SpellSchoolMask schoolMask, SpellInfo const *spellInfo) const
 
void CalcAbsorbResist (Unit *victim, SpellSchoolMask schoolMask, DamageEffectType damagetype, uint32 const damage, uint32 *absorb, uint32 *resist, SpellInfo const *spellInfo=NULL)
 
void CalcHealAbsorb (Unit *victim, SpellInfo const *spellInfo, uint32 &healAmount, uint32 &absorb)
 
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)
 
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, float *variance=nullptr, int32 itemLevel=-1) 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=NULL)
 
void ModSpellDurationTime (SpellInfo const *spellProto, int32 &castTime, Spell *spell=NULL)
 
float CalculateLevelPenalty (SpellInfo const *spellProto) const
 
void addFollower (FollowerReference *pRef)
 
void removeFollower (FollowerReference *)
 
MotionMasterGetMotionMaster ()
 
const MotionMasterGetMotionMaster () const
 
bool IsStopped () const
 
void StopMoving ()
 -------—End of Pet responses methods-------— More...
 
void AddUnitMovementFlag (uint32 f)
 
void RemoveUnitMovementFlag (uint32 f)
 
bool HasUnitMovementFlag (uint32 f) const
 
uint32 GetUnitMovementFlags () const
 
void SetUnitMovementFlags (uint32 f)
 
void AddExtraUnitMovementFlag (uint16 f)
 
void RemoveExtraUnitMovementFlag (uint16 f)
 
uint16 HasExtraUnitMovementFlag (uint16 f) const
 
uint16 GetExtraUnitMovementFlags () const
 
void SetExtraUnitMovementFlags (uint16 f)
 
bool IsSplineEnabled () const
 
float GetPositionZMinusOffset () const
 
void SetControlled (bool apply, UnitState state)
 
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 () const
 
void SetCantProc (bool apply)
 
void AddPetAura (PetAura const *petSpell)
 
void RemovePetAura (PetAura const *petSpell)
 
uint32 GetModelForForm (ShapeshiftForm form) const
 
uint32 GetModelForTotem (PlayerTotemType totemType)
 
void SetRedirectThreat (ObjectGuid guid, uint32 pct)
 
void ResetRedirectThreat ()
 
void ModifyRedirectThreat (int32 amount)
 
uint32 GetRedirectThreatPercent () const
 
UnitGetRedirectThreatTarget ()
 
bool CreateVehicleKit (uint32 id, uint32 creatureEntry, bool loading=false)
 
void RemoveVehicleKit (bool onRemoveFromWorld=false)
 
VehicleGetVehicleKit () const
 
VehicleGetVehicle () const
 
void SetVehicle (Vehicle *vehicle)
 
bool IsOnVehicle (const Unit *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 ExitVehicle (Position const *exitPosition=NULL)
 
void ChangeSeat (int8 seatId, bool next=true)
 
void _ExitVehicle (Position const *exitPosition=NULL)
 
void _EnterVehicle (Vehicle *vehicle, int8 seatId, AuraApplication const *aurApp=NULL)
 
bool isMoving () const
 
bool isTurning () const
 
bool IsFlying () const
 
bool IsFalling () const
 
void RewardRage (uint32 baseRage, bool attacker)
 
virtual float GetFollowAngle () const
 
void OutDebugInfo () const
 
virtual bool IsLoading () const
 
bool IsDuringRemoveFromWorld () const
 
PetToPet ()
 
Pet constToPet () const
 
TotemToTotem ()
 
Totem constToTotem () const
 
TempSummonToTempSummon ()
 
TempSummon constToTempSummon () const
 
ObjectGuid GetTarget () const
 
time_t GetLastDamagedTime () const
 
void SetLastDamagedTime (time_t val)
 
int32 GetHighestExclusiveSameEffectSpellGroupValue (AuraEffect const *aurEff, AuraType auraType, bool checkMiscValue=false, int32 miscValue=0) const
 
bool IsHighestExclusiveAura (Aura const *aura, bool removeOtherAuraApplications=false)
 
virtual void Talk (std::string const &text, ChatMsg msgType, Language language, float textRange, WorldObject const *target)
 
virtual void Say (std::string const &text, Language language, WorldObject const *target=nullptr)
 
virtual void Yell (std::string const &text, Language language, WorldObject const *target=nullptr)
 
virtual void TextEmote (std::string const &text, WorldObject const *target=nullptr, bool isBossEmote=false)
 
virtual void Whisper (std::string const &text, Language language, Player *target, bool isBossWhisper=false)
 
void Talk (uint32 textId, ChatMsg msgType, float textRange, WorldObject const *target)
 
void Say (uint32 textId, WorldObject const *target=nullptr)
 
void Yell (uint32 textId, WorldObject const *target=nullptr)
 
void TextEmote (uint32 textId, WorldObject const *target=nullptr, bool isBossEmote=false)
 
void Whisper (uint32 textId, Player *target, bool isBossWhisper=false)
 
uint32 GetVirtualItemId (uint32 slot) const
 
void SetVirtualItem (uint32 slot, uint32 itemId, uint16 appearanceModId=0)
 
- Public Member Functions inherited from WorldObject
virtual ~WorldObject ()
 
void GetNearPoint2D (float &x, float &y, float distance, float absAngle) const
 
void GetNearPoint (WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle) const
 
void GetClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float angle=0) const
 
void MovePosition (Position &pos, float dist, float angle)
 
Position GetNearPosition (float dist, float angle)
 
void MovePositionToFirstCollision (Position &pos, float dist, float angle)
 
Position GetFirstCollisionPosition (float dist, float angle)
 
Position GetRandomNearPosition (float radius)
 
void GetContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
float GetObjectSize () const
 
void UpdateGroundPositionZ (float x, float y, float &z) const
 
void UpdateAllowedPositionZ (float x, float y, float &z) const
 
void GetRandomPoint (Position const &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
 
Position GetRandomPoint (Position const &srcPos, float distance) const
 
uint32 GetInstanceId () const
 
virtual void SetPhaseMask (uint32 newPhaseMask, bool update)
 
void CopyPhaseFrom (WorldObject *obj, bool update=false)
 
void UpdateAreaPhase ()
 
void ClearPhases (bool update=false)
 
void RebuildTerrainSwaps ()
 
void RebuildWorldMapAreaSwaps ()
 
bool HasInPhaseList (uint32 phase)
 
uint32 GetPhaseMask () const
 
bool IsInPhase (uint32 phase) const
 
bool IsInPhase (WorldObject const *obj) const
 
bool IsInTerrainSwap (uint32 terrainSwap) const
 
std::set< uint32 > constGetPhases () const
 
std::set< uint32 > constGetTerrainSwaps () const
 
std::set< uint32 > constGetWorldMapAreaSwaps () const
 
int32 GetDBPhase () const
 
void SetDBPhase (int32 p)
 
uint32 GetZoneId () const
 
uint32 GetAreaId () const
 
void GetZoneAndAreaId (uint32 &zoneid, uint32 &areaid) const
 
InstanceScriptGetInstanceScript ()
 
std::string constGetName () const
 
void SetName (std::string const &newname)
 
float GetDistance (WorldObject const *obj) const
 
float GetDistance (Position const &pos) const
 
float GetDistance (float x, float y, float z) const
 
float GetDistance2d (WorldObject const *obj) const
 
float GetDistance2d (float x, float y) const
 
float GetDistanceZ (WorldObject const *obj) const
 
bool IsSelfOrInSameMap (WorldObject const *obj) const
 
bool IsInMap (WorldObject const *obj) const
 
bool IsWithinDist3d (float x, float y, float z, float dist) const
 
bool IsWithinDist3d (Position const *pos, float dist) const
 
bool IsWithinDist2d (float x, float y, float dist) const
 
bool IsWithinDist2d (Position const *pos, float dist) const
 
bool IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D=true) const
 
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true) const
 
bool IsWithinLOS (float x, float y, float z) const
 
bool IsWithinLOSInMap (WorldObject const *obj) const
 
bool GetDistanceOrder (WorldObject const *obj1, WorldObject const *obj2, bool is3D=true) const
 
bool IsInRange (WorldObject const *obj, float minRange, float maxRange, bool is3D=true) const
 
bool IsInRange2d (float x, float y, float minRange, float maxRange) const
 
bool IsInRange3d (float x, float y, float z, float minRange, float maxRange) const
 
bool isInFront (WorldObject const *target, float arc=float(M_PI)) const
 
bool isInBack (WorldObject const *target, float arc=float(M_PI)) const
 
bool IsInBetween (WorldObject const *obj1, WorldObject const *obj2, float size=0) const
 
virtual void SendMessageToSet (WorldPacket const *data, bool self)
 
virtual void SendMessageToSetInRange (WorldPacket const *data, float dist, bool self)
 
virtual void SendMessageToSet (WorldPacket const *data, Player const *skipped_rcvr)
 
void PlayDistanceSound (uint32 sound_id, Player *target=NULL)
 
void PlayDirectSound (uint32 sound_id, Player *target=NULL)
 
void SendObjectDeSpawnAnim (ObjectGuid guid)
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
float GetSightRange (WorldObject const *target=NULL) const
 
bool CanSeeOrDetect (WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
 
virtual void SetMap (Map *map)
 
virtual void ResetMap ()
 
MapGetMap () const
 
MapFindMap () const
 
Map constGetBaseMap () const
 
void SetZoneScript ()
 
ZoneScriptGetZoneScript () const
 
TempSummonSummonCreature (uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
 
TempSummonSummonCreature (uint32 id, float x, float y, float z, float ang=0, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0) const
 
GameObjectSummonGameObject (uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
 
CreatureSummonTrigger (float x, float y, float z, float ang, uint32 dur, CreatureAI *(*GetAI)(Creature *)=NULL)
 
void SummonCreatureGroup (uint8 group, std::list< TempSummon * > *list=NULL)
 
CreatureFindNearestCreature (uint32 entry, float range, bool alive=true) const
 
GameObjectFindNearestGameObject (uint32 entry, float range) const
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetPlayerListInGrid (std::list< Player * > &lList, float fMaxSearchRange) const
 
void DestroyForNearbyPlayers ()
 
void BuildUpdate (UpdateDataMapType &) override
 
void AddToObjectUpdate () override
 
void RemoveFromObjectUpdate () override
 
void AddToNotify (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)
 
void SetWorldObject (bool apply)
 
bool IsPermanentWorldObject () const
 
bool IsWorldObject () const
 
template<class NOTIFIER >
void VisitNearbyObject (float const &radius, NOTIFIER &notifier) const
 
template<class NOTIFIER >
void VisitNearbyGridObject (float const &radius, NOTIFIER &notifier) const
 
template<class NOTIFIER >
void VisitNearbyWorldObject (float const &radius, NOTIFIER &notifier) const
 
TransportGetTransport () const
 
float GetTransOffsetX () const
 
float GetTransOffsetY () const
 
float GetTransOffsetZ () const
 
float GetTransOffsetO () const
 
uint32 GetTransTime () const
 
int8 GetTransSeat () const
 
void SetTransport (Transport *t)
 
virtual float GetStationaryX () const
 
virtual float GetStationaryY () const
 
virtual float GetStationaryZ () const
 
virtual float GetStationaryO () const
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
ObjectGuid constGetGUID () const
 
PackedGuid constGetPackGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
TypeID GetTypeId () const
 
bool isType (uint16 mask) const
 
virtual void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target) const
 
void SendUpdateToPlayer (Player *player)
 
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player *target) const
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
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 constGetGuidValue (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 SetGuidValue (uint16 index, ObjectGuid const &value)
 
void SetStatFloatValue (uint16 index, float value)
 
void SetStatInt32Value (uint16 index, int32 value)
 
bool AddGuidValue (uint16 index, ObjectGuid const &value)
 
bool RemoveGuidValue (uint16 index, ObjectGuid const &value)
 
void ApplyModUInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModUInt16Value (uint16 index, uint8 offset, int16 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)
 
void ToggleByteFlag (uint16 index, uint8 offset, uint8 flag)
 
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)
 
std::vector< uint32 > constGetDynamicValues (uint16 index) const
 
void AddDynamicValue (uint16 index, uint32 value)
 
void RemoveDynamicValue (uint16 index, uint32 value)
 
void ClearDynamicValue (uint16 index)
 
void SetDynamicValue (uint16 index, uint8 offset, uint32 value)
 
void ClearUpdateMask (bool remove)
 
uint16 GetValuesCount () const
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &) const
 
void SetFieldNotifyFlag (uint16 flag)
 
void RemoveFieldNotifyFlag (uint16 flag)
 
void ForceValuesUpdateAtIndex (uint32)
 
PlayerToPlayer ()
 
Player constToPlayer () const
 
CreatureToCreature ()
 
Creature constToCreature () const
 
UnitToUnit ()
 
Unit constToUnit () const
 
GameObjectToGameObject ()
 
GameObject constToGameObject () const
 
CorpseToCorpse ()
 
Corpse constToCorpse () const
 
DynamicObjectToDynObject ()
 
DynamicObject constToDynObject () const
 
AreaTriggerToAreaTrigger ()
 
AreaTrigger constToAreaTrigger () 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 (WorldLocation const &loc)
 
void WorldRelocate (WorldLocation const &loc)
 
void WorldRelocate (uint32 mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
WorldLocation GetWorldLocation () const
 
uint32 GetMapId () const
 
- Public Member Functions inherited from Position
 Position (float x=0, float y=0, float z=0, float o=0)
 
 Position (Position const &loc)
 
bool operator== (Position const &a)
 
bool operator!= (Position const &a)
 
void Relocate (float x, float y)
 
void Relocate (float x, float y, float z)
 
void Relocate (float x, float y, float z, float orientation)
 
void Relocate (Position const &pos)
 
void Relocate (Position const *pos)
 
void Relocate (G3D::Vector3 const &pos)
 
void RelocateOffset (Position const &offset)
 
void SetOrientation (float orientation)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
float GetOrientation () const
 
void GetPosition (float &x, float &y) const
 
void GetPosition (float &x, float &y, float &z) const
 
void GetPosition (float &x, float &y, float &z, float &o) const
 
Position GetPosition () const
 
Position::PositionXYStreamer PositionXYStream ()
 
Position::PositionXYZStreamer PositionXYZStream ()
 
Position::PositionXYZOStreamer PositionXYZOStream ()
 
bool IsPositionValid () const
 
float GetExactDist2dSq (float x, float y) const
 
float GetExactDist2d (const float x, const float y) const
 
float GetExactDist2dSq (Position const *pos) const
 
float GetExactDist2d (Position const *pos) const
 
float GetExactDistSq (float x, float y, float z) const
 
float GetExactDist (float x, float y, float z) const
 
float GetExactDistSq (Position const *pos) const
 
float GetExactDist (Position const *pos) const
 
void GetPositionOffsetTo (Position const &endPos, Position &retOffset) const
 
Position GetPositionWithOffset (Position const &offset) const
 
float GetAngle (Position const *pos) const
 
float GetAngle (float x, float y) const
 
float GetRelativeAngle (Position const *pos) const
 
float GetRelativeAngle (float x, float y) const
 
void GetSinCos (float x, float y, float &vsin, float &vcos) const
 
bool IsInDist2d (float x, float y, float dist) const
 
bool IsInDist2d (Position const *pos, float dist) const
 
bool IsInDist (float x, float y, float z, float dist) const
 
bool IsInDist (Position const *pos, float dist) const
 
bool IsWithinBox (const Position &center, float xradius, float yradius, float zradius) const
 
bool HasInArc (float arcangle, Position const *pos, float border=2.0f) const
 
bool HasInLine (Position const *pos, float width) const
 
std::string ToString () const
 
- Public Member Functions inherited from GridObject< Creature >
virtual ~GridObject ()
 
bool IsInGrid () const
 
void AddToGrid (GridRefManager< Creature > &m)
 
void RemoveFromGrid ()
 

Static Public Member Functions

static float _GetDamageMod (int32 Rank)
 
- Static Public Member Functions inherited from Unit
static ReputationRank GetFactionReactionTo (FactionTemplateEntry const *factionTemplateEntry, Unit const *target)
 
- Static Public Member Functions inherited from Position
static float NormalizeOrientation (float o)
 

Public Attributes

Loot loot
 
uint32 m_spells [CREATURE_MAX_SPELLS]
 
uint32 m_groupLootTimer
 
ObjectGuid lootingGroupLowGUID
 
uint32 m_PlayerDamageReq
 
float m_SightDistance
 
float m_CombatDistance
 
bool m_isTempWorldObject
 
- Public Attributes inherited from Unit
uint32 m_extraAttacks
 
bool m_canDualWield
 
ControlList m_Controlled
 
Playerm_movedPlayer
 
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
 
ObjectGuid LastCharmerGUID
 
bool m_ControlledByPlayer
 
Movement::MoveSplinemovespline
 
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32,
uint32, StealthType,
TOTAL_STEALTH_TYPES
m_stealth
 
FlaggedValuesArray32< int32,
uint32, StealthType,
TOTAL_STEALTH_TYPES
m_stealthDetect
 
FlaggedValuesArray32< int32,
uint32, InvisibilityType,
TOTAL_INVISIBILITY_TYPES
m_invisibility
 
FlaggedValuesArray32< int32,
uint32, InvisibilityType,
TOTAL_INVISIBILITY_TYPES
m_invisibilityDetect
 
FlaggedValuesArray32< int32,
uint32,
ServerSideVisibilityType,
TOTAL_SERVERSIDE_VISIBILITY_TYPES
m_serverSideVisibility
 
FlaggedValuesArray32< int32,
uint32,
ServerSideVisibilityType,
TOTAL_SERVERSIDE_VISIBILITY_TYPES
m_serverSideVisibilityDetect
 
uint32 LastUsedScriptID
 
MovementInfo m_movementInfo
 
- Public Attributes inherited from WorldLocation
uint32 m_mapId
 
- Public Attributes inherited from Position
float m_positionX
 
float m_positionY
 
float m_positionZ
 

Protected Member Functions

bool CreateFromProto (ObjectGuid::LowType guidlow, uint32 entry, CreatureData const *data=nullptr, uint32 vehId=0)
 
bool InitEntry (uint32 entry, CreatureData const *data=nullptr)
 
void RegenerateMana ()
 
void RegenerateHealth ()
 
void Regenerate (Powers power)
 
bool IsInvisibleDueToDespawn () const override
 
bool CanAlwaysSee (WorldObject const *obj) const override
 
- Protected Member Functions inherited from Unit
 Unit (bool isWorldObject)
 
void BuildValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const override
 
void DestroyForPlayer (Player *target) const override
 
void _UpdateSpells (uint32 time)
 
void _DeleteRemovedAuras ()
 
void _UpdateAutoRepeatSpell ()
 
bool IsAlwaysVisibleFor (WorldObject const *seer) const override
 
bool IsAlwaysDetectableFor (WorldObject const *seer) const override
 
void DisableSpline ()
 
void SetFeared (bool apply)
 
void SetConfused (bool apply)
 
void SetStunned (bool apply)
 
void SetRooted (bool apply, bool packetOnly=false)
 
- Protected Member Functions inherited from WorldObject
 WorldObject (bool isWorldObject)
 
void SetLocationMapId (uint32 _mapId)
 
void SetLocationInstanceId (uint32 _instanceId)
 
virtual bool IsNeverVisible () const
 
- Protected Member Functions inherited from Object
 Object ()
 
void _InitValues ()
 
void _Create (ObjectGuid const &guid)
 
std::string _ConcatFields (uint16 startIndex, uint16 size) const
 
void _LoadIntoDataField (std::string const &data, uint32 startOffset, uint32 count)
 
uint32 GetUpdateFieldData (Player const *target, uint32 *&flags) const
 
uint32 GetDynamicUpdateFieldData (Player const *target, uint32 *&flags) const
 
void BuildMovementUpdate (ByteBuffer *data, uint32 flags) const
 
virtual void BuildDynamicValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const
 
void AddToObjectUpdateIfNeeded ()
 
- Protected Member Functions inherited from MapObject
 MapObject ()
 

Static Protected Member Functions

static float _GetHealthMod (int32 Rank)
 

Protected Attributes

VendorItemCounts m_vendorItemCounts
 
ObjectGuid m_lootRecipient
 
ObjectGuid m_lootRecipientGroup
 
ObjectGuid _skinner
 
time_t _pickpocketLootRestore
 Timers. More...
 
time_t m_corpseRemoveTime
 
time_t m_respawnTime
 
uint32 m_respawnDelay
 
uint32 m_corpseDelay
 
float m_respawnradius
 
uint32 m_boundaryCheckTime
 
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_AI_locked
 
SpellSchoolMask m_meleeDamageSchoolMask
 
uint32 m_originalEntry
 
Position m_homePosition
 
Position m_transportHomePosition
 
bool DisableReputationGain
 
CreatureTemplate constm_creatureInfo
 
CreatureData constm_creatureData
 
uint16 m_LootMode
 
- Protected Attributes inherited from Unit
UnitAIi_AI
 
UnitAIi_disabledAI
 
bool m_AutoRepeatFirstCast
 
uint32 m_attackTimer [MAX_ATTACK]
 
float m_createStats [MAX_STATS]
 
AttackerSet m_attackers
 
Unitm_attacking
 
bool m_shouldReacquireTarget
 
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][2]
 
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]
 
uint32 m_regenTimer
 
ThreatManager m_ThreatManager
 
Vehiclem_vehicle
 
Vehiclem_vehicleKit
 
uint32 m_unitTypeMask
 
LiquidTypeEntry const_lastLiquid
 
uint32 m_movementCounter
 Incrementing counter used in movement packets. More...
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
const bool m_isWorldObject
 
ZoneScriptm_zoneScript
 
Transportm_transport
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
TypeID m_objectTypeId
 
uint32 m_updateFlag
 
union {
   int32 *   m_int32Values
 
   uint32 *   m_uint32Values
 
   float *   m_floatValues
 
}; 
 
std::vector< uint32 > * _dynamicValues
 
UpdateMask _changesMask
 
UpdateMask _dynamicChangesMask
 
UpdateMask_dynamicChangesArrayMask
 
uint16 m_valuesCount
 
uint16 _dynamicValuesCount
 
uint16 _fieldNotifyFlags
 
bool m_objectUpdated
 

Private Member Functions

void ForcedDespawn (uint32 timeMSToDespawn=0)
 
bool CheckNoGrayAggroConfig (uint32 playerLevel, uint32 creatureLevel) const
 

Private Attributes

uint32 m_waypointID
 
uint32 m_path_id
 
CreatureGroupm_formation
 
bool TriggerJustRespawned
 
Spell const_focusSpell
 
uint32 _focusDelay
 

Locks the target during spell cast for proper facing

More...
 
CreatureTextRepeatGroup m_textRepeat
 

Additional Inherited Members

- Public Types inherited from Unit
typedef std::set< Unit * > AttackerSet
 
typedef std::set< Unit * > ControlList
 
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
< DiminishingReturn
Diminishing
 
typedef std::map< uint8,
AuraApplication * > 
VisibleAuraMap
 
typedef std::set< PetAura const * > PetAuraSet
 
- Protected Types inherited from Unit
typedef std::list
< DynamicObject * > 
DynObjectList
 
typedef std::list< GameObject * > GameObjectList
 

Constructor & Destructor Documentation

Creature::Creature ( bool  isWorldObject = false)
explicit
182  : Unit(isWorldObject), MapObject(),
189 {
193 
194  for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
195  m_spells[i] = 0;
196 
197  DisableReputationGain = false;
198 
199  m_SightDistance = sWorld->getFloatConfig(CONFIG_SIGHT_MONSTER);
200  m_CombatDistance = 0;//MELEE_RANGE;
201 
202  ResetLootMode(); // restore default loot mode
203  TriggerJustRespawned = false;
204  m_isTempWorldObject = false;
205  _focusSpell = NULL;
206  _focusDelay = 0;
207 }
Position m_transportHomePosition
Definition: Creature.h:760
uint32 m_corpseDelay
Definition: Creature.h:736
CreatureTemplate const * m_creatureInfo
Definition: Creature.h:764
Definition: MotionMaster.h:37
CreatureData const * m_creatureData
Definition: Creature.h:765
Position m_homePosition
Definition: Creature.h:759
Definition: Unit.h:1131
#define CREATURE_MAX_SPELLS
Definition: Creature.h:75
uint32 m_boundaryCheckTime
Definition: Creature.h:738
bool m_isTempWorldObject
Definition: Creature.h:706
time_t m_respawnTime
Definition: Creature.h:734
uint16 _dynamicValuesCount
Definition: Object.h:246
bool m_AlreadyCallAssistance
Definition: Creature.h:751
bool m_AlreadySearchedAssistance
Definition: Creature.h:752
#define UI64LIT(N)
Definition: Define.h:138
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: World.h:188
MovementGeneratorType m_defaultMovementType
Definition: Creature.h:746
#define sWorld
Definition: World.h:887
Definition: UpdateFields.h:183
time_t _pickpocketLootRestore
Timers.
Definition: Creature.h:732
uint32 m_combatPulseDelay
Definition: Creature.h:740
ReactStates m_reactState
Definition: Creature.h:742
uint32 m_PlayerDamageReq
Definition: Creature.h:697
float m_respawnradius
Definition: Creature.h:737
uint32 m_spells[CREATURE_MAX_SPELLS]
Definition: Creature.h:602
CreatureGroup * m_formation
Definition: Creature.h:781
time_t m_corpseRemoveTime
Definition: Creature.h:733
#define CREATURE_REGEN_INTERVAL
Definition: Creature.h:70
Definition: SharedDefines.h:288
Definition: UpdateFields.h:176
MapObject()
Definition: Object.h:404
bool m_regenHealth
Definition: Creature.h:753
bool m_AI_locked
Definition: Creature.h:754
uint32 m_combatPulseTime
Definition: Creature.h:739
uint32 m_originalEntry
Definition: Creature.h:757
Spell const * _focusSpell
Definition: Creature.h:784
uint32 m_path_id
Definition: Creature.h:778
uint8 m_equipmentId
Definition: Creature.h:748
bool DisableReputationGain
Definition: Creature.h:762
bool TriggerJustRespawned
Definition: Creature.h:782
SpellSchoolMask m_meleeDamageSchoolMask
Definition: Creature.h:756
void ResetLootMode()
Definition: Creature.h:597
uint32 m_respawnDelay
Definition: Creature.h:735
uint32 m_groupLootTimer
Definition: Creature.h:652
uint32 _focusDelay
Locks the target during spell cast for proper facing
Definition: Creature.h:785
float m_SightDistance
Definition: Creature.h:704
uint16 m_valuesCount
Definition: Object.h:245
uint8_t uint8
Definition: Define.h:152
ObjectGuid::LowType m_spawnId
For new or temporary creatures is 0 for saved it is lowguid.
Definition: Creature.h:747
float m_CombatDistance
Definition: Creature.h:704
uint32 m_waypointID
Definition: Creature.h:777
Unit(bool isWorldObject)
Definition: Unit.cpp:197
int8 m_originalEquipmentId
Definition: Creature.h:749
uint32 m_regenTimer
Definition: Unit.h:2300

+ Here is the call graph for this function:

Creature::~Creature ( )
virtual
210 {
211  delete i_AI;
212  i_AI = NULL;
213 
214  //if (m_uint32Values)
215  // TC_LOG_ERROR("entities.unit", "Deconstruct Creature Entry = %u", GetEntry());
216 }
arena_t NULL
Definition: jemalloc_internal.h:624
UnitAI * i_AI
Definition: Unit.h:2242

Member Function Documentation

float Creature::_GetDamageMod ( int32  Rank)
static
1246 {
1247  switch (Rank) // define rates for each elite rank
1248  {
1249  case CREATURE_ELITE_NORMAL:
1250  return sWorld->getRate(RATE_CREATURE_NORMAL_DAMAGE);
1251  case CREATURE_ELITE_ELITE:
1252  return sWorld->getRate(RATE_CREATURE_ELITE_ELITE_DAMAGE);
1257  case CREATURE_ELITE_RARE:
1258  return sWorld->getRate(RATE_CREATURE_ELITE_RARE_DAMAGE);
1259  default:
1260  return sWorld->getRate(RATE_CREATURE_ELITE_ELITE_DAMAGE);
1261  }
1262 }
Definition: World.h:421
#define sWorld
Definition: World.h:887
Definition: SharedDefines.h:3707
Definition: SharedDefines.h:3704
Definition: SharedDefines.h:3706
Definition: World.h:417
Definition: SharedDefines.h:3708
Definition: World.h:418
Definition: SharedDefines.h:3705

+ Here is the caller graph for this function:

float Creature::_GetHealthMod ( int32  Rank)
staticprotected
1221 {
1222  switch (Rank) // define rates for each elite rank
1223  {
1224  case CREATURE_ELITE_NORMAL:
1225  return sWorld->getRate(RATE_CREATURE_NORMAL_HP);
1226  case CREATURE_ELITE_ELITE:
1227  return sWorld->getRate(RATE_CREATURE_ELITE_ELITE_HP);
1229  return sWorld->getRate(RATE_CREATURE_ELITE_RAREELITE_HP);
1231  return sWorld->getRate(RATE_CREATURE_ELITE_WORLDBOSS_HP);
1232  case CREATURE_ELITE_RARE:
1233  return sWorld->getRate(RATE_CREATURE_ELITE_RARE_HP);
1234  default:
1235  return sWorld->getRate(RATE_CREATURE_ELITE_ELITE_HP);
1236  }
1237 }
Definition: World.h:416
Definition: World.h:412
Definition: World.h:415
#define sWorld
Definition: World.h:887
Definition: World.h:413
Definition: SharedDefines.h:3707
Definition: SharedDefines.h:3704
Definition: SharedDefines.h:3706
Definition: World.h:414
Definition: SharedDefines.h:3708
Definition: SharedDefines.h:3705

+ Here is the caller graph for this function:

bool Creature::_IsTargetAcceptable ( const Unit target) const
2128 {
2129  ASSERT(target);
2130 
2131  // if the target cannot be attacked, the target is not acceptable
2132  if (IsFriendlyTo(target)
2133  || !target->isTargetableForAttack(false)
2134  || (m_vehicle && (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target))))
2135  return false;
2136 
2137  if (target->HasUnitState(UNIT_STATE_DIED))
2138  {
2139  // guards can detect fake death
2141  return true;
2142  else
2143  return false;
2144  }
2145 
2146  const Unit* myVictim = getAttackerForHelper();
2147  const Unit* targetVictim = target->getAttackerForHelper();
2148 
2149  // if I'm already fighting target, or I'm hostile towards the target, the target is acceptable
2150  if (myVictim == target || targetVictim == this || IsHostileTo(target))
2151  return true;
2152 
2153  // if the target's victim is friendly, and the target is neutral, the target is acceptable
2154  if (targetVictim && IsFriendlyTo(targetVictim))
2155  return true;
2156 
2157  // if the target's victim is not friendly, or the target is friendly, the target is not acceptable
2158  return false;
2159 }
bool IsOnVehicle(const Unit *vehicle) const
Definition: Unit.cpp:14336
Definition: UpdateFields.h:110
Vehicle * m_vehicle
Definition: Unit.h:2304
bool IsFriendlyTo(Unit const *unit) const
Definition: Unit.cpp:7170
Definition: Unit.h:711
bool IsGuard() const
Definition: Creature.h:497
Definition: Unit.h:550
bool IsHostileTo(Unit const *unit) const
Definition: Unit.cpp:7165
Unit * getAttackerForHelper() const
Definition: Unit.cpp:7211
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1395
#define ASSERT
Definition: Errors.h:55
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.cpp:1239
Definition: Unit.h:1305
bool isTargetableForAttack(bool checkFakeDeath=true) const
Definition: Unit.cpp:9987
Unit * GetBase() const
May be called from scripts.
Definition: Vehicle.h:49

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::AddLootMode ( uint16  lootMode)
inline
595 { m_LootMode |= lootMode; }
uint16 m_LootMode
Definition: Creature.h:767

+ Here is the caller graph for this function:

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

Reimplemented from Object.

Reimplemented in Pet.

219 {
221  if (!IsInWorld())
222  {
223  if (GetZoneScript())
225 
227  if (m_spawnId)
228  GetMap()->GetCreatureBySpawnIdStore().insert(std::make_pair(m_spawnId, this));
229 
231  SearchFormation();
232  AIM_Initialize();
233  if (IsVehicle())
234  GetVehicleKit()->Install();
235  }
236 }
bool Insert(KEY_TYPE const &handle, SPECIFIC_TYPE *obj)
Definition: TypeContainer.h:119
Map * GetMap() const
Definition: Object.h:543
bool IsVehicle() const
Definition: Unit.h:1406
void Install()
Initializes power type for vehicle. Nothing more.
Definition: Vehicle.cpp:73
void AddToWorld() override
Definition: Unit.cpp:11724
Definition: Creature.h:467
bool AIM_Initialize(CreatureAI *ai=NULL)
Definition: Creature.cpp:796
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:466
ObjectGuid const & GetGUID() const
Definition: Object.h:105
ZoneScript * GetZoneScript() const
Definition: Object.h:551
CreatureBySpawnIdContainer & GetCreatureBySpawnIdStore()
Definition: Map.h:469
void SearchFormation()
Definition: Creature.cpp:266
ObjectGuid::LowType m_spawnId
For new or temporary creatures is 0 for saved it is lowguid.
Definition: Creature.h:747
bool IsInWorld() const
Definition: Object.h:100
virtual void OnCreatureCreate(Creature *)
Definition: ZoneScript.h:35
Vehicle * GetVehicleKit() const
Definition: Unit.h:2165

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CreatureAI* Creature::AI ( ) const
inline
525 { return (CreatureAI*)i_AI; }
UnitAI * i_AI
Definition: Unit.h:2242
Definition: CreatureAI.h:68
bool Creature::AIM_Initialize ( CreatureAI ai = NULL)
797 {
798  // make sure nothing can change the AI during AI update
799  if (m_AI_locked)
800  {
801  TC_LOG_DEBUG("scripts", "AIM_Initialize: failed to init, locked.");
802  return false;
803  }
804 
805  UnitAI* oldAI = i_AI;
806 
808 
809  i_AI = ai ? ai : FactorySelector::selectAI(this);
810  delete oldAI;
811  IsAIEnabled = true;
812  i_AI->InitializeAI();
813  // Initialize vehicle
814  if (GetVehicleKit())
815  GetVehicleKit()->Reset();
816  return true;
817 }
void Motion_Initialize()
Definition: Creature.cpp:819
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
bool IsAIEnabled
Definition: Unit.h:2161
UnitAI * i_AI
Definition: Unit.h:2242
virtual void InitializeAI()
Definition: UnitAI.h:130
bool m_AI_locked
Definition: Creature.h:754
void Reset(bool evading=false)
Reapplies immunities and reinstalls accessories. Only has effect for creatures.
Definition: Vehicle.cpp:141
CreatureAI * selectAI(Creature *creature)
Definition: CreatureAISelector.cpp:30
Vehicle * GetVehicleKit() const
Definition: Unit.h:2165
Definition: UnitAI.h:118

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::AllLootRemovedFromCorpse ( )
2383 {
2384  if (loot.loot_type != LOOT_SKINNING && !IsPet() && GetCreatureTemplate()->SkinLootId && hasLootRecipient())
2387 
2388  time_t now = time(NULL);
2389  // Do not reset corpse remove time if corpse is already removed
2390  if (m_corpseRemoveTime <= now)
2391  return;
2392 
2393  float decayRate = sWorld->getRate(RATE_CORPSE_DECAY_LOOTED);
2394 
2395  // corpse skinnable, but without skinning flag, and then skinned, corpse will despawn next update
2396  if (loot.loot_type == LOOT_SKINNING)
2397  m_corpseRemoveTime = now;
2398  else
2399  m_corpseRemoveTime = now + uint32(m_corpseDelay * decayRate);
2400 
2402 }
Definition: LootMgr.h:95
uint32 m_corpseDelay
Definition: Creature.h:736
Definition: Unit.h:699
LootStore LootTemplates_Skinning("skinning_loot_template","creature skinning id", true)
time_t m_respawnTime
Definition: Creature.h:734
Definition: World.h:437
Loot loot
Definition: Creature.h:578
arena_t NULL
Definition: jemalloc_internal.h:624
#define sWorld
Definition: World.h:887
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
time_t m_corpseRemoveTime
Definition: Creature.h:733
bool HaveLootFor(uint32 loot_id) const
Definition: LootMgr.h:229
bool IsPet() const
Definition: Unit.h:1403
uint32 m_respawnDelay
Definition: Creature.h:735
Definition: UpdateFields.h:109
LootType loot_type
Definition: LootMgr.h:325
bool hasLootRecipient() const
Definition: Creature.h:586
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Implements Unit.

908 {
909  float variance = 1.0f;
910  UnitMods unitMod;
911  switch (attType)
912  {
913  case BASE_ATTACK:
914  default:
915  variance = GetCreatureTemplate()->BaseVariance;
916  unitMod = UNIT_MOD_DAMAGE_MAINHAND;
917  break;
918  case OFF_ATTACK:
919  variance = GetCreatureTemplate()->BaseVariance;
920  unitMod = UNIT_MOD_DAMAGE_OFFHAND;
921  break;
922  case RANGED_ATTACK:
923  variance = GetCreatureTemplate()->RangeVariance;
924  unitMod = UNIT_MOD_DAMAGE_RANGED;
925  break;
926  }
927 
928  if (attType == OFF_ATTACK && !haveOffhandWeapon())
929  {
930  minDamage = 0.0f;
931  maxDamage = 0.0f;
932  return;
933  }
934 
935  float weaponMinDamage = GetWeaponDamageRange(attType, MINDAMAGE);
936  float weaponMaxDamage = GetWeaponDamageRange(attType, MAXDAMAGE);
937 
938  if (!CanUseAttackType(attType)) // disarm case
939  {
940  weaponMinDamage = 0.0f;
941  weaponMaxDamage = 0.0f;
942  }
943 
944  float attackPower = GetTotalAttackPowerValue(attType);
945  float attackSpeedMulti = GetAPMultiplier(attType, normalized);
946  float baseValue = GetModifierValue(unitMod, BASE_VALUE) + (attackPower / 3.5f) * variance;
947  float basePct = GetModifierValue(unitMod, BASE_PCT) * attackSpeedMulti;
948  float totalValue = GetModifierValue(unitMod, TOTAL_VALUE);
949  float totalPct = addTotalPct ? GetModifierValue(unitMod, TOTAL_PCT) : 1.0f;
950  float dmgMultiplier = GetCreatureTemplate()->ModDamage; // = ModDamage * _GetDamageMod(rank);
951 
952  minDamage = ((weaponMinDamage + baseValue) * dmgMultiplier * basePct + totalValue) * totalPct;
953  maxDamage = ((weaponMaxDamage + baseValue) * dmgMultiplier * basePct + totalValue) * totalPct;
954 }
UnitMods
Definition: Unit.h:482
Definition: Unit.h:510
Definition: Unit.h:444
Definition: Unit.h:619
Definition: Unit.h:434
Definition: Unit.h:512
Definition: Unit.h:511
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
Definition: Unit.h:618
float ModDamage
Definition: Creature.h:136
float GetAPMultiplier(WeaponAttackType attType, bool normalized)
Definition: Unit.cpp:13113
float GetModifierValue(UnitMods unitMod, UnitModifierType modifierType) const
Definition: Unit.cpp:11388
bool haveOffhandWeapon() const
Definition: Unit.cpp:418
bool CanUseAttackType(uint8 attacktype) const
Definition: Unit.cpp:2200
float RangeVariance
Definition: Creature.h:107
Definition: Unit.h:437
float GetWeaponDamageRange(WeaponAttackType attType, WeaponDamageRange type) const
Definition: Unit.cpp:11509
Definition: Unit.h:438
Definition: Unit.h:445
Definition: Unit.h:436
float BaseVariance
Definition: Creature.h:106
float GetTotalAttackPowerValue(WeaponAttackType attType) const
Definition: Unit.cpp:11491
Definition: Unit.h:617

+ Here is the call graph for this function:

void Creature::CallAssistance ( )
2022 {
2023  if (!m_AlreadyCallAssistance && GetVictim() && !IsPet() && !IsCharmed())
2024  {
2025  SetNoCallAssistance(true);
2026 
2027  float radius = sWorld->getFloatConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS);
2028 
2029  if (radius > 0)
2030  {
2031  std::list<Creature*> assistList;
2032 
2033  {
2035  Cell cell(p);
2036  cell.SetNoCreate();
2037 
2038  Trinity::AnyAssistCreatureInRangeCheck u_check(this, GetVictim(), radius);
2040 
2042 
2043  cell.Visit(p, grid_creature_searcher, *GetMap(), *this, radius);
2044  }
2045 
2046  if (!assistList.empty())
2047  {
2048  AssistDelayEvent* e = new AssistDelayEvent(EnsureVictim()->GetGUID(), *this);
2049  while (!assistList.empty())
2050  {
2051  // Pushing guids because in delay can happen some creature gets despawned => invalid pointer
2052  e->AddAssistant((*assistList.begin())->GetGUID());
2053  assistList.pop_front();
2054  }
2056  }
2057  }
2058  }
2059 }
Unit * EnsureVictim() const
Definition: Unit.h:1381
EventProcessor m_Events
Definition: Unit.h:1948
Definition: GridNotifiers.h:1098
Definition: TypeContainerVisitor.h:32
Map * GetMap() const
Definition: Object.h:543
void SetNoCallAssistance(bool val)
Definition: Creature.h:618
void AddEvent(BasicEvent *Event, uint64 e_time, bool set_addtime=true)
Definition: EventProcessor.cpp:88
bool m_AlreadyCallAssistance
Definition: Creature.h:751
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:193
Definition: Creature.h:790
#define sWorld
Definition: World.h:887
Definition: TypeContainer.h:86
Unit * GetVictim() const
Definition: Unit.h:1379
float GetPositionY() const
Definition: Position.h:105
Definition: GridNotifiers.h:459
uint64 CalculateTime(uint64 t_offset) const
Definition: EventProcessor.cpp:95
bool IsPet() const
Definition: Unit.h:1403
Definition: Cell.h:49
ObjectGuid const & GetGUID() const
Definition: Object.h:105
void AddAssistant(ObjectGuid guid)
Definition: Creature.h:796
float GetPositionX() const
Definition: Position.h:104
bool IsCharmed() const
Definition: Unit.h:1742

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::CallForHelp ( float  fRadius)
2062 {
2063  if (radius <= 0.0f || !GetVictim() || IsPet() || IsCharmed())
2064  return;
2065 
2067  Cell cell(p);
2068  cell.SetNoCreate();
2069 
2070  Trinity::CallOfHelpCreatureInRangeDo u_do(this, GetVictim(), radius);
2072 
2074 
2075  cell.Visit(p, grid_creature_searcher, *GetMap(), *this, radius);
2076 }
Definition: TypeContainerVisitor.h:32
Map * GetMap() const
Definition: Object.h:543
Definition: GridNotifiers.h:474
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:193
Definition: GridNotifiers.h:960
Definition: TypeContainer.h:86
Unit * GetVictim() const
Definition: Unit.h:1379
float GetPositionY() const
Definition: Position.h:105
bool IsPet() const
Definition: Unit.h:1403
Definition: Cell.h:49
float GetPositionX() const
Definition: Position.h:104
bool IsCharmed() const
Definition: Unit.h:1742

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Reimplemented from WorldObject.

1518 {
1519  if (IsAIEnabled && AI()->CanSeeAlways(obj))
1520  return true;
1521 
1522  return false;
1523 }
bool IsAIEnabled
Definition: Unit.h:2161
CreatureAI * AI() const
Definition: Creature.h:525

+ Here is the call graph for this function:

bool Creature::CanAssistTo ( const Unit u,
const Unit enemy,
bool  checkfaction = true 
) const
2079 {
2080  if (IsInEvadeMode())
2081  return false;
2082 
2083  // is it true?
2085  return false;
2086 
2087  // we don't need help from zombies :)
2088  if (!IsAlive())
2089  return false;
2090 
2091  // we don't need help from non-combatant ;)
2092  if (IsCivilian())
2093  return false;
2094 
2096  return false;
2097 
2098  // skip fighting creature
2099  if (IsInCombat())
2100  return false;
2101 
2102  // only free creature
2103  if (!GetCharmerOrOwnerGUID().IsEmpty())
2104  return false;
2105 
2106  // only from same creature faction
2107  if (checkfaction)
2108  {
2109  if (getFaction() != u->getFaction())
2110  return false;
2111  }
2112  else
2113  {
2114  if (!IsFriendlyTo(u))
2115  return false;
2116  }
2117 
2118  // skip non hostile to caster enemy creatures
2119  if (!IsHostileTo(enemy))
2120  return false;
2121 
2122  return true;
2123 }
Definition: Unit.h:674
Definition: Unit.h:1131
uint32 getFaction() const
Definition: Unit.h:1466
bool IsInCombat() const
Definition: Unit.h:1584
bool HasReactState(ReactStates state) const
Definition: Creature.h:504
bool IsInEvadeMode() const
Definition: Creature.h:520
bool IsAlive() const
Definition: Unit.h:1692
bool IsFriendlyTo(Unit const *unit) const
Definition: Unit.cpp:7170
ObjectGuid GetCharmerOrOwnerGUID() const
Definition: Unit.cpp:12677
Definition: Unit.h:682
bool IsCivilian() const
Definition: Creature.h:495
Definition: UpdateFields.h:109
bool IsHostileTo(Unit const *unit) const
Definition: Unit.cpp:7165
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.cpp:1239
Definition: Unit.h:698

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Creature::CanCreatureAttack ( Unit const victim,
bool  force = true 
) const
2171 {
2172  if (!victim->IsInMap(this))
2173  return false;
2174 
2175  if (!IsValidAttackTarget(victim))
2176  return false;
2177 
2178  if (!victim->isInAccessiblePlaceFor(this))
2179  return false;
2180 
2181  if (IsAIEnabled && !AI()->CanAIAttack(victim))
2182  return false;
2183 
2184  if (GetMap()->IsDungeon())
2185  return true;
2186 
2187  // if the mob is actively being damaged, do not reset due to distance unless it's a world boss
2188  if (!isWorldBoss())
2189  if (time(NULL) - GetLastDamagedTime() <= MAX_AGGRO_RESET_TIME)
2190  return true;
2191 
2192  //Use AttackDistance in distance check if threat radius is lower. This prevents creature bounce in and out of combat every update tick.
2193  float dist = std::max(GetAttackDistance(victim), sWorld->getFloatConfig(CONFIG_THREAT_RADIUS)) + m_CombatDistance;
2194 
2195  if (Unit* unit = GetCharmerOrOwner())
2196  return victim->IsWithinDist(unit, dist);
2197  else
2198  return victim->IsInDist(&m_homePosition, dist);
2199 }
time_t GetLastDamagedTime() const
Definition: Unit.h:2216
Position m_homePosition
Definition: Creature.h:759
Map * GetMap() const
Definition: Object.h:543
bool IsValidAttackTarget(Unit const *target) const
Definition: Unit.cpp:10002
arena_t NULL
Definition: jemalloc_internal.h:624
bool IsDungeon() const
Definition: Map.h:395
#define sWorld
Definition: World.h:887
bool IsAIEnabled
Definition: Unit.h:2161
T max(const T &x, const T &y)
Definition: g3dmath.h:320
virtual bool CanAIAttack(Unit const *) const
Definition: UnitAI.h:126
float GetAttackDistance(Unit const *player) const
Definition: Creature.cpp:1586
Unit * GetCharmerOrOwner() const
Definition: Unit.cpp:7627
CreatureAI * AI() const
Definition: Creature.h:525
Definition: World.h:195
bool isWorldBoss() const
Definition: Creature.cpp:1833
Definition: Unit.h:1305
float m_CombatDistance
Definition: Creature.h:704
#define MAX_AGGRO_RESET_TIME
Definition: Unit.h:330

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Creature::CanFly ( ) const
inlineoverridevirtual

Implements Unit.

500 { return (GetCreatureTemplate()->InhabitType & INHABIT_AIR) != 0; }
Definition: Creature.h:333
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558

+ Here is the caller graph for this function:

bool Creature::CanGeneratePickPocketLoot ( ) const
inline
581 { return _pickpocketLootRestore <= time(NULL); }
arena_t NULL
Definition: jemalloc_internal.h:624
time_t _pickpocketLootRestore
Timers.
Definition: Creature.h:732
bool Creature::CanStartAttack ( Unit const u,
bool  force 
) const
Todo:
should switch to range attack
1526 {
1527  if (IsCivilian())
1528  return false;
1529 
1530  // This set of checks is should be done only for creatures
1531  if ((HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC) && who->GetTypeId() != TYPEID_PLAYER) // flag is valid only for non player characters
1532  || (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) && who->GetTypeId() == TYPEID_PLAYER) // immune to PC and target is a player, return false
1533  || (who->GetOwner() && who->GetOwner()->GetTypeId() == TYPEID_PLAYER && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC))) // player pets are immune to pc as well
1534  return false;
1535 
1536  // Do not attack non-combat pets
1537  if (who->GetTypeId() == TYPEID_UNIT && who->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET)
1538  return false;
1539 
1541  //|| who->IsControlledByPlayer() && who->IsFlying()))
1542  // we cannot check flying for other creatures, too much map/vmap calculation
1544  return false;
1545 
1546  if (!force)
1547  {
1548  if (!_IsTargetAcceptable(who))
1549  return false;
1550 
1551  if (who->IsInCombat() && IsWithinDist(who, ATTACK_DISTANCE))
1552  if (Unit* victim = who->getAttackerForHelper())
1554  force = true;
1555 
1556  if (!force && (IsNeutralToAll() || !IsWithinDistInMap(who, GetAttackDistance(who) + m_CombatDistance)))
1557  return false;
1558  }
1559 
1560  if (!CanCreatureAttack(who, force))
1561  return false;
1562 
1563  // No aggro from gray creatures
1564  if (CheckNoGrayAggroConfig(who->getLevelForTarget(this), getLevelForTarget(who)))
1565  return false;
1566 
1567  return IsWithinLOSInMap(who);
1568 }
#define ATTACK_DISTANCE
Definition: Object.h:35
bool IsWithinLOSInMap(WorldObject const *obj) const
Definition: Object.cpp:1584
#define CREATURE_Z_ATTACK_RANGE
Definition: Creature.h:459
Definition: SharedDefines.h:3565
Definition: ObjectGuid.h:32
#define sWorld
Definition: World.h:887
Definition: Unit.h:681
float GetDistanceZ(WorldObject const *obj) const
Definition: Object.cpp:1546
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition: Object.cpp:1663
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition: Object.cpp:1658
bool _IsTargetAcceptable(const Unit *target) const
Definition: Creature.cpp:2127
bool CheckNoGrayAggroConfig(uint32 playerLevel, uint32 creatureLevel) const
Definition: Creature.cpp:1571
float GetAttackDistance(Unit const *player) const
Definition: Creature.cpp:1586
bool IsNeutralToAll() const
Definition: Unit.cpp:7188
bool CanFly() const override
Definition: Creature.h:500
Definition: Unit.h:682
bool IsCivilian() const
Definition: Creature.h:495
Definition: ObjectGuid.h:33
Definition: UpdateFields.h:109
bool CanCreatureAttack(Unit const *victim, bool force=true) const
Definition: Creature.cpp:2170
Unit * getAttackerForHelper() const
Definition: Unit.cpp:7211
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.cpp:1239
Definition: Unit.h:1305
float m_CombatDistance
Definition: Creature.h:704
uint8 getLevelForTarget(WorldObject const *target) const override
Definition: Creature.cpp:2404

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Creature::CanSwim ( ) const
inline
499 { return (GetCreatureTemplate()->InhabitType & INHABIT_WATER) != 0 || IsPet(); }
Definition: Creature.h:332
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
bool IsPet() const
Definition: Unit.h:1403

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Creature::CanWalk ( ) const
inline
498 { return (GetCreatureTemplate()->InhabitType & INHABIT_GROUND) != 0; }
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
Definition: Creature.h:331

+ Here is the caller graph for this function:

bool Creature::CheckNoGrayAggroConfig ( uint32  playerLevel,
uint32  creatureLevel 
) const
private
1572 {
1573  if (Trinity::XP::GetColorCode(playerLevel, creatureLevel) != XP_GRAY)
1574  return false;
1575 
1576  uint32 notAbove = sWorld->getIntConfig(CONFIG_NO_GRAY_AGGRO_ABOVE);
1577  uint32 notBelow = sWorld->getIntConfig(CONFIG_NO_GRAY_AGGRO_BELOW);
1578  if (notAbove == 0 && notBelow == 0)
1579  return false;
1580 
1581  if (playerLevel <= notBelow || (playerLevel >= notAbove && notAbove > 0))
1582  return true;
1583  return false;
1584 }
Definition: SharedDefines.h:4682
Definition: World.h:375
#define sWorld
Definition: World.h:887
XPColorChar GetColorCode(uint8 pl_level, uint8 mob_level)
Definition: Formulas.h:67
Definition: World.h:376
uint32_t uint32
Definition: Define.h:150

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::ClearTextRepeatGroup ( uint8  textGroup)
2816 {
2817  CreatureTextRepeatGroup::iterator groupItr = m_textRepeat.find(textGroup);
2818  if (groupItr != m_textRepeat.end())
2819  groupItr->second.clear();
2820 }
CreatureTextRepeatGroup m_textRepeat
Definition: Creature.h:787

+ Here is the caller graph for this function:

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

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

Relocate again with updated Z coord

Todo:
Replace with spell, handle from DB
835 {
836  ASSERT(map);
837  SetMap(map);
838 
839  if (data && data->phaseid)
840  SetInPhase(data->phaseid, false, true);
841 
842  if (data && data->phaseGroup)
843  for (auto ph : sDB2Manager.GetPhasesForGroup(data->phaseGroup))
844  SetInPhase(ph, false, true);
845 
846  CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
847  if (!cinfo)
848  {
849  TC_LOG_ERROR("sql.sql", "Creature::Create(): creature template (guidlow: " UI64FMTD ", entry: %u) does not exist.", guidlow, entry);
850  return false;
851  }
852 
855  Relocate(x, y, z, ang);
856 
857  if (!CreateFromProto(guidlow, entry, data, vehId))
858  return false;
859 
860  if (!IsPositionValid())
861  {
862  TC_LOG_ERROR("entities.unit", "Creature::Create(): given coordinates for creature (guidlow " UI64FMTD ", entry %d) are not valid (X: %f, Y: %f, Z: %f, O: %f)", guidlow, entry, x, y, z, ang);
863  return false;
864  }
865 
866  switch (GetCreatureTemplate()->rank)
867  {
868  case CREATURE_ELITE_RARE:
870  break;
873  break;
876  break;
879  break;
880  default:
882  break;
883  }
884 
886 
889  {
891 
893  Relocate(x, y, z, ang);
894  }
895 
896  uint32 displayID = GetNativeDisplayId();
897  CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID);
898  if (minfo && !IsTotem()) // Cancel load if no model defined or if totem
899  {
900  SetDisplayId(displayID);
901  SetNativeDisplayId(displayID);
903  }
904 
906 
908  if (IsSpiritHealer() || IsSpiritGuide())
909  {
912  }
913 
916 
918  {
921  }
922 
923  return true;
924 }
uint32 m_corpseDelay
Definition: Creature.h:736
#define sDB2Manager
Definition: DB2Stores.h:224
Definition: Unit.h:234
Definition: World.h:296
bool HasUnitMovementFlag(uint32 f) const
Definition: Unit.h:2109
bool IsSpiritHealer() const
Definition: Unit.h:1573
Definition: UpdateFields.h:96
void AddUnitState(uint32 f)
Definition: Unit.h:1394
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition: Object.h:538
virtual void SetMap(Map *map)
Definition: Object.cpp:2169
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:383
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition: Unit.cpp:9615
void SetNativeDisplayId(uint32 modelId)
Definition: Unit.h:2016
#define sWorld
Definition: World.h:887
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: SharedDefines.h:3707
bool SetInPhase(uint32 id, bool update, bool apply) override
Definition: Unit.cpp:14578
Definition: UpdateFields.h:160
Definition: SharedDefines.h:1750
Definition: World.h:297
bool IsSpiritGuide() const
Definition: Unit.h:1574
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
Definition: Creature.h:317
void Relocate(float x, float y)
Definition: Position.h:67
Definition: Unit.h:804
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition: Object.cpp:1080
G3D::int16 z
Definition: Vector3int16.h:46
#define UI64FMTD
Definition: Define.h:137
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
Definition: Object.h:539
float GetFloatValue(uint16 index) const
Definition: Object.cpp:312
uint32_t uint32
Definition: Define.h:150
Definition: SharedDefines.h:3706
G3D::int16 y
Definition: Vector2int16.h:38
Definition: World.h:298
Definition: SharedDefines.h:1108
uint32 GetNativeDisplayId() const
Definition: Unit.h:2014
bool CreateFromProto(ObjectGuid::LowType guidlow, uint32 entry, CreatureData const *data=nullptr, uint32 vehId=0)
Definition: Creature.cpp:1283
void SetDisplayId(uint32 modelId) override
Definition: Creature.cpp:2664
Definition: SharedDefines.h:3708
bool IsTotem() const
Definition: Unit.h:1405
#define ASSERT
Definition: Errors.h:55
bool LoadCreaturesAddon()
Definition: Creature.cpp:2214
Definition: SharedDefines.h:1742
Definition: World.h:295
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
bool IsPositionValid() const
Definition: Position.cpp:40
Definition: SharedDefines.h:1860
G3D::int16 x
Definition: Vector2int16.h:37
Definition: SharedDefines.h:3705
Definition: Unit.h:577
Definition: SharedDefines.h:1154
Definition: World.h:299
uint32 ScriptID
Definition: Creature.h:143
Definition: Creature.h:79
uint32 LastUsedScriptID
Definition: Object.h:599
int8 gender
Definition: Creature.h:321

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Creature::CreateFromProto ( ObjectGuid::LowType  guidlow,
uint32  entry,
CreatureData const data = nullptr,
uint32  vehId = 0 
)
protected
1284 {
1285  SetZoneScript();
1286  if (GetZoneScript() && data)
1287  {
1288  entry = GetZoneScript()->GetCreatureEntry(guidlow, data);
1289  if (!entry)
1290  return false;
1291  }
1292 
1293  CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
1294  if (!cinfo)
1295  {
1296  TC_LOG_ERROR("sql.sql", "Creature::CreateFromProto(): creature template (guidlow: " UI64FMTD ", entry: %u) does not exist.", guidlow, entry);
1297  return false;
1298  }
1299 
1300  SetOriginalEntry(entry);
1301 
1302  if (vehId || cinfo->VehicleId)
1303  Object::_Create(ObjectGuid::Create<HighGuid::Vehicle>(GetMapId(), entry, guidlow));
1304  else
1305  Object::_Create(ObjectGuid::Create<HighGuid::Creature>(GetMapId(), entry, guidlow));
1306 
1307  if (!UpdateEntry(entry, data))
1308  return false;
1309 
1310  if (!vehId)
1311  {
1312  if (GetCreatureTemplate()->VehicleId)
1313  {
1314  vehId = GetCreatureTemplate()->VehicleId;
1315  entry = GetCreatureTemplate()->Entry;
1316  }
1317  else
1318  vehId = cinfo->VehicleId;
1319  }
1320 
1321  if (vehId)
1322  CreateVehicleKit(vehId, entry, true);
1323 
1324  return true;
1325 }
void _Create(ObjectGuid const &guid)
Definition: Object.cpp:125
#define sObjectMgr
Definition: ObjectMgr.h:1567
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
bool CreateVehicleKit(uint32 id, uint32 creatureEntry, bool loading=false)
Definition: Unit.cpp:14302
uint32 Entry
Definition: Creature.h:81
#define UI64FMTD
Definition: Define.h:137
virtual uint32 GetCreatureEntry(ObjectGuid::LowType, CreatureData const *data)
Definition: ZoneScript.h:32
void SetOriginalEntry(uint32 entry)
Definition: Creature.h:700
uint32 GetMapId() const
Definition: Position.h:254
uint32 VehicleId
Definition: Creature.h:124
ZoneScript * GetZoneScript() const
Definition: Object.h:551
void SetZoneScript()
Definition: Object.cpp:2330
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
bool UpdateEntry(uint32 entry, CreatureData const *data=nullptr)
Definition: Creature.cpp:407
Definition: Creature.h:79

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::DeleteFromDB ( )
virtual

Reimplemented in Pet.

1475 {
1476  if (!m_spawnId)
1477  {
1478  TC_LOG_ERROR("entities.unit", "Trying to delete not saved %s!", GetGUID().ToString().c_str());
1479  return;
1480  }
1481 
1483  sObjectMgr->DeleteCreatureData(m_spawnId);
1484 
1486 
1488  stmt->setUInt64(0, m_spawnId);
1489  trans->Append(stmt);
1490 
1492  stmt->setUInt64(0, m_spawnId);
1493  trans->Append(stmt);
1494 
1496  stmt->setUInt64(0, m_spawnId);
1497  trans->Append(stmt);
1498 
1500  stmt->setUInt64(0, m_spawnId);
1501  trans->Append(stmt);
1502 
1504 }
Definition: WorldDatabase.h:74
Definition: WorldDatabase.h:93
Map * GetMap() const
Definition: Object.h:543
Definition: WorldDatabase.h:84
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: PreparedStatement.h:74
Definition: WorldDatabase.h:94
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
std::string ToString() const
Definition: Position.cpp:160
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
ObjectGuid const & GetGUID() const
Definition: Object.h:105
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
ObjectGuid::LowType m_spawnId
For new or temporary creatures is 0 for saved it is lowguid.
Definition: Creature.h:747
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
void RemoveCreatureRespawnTime(ObjectGuid::LowType dbGuid)
Definition: Map.cpp:3589
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::DespawnOrUnsummon ( uint32  msTimeToDespawn = 0)
1775 {
1776  if (TempSummon* summon = this->ToTempSummon())
1777  summon->UnSummon(msTimeToDespawn);
1778  else
1779  ForcedDespawn(msTimeToDespawn);
1780 }
Definition: TemporarySummon.h:40
void ForcedDespawn(uint32 timeMSToDespawn=0)
Definition: Creature.cpp:1758
TempSummon * ToTempSummon()
Definition: Unit.h:2206

+ Here is the call graph for this function:

void Creature::DisappearAndDie ( )
257 {
259  //SetVisibility(VISIBILITY_OFF);
260  //ObjectAccessor::UpdateObjectVisibility(this);
261  if (IsAlive())
263  RemoveCorpse(false);
264 }
Definition: Unit.h:542
void setDeathState(DeathState s) override
Definition: Creature.cpp:1624
bool IsAlive() const
Definition: Unit.h:1692
void RemoveCorpse(bool setSpawnTime=true)
Definition: Creature.cpp:280
void DestroyForNearbyPlayers()
Definition: Object.cpp:2974

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::DoFleeToGetAssistance ( )
Todo:
use 31365
762 {
763  if (!GetVictim())
764  return;
765 
767  return;
768 
769  float radius = sWorld->getFloatConfig(CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS);
770  if (radius >0)
771  {
772  Creature* creature = NULL;
773 
775  Cell cell(p);
776  cell.SetNoCreate();
779 
781 
782  cell.Visit(p, grid_creature_searcher, *GetMap(), *this, radius);
783 
784  SetNoSearchAssistance(true);
785  UpdateSpeed(MOVE_RUN, false);
786 
787  if (!creature)
788  //SetFeared(true, EnsureVictim()->GetGUID(), 0, sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY));
791  else
792  GetMotionMaster()->MoveSeekAssistance(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ());
793  }
794 }
Definition: TypeContainerVisitor.h:32
Map * GetMap() const
Definition: Object.h:543
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition: Unit.cpp:10378
MotionMaster * GetMotionMaster()
Definition: Unit.h:2101
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:193
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Creature.h:467
Definition: Unit.h:557
#define sWorld
Definition: World.h:887
Definition: TypeContainer.h:86
Definition: GridNotifiers.h:444
void SetControlled(bool apply, UnitState state)
Definition: Unit.cpp:13808
void MoveSeekAssistance(float x, float y, float z)
Definition: MotionMaster.cpp:496
Unit * GetVictim() const
Definition: Unit.h:1379
float GetPositionY() const
Definition: Position.h:105
float GetPositionZ() const
Definition: Position.h:106
Definition: Cell.h:49
Definition: Unit.h:600
void SetNoSearchAssistance(bool val)
Definition: Creature.h:619
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
float GetPositionX() const
Definition: Position.h:104
Definition: SpellAuraDefines.h:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::DoImmediateBoundaryCheck ( )
inline
643 { m_boundaryCheckTime = 0; }
uint32 m_boundaryCheckTime
Definition: Creature.h:738

+ Here is the caller graph for this function:

bool Creature::FocusTarget ( Spell const focusSpell,
WorldObject const target 
)
2682 {
2683  // already focused
2684  if (_focusSpell)
2685  return false;
2686 
2687  if ((!target || target == this) && !focusSpell->GetCastTime()) // instant cast, untargeted (or self-targeted) spell doesn't need any facing updates
2688  return false;
2689 
2690  _focusSpell = focusSpell;
2691 
2692  // "instant" creature casts that require re-targeting will be delayed by a short moment to prevent facing bugs
2693  bool shouldDelay = false;
2694 
2695  // set target, then force send update packet to players if it changed to provide appropriate facing
2696  ObjectGuid newTarget = target ? target->GetGUID() : ObjectGuid::Empty;
2697  if (GetGuidValue(UNIT_FIELD_TARGET) != newTarget)
2698  {
2699  SetGuidValue(UNIT_FIELD_TARGET, newTarget);
2700  if (target)
2701  SetFacingToObject(target);
2702 
2703  if ( // here we determine if the (relatively expensive) forced update is worth it, or whether we can afford to wait until the scheduled update tick
2704  ( // only require instant update for spells that actually have a visual
2705  focusSpell->GetSpellInfo()->SpellVisual[0] ||
2706  focusSpell->GetSpellInfo()->SpellVisual[1]
2707  ) && (
2708  !focusSpell->GetCastTime() || // if the spell is instant cast
2709  focusSpell->GetSpellInfo()->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST) // client gets confused if we attempt to turn at the regularly scheduled update packet
2710  )
2711  )
2712  {
2713  std::list<Player*> playersNearby;
2714  GetPlayerListInGrid(playersNearby, GetVisibilityRange());
2715  for (Player* player : playersNearby)
2716  {
2717  // only update players that are known to the client (have already been created)
2718  if (player->HaveAtClient(this))
2719  {
2720  SendUpdateToPlayer(player);
2721  shouldDelay = true;
2722  }
2723  }
2724  if (shouldDelay)
2725  shouldDelay = !(focusSpell->IsTriggered() || focusSpell->GetCastTime() || focusSpell->GetSpellInfo()->IsChanneled());
2726 
2727  }
2728  }
2729 
2730  // tell the creature that it should reacquire its current target after the cast is done (this is handled in ::Attack)
2732 
2733  bool canTurnDuringCast = !focusSpell->GetSpellInfo()->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST);
2734  // Face the target - we need to do this before the unit state is modified for no-turn spells
2735  if (target)
2736  SetInFront(target);
2737  else if (!canTurnDuringCast)
2738  if(Unit* victim = GetVictim())
2739  SetInFront(victim); // ensure server-side orientation is correct at beginning of cast
2740 
2741  if (!canTurnDuringCast)
2743 
2744  return shouldDelay;
2745 }
Definition: UpdateFields.h:89
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
void AddUnitState(uint32 f)
Definition: Unit.h:1394
float GetVisibilityRange() const
Definition: Object.cpp:1912
void SetGuidValue(uint16 index, ObjectGuid const &value)
Definition: Object.cpp:1120
Definition: Unit.h:591
void SetFacingToObject(WorldObject const *object)
Definition: Unit.cpp:15787
Unit * GetVictim() const
Definition: Unit.h:1379
ObjectGuid const & GetGuidValue(uint16 index) const
Definition: Object.cpp:332
Spell const * _focusSpell
Definition: Creature.h:784
void MustReacquireTarget()
Definition: Unit.h:1373
void GetPlayerListInGrid(std::list< Player * > &lList, float fMaxSearchRange) const
Definition: Object.cpp:2496
Definition: ObjectGuid.h:189
void SetInFront(WorldObject const *target)
Definition: Unit.cpp:15771
Definition: SharedDefines.h:555
Definition: Unit.h:1305
void SendUpdateToPlayer(Player *player)
Definition: Object.cpp:251

+ Here is the call graph for this function:

void Creature::ForcedDespawn ( uint32  timeMSToDespawn = 0)
private
1759 {
1760  if (timeMSToDespawn)
1761  {
1762  ForcedDespawnDelayEvent* pEvent = new ForcedDespawnDelayEvent(*this);
1763 
1764  m_Events.AddEvent(pEvent, m_Events.CalculateTime(timeMSToDespawn));
1765  return;
1766  }
1767 
1768  if (IsAlive())
1770 
1771  RemoveCorpse(false);
1772 }
EventProcessor m_Events
Definition: Unit.h:1948
Definition: Unit.h:542
void AddEvent(BasicEvent *Event, uint64 e_time, bool set_addtime=true)
Definition: EventProcessor.cpp:88
Definition: Creature.h:805
void setDeathState(DeathState s) override
Definition: Creature.cpp:1624
bool IsAlive() const
Definition: Unit.h:1692
uint64 CalculateTime(uint64 t_offset) const
Definition: EventProcessor.cpp:95
void RemoveCorpse(bool setSpawnTime=true)
Definition: Creature.cpp:280

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

float Creature::GetAggroRange ( Unit const target) const
2558 {
2559  // Determines the aggro range for creatures (usually pets), used mainly for aggressive pet target selection.
2560  // Based on data from wowwiki due to lack of 3.3.5a data
2561 
2562  if (target && this->IsPet())
2563  {
2564  uint32 targetLevel = 0;
2565 
2566  if (target->GetTypeId() == TYPEID_PLAYER)
2567  targetLevel = target->getLevelForTarget(this);
2568  else if (target->GetTypeId() == TYPEID_UNIT)
2569  targetLevel = target->ToCreature()->getLevelForTarget(this);
2570 
2571  uint32 myLevel = getLevelForTarget(target);
2572  int32 levelDiff = int32(targetLevel) - int32(myLevel);
2573 
2574  // The maximum Aggro Radius is capped at 45 yards (25 level difference)
2575  if (levelDiff < -25)
2576  levelDiff = -25;
2577 
2578  // The base aggro radius for mob of same level
2579  float aggroRadius = 20;
2580 
2581  // Aggro Radius varies with level difference at a rate of roughly 1 yard/level
2582  aggroRadius -= (float)levelDiff;
2583 
2584  // detect range auras
2586 
2587  // detected range auras
2588  aggroRadius += target->GetTotalAuraModifier(SPELL_AURA_MOD_DETECTED_RANGE);
2589 
2590  // Just in case, we don't want pets running all over the map
2591  if (aggroRadius > MAX_AGGRO_RADIUS)
2592  aggroRadius = MAX_AGGRO_RADIUS;
2593 
2594  // Minimum Aggro Radius for a mob seems to be combat range (5 yards)
2595  // hunter pets seem to ignore minimum aggro radius so we'll default it a little higher
2596  if (aggroRadius < 10)
2597  aggroRadius = 10;
2598 
2599  return (aggroRadius);
2600  }
2601 
2602  // Default
2603  return 0.0f;
2604 }
int32 GetTotalAuraModifier(AuraType auratype) const
Definition: Unit.cpp:4396
Definition: ObjectGuid.h:32
Definition: SpellAuraDefines.h:151
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
Definition: SpellAuraDefines.h:212
bool IsPet() const
Definition: Unit.h:1403
Definition: ObjectGuid.h:33
int32_t int32
Definition: g3dmath.h:167
#define MAX_AGGRO_RADIUS
Definition: Unit.h:331
uint8 getLevelForTarget(WorldObject const *target) const override
Definition: Creature.cpp:2404

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string Creature::GetAIName ( ) const
2418 {
2419  return sObjectMgr->GetCreatureTemplate(GetEntry())->AIName;
2420 }
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32 GetEntry() const
Definition: Object.h:107

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

float Creature::GetAttackDistance ( Unit const player) const
1587 {
1588  float aggroRate = sWorld->getRate(RATE_CREATURE_AGGRO);
1589  if (aggroRate == 0)
1590  return 0.0f;
1591 
1592  uint32 playerlevel = player->getLevelForTarget(this);
1593  uint32 creaturelevel = getLevelForTarget(player);
1594 
1595  int32 leveldif = int32(playerlevel) - int32(creaturelevel);
1596 
1597  // "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."
1598  if (leveldif < - 25)
1599  leveldif = -25;
1600 
1601  // "The aggro radius of a mob having the same level as the player is roughly 20 yards"
1602  float RetDistance = 20;
1603 
1604  // "Aggro Radius varies with level difference at a rate of roughly 1 yard/level"
1605  // radius grow if playlevel < creaturelevel
1606  RetDistance -= (float)leveldif;
1607 
1608  if (creaturelevel+5 <= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
1609  {
1610  // detect range auras
1612 
1613  // detected range auras
1614  RetDistance += player->GetTotalAuraModifier(SPELL_AURA_MOD_DETECTED_RANGE);
1615  }
1616 
1617  // "Minimum Aggro Radius for a mob seems to be combat range (5 yards)"
1618  if (RetDistance < 5)
1619  RetDistance = 5;
1620 
1621  return (RetDistance*aggroRate);
1622 }
Definition: World.h:427
int32 GetTotalAuraModifier(AuraType auratype) const
Definition: Unit.cpp:4396
#define sWorld
Definition: World.h:887
Definition: SpellAuraDefines.h:151
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
Definition: SpellAuraDefines.h:212
int32_t int32
Definition: g3dmath.h:167
Definition: World.h:235
uint8 getLevelForTarget(WorldObject const *target) const override
Definition: Creature.cpp:2404

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 Creature::GetCombatPulseDelay ( ) const
inline
644 { return m_combatPulseDelay; }
uint32 m_combatPulseDelay
Definition: Creature.h:740
uint32 Creature::GetCorpseDelay ( ) const
inline
493 { return m_corpseDelay; }
uint32 m_corpseDelay
Definition: Creature.h:736

+ Here is the caller graph for this function:

CreatureAddon const * Creature::GetCreatureAddon ( ) const
2202 {
2203  if (m_spawnId)
2204  {
2205  if (CreatureAddon const* addon = sObjectMgr->GetCreatureAddon(m_spawnId))
2206  return addon;
2207  }
2208 
2209  // dependent from difficulty mode entry
2210  return sObjectMgr->GetCreatureTemplateAddon(GetCreatureTemplate()->Entry);
2211 }
#define sObjectMgr
Definition: ObjectMgr.h:1567
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
Entry
Definition: boss_headless_horseman.cpp:50
Definition: Creature.h:353
ObjectGuid::LowType m_spawnId
For new or temporary creatures is 0 for saved it is lowguid.
Definition: Creature.h:747

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CreatureData const* Creature::GetCreatureData ( ) const
inline
559 { return m_creatureData; }
CreatureData const * m_creatureData
Definition: Creature.h:765

+ Here is the caller graph for this function:

CreatureTemplate const* Creature::GetCreatureTemplate ( ) const
inline
558 { return m_creatureInfo; }
CreatureTemplate const * m_creatureInfo
Definition: Creature.h:764
uint8 Creature::GetCurrentEquipmentId ( ) const
inline
547 { return m_equipmentId; }
uint8 m_equipmentId
Definition: Creature.h:748

+ Here is the caller graph for this function:

uint32 Creature::GetCurrentWaypointID ( ) const
inline
683 { return m_waypointID; }
uint32 m_waypointID
Definition: Creature.h:777

+ Here is the caller graph for this function:

MovementGeneratorType Creature::GetDefaultMovementType ( ) const
inline
624 { return m_defaultMovementType; }
MovementGeneratorType m_defaultMovementType
Definition: Creature.h:746

+ Here is the caller graph for this function:

CreatureGroup* Creature::GetFormation ( )
inline
687 { return m_formation; }
CreatureGroup * m_formation
Definition: Creature.h:781

+ Here is the caller graph for this function:

void Creature::GetHomePosition ( float &  x,
float &  y,
float &  z,
float &  ori 
) const
inline
672 { m_homePosition.GetPosition(x, y, z, ori); }
Position m_homePosition
Definition: Creature.h:759
G3D::int16 z
Definition: Vector3int16.h:46
void GetPosition(float &x, float &y) const
Definition: Position.h:109
G3D::int16 y
Definition: Vector2int16.h:38
G3D::int16 x
Definition: Vector2int16.h:37

+ Here is the caller graph for this function:

Position const& Creature::GetHomePosition ( ) const
inline
673 { return m_homePosition; }
Position m_homePosition
Definition: Creature.h:759
uint8 Creature::getLevelForTarget ( WorldObject const target) const
overridevirtual

Reimplemented from WorldObject.

2405 {
2406  if (!isWorldBoss() || !target->ToUnit())
2407  return Unit::getLevelForTarget(target);
2408 
2409  uint16 level = target->ToUnit()->getLevel() + sWorld->getIntConfig(CONFIG_WORLD_BOSS_LEVEL_DIFF);
2410  if (level < 1)
2411  return 1;
2412  if (level > 255)
2413  return 255;
2414  return uint8(level);
2415 }
uint8 getLevelForTarget(WorldObject const *) const override
Definition: Unit.h:1409
#define sWorld
Definition: World.h:887
Definition: World.h:284
uint16_t uint16
Definition: Define.h:151
uint8_t uint8
Definition: g3dmath.h:164
bool isWorldBoss() const
Definition: Creature.cpp:1833

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint16 Creature::GetLootMode ( ) const
inline
592 { return m_LootMode; }
uint16 m_LootMode
Definition: Creature.h:767

+ Here is the caller graph for this function:

Player * Creature::GetLootRecipient ( ) const
978 {
979  if (!m_lootRecipient)
980  return NULL;
981 
983 }
ObjectGuid m_lootRecipient
Definition: Creature.h:727
arena_t NULL
Definition: jemalloc_internal.h:624
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Group * Creature::GetLootRecipientGroup ( ) const
986 {
988  return NULL;
989 
990  return sGroupMgr->GetGroupByGUID(m_lootRecipientGroup);
991 }
arena_t NULL
Definition: jemalloc_internal.h:624
#define sGroupMgr
Definition: GroupMgr.h:59
ObjectGuid m_lootRecipientGroup
Definition: Creature.h:728
bool IsEmpty() const
Definition: ObjectGuid.h:242

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SpellSchoolMask Creature::GetMeleeDamageSchoolMask ( ) const
inlineoverridevirtual

Reimplemented from Unit.

527 { return m_meleeDamageSchoolMask; }
SpellSchoolMask m_meleeDamageSchoolMask
Definition: Creature.h:756

+ Here is the caller graph for this function:

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

Reimplemented from WorldObject.

2514 {
2515  if (loc_idx != DEFAULT_LOCALE)
2516  {
2517  uint8 uloc_idx = uint8(loc_idx);
2518  CreatureLocale const* cl = sObjectMgr->GetCreatureLocale(GetEntry());
2519  if (cl)
2520  {
2521  if (cl->Name.size() > uloc_idx && !cl->Name[uloc_idx].empty())
2522  return cl->Name[uloc_idx];
2523  }
2524  }
2525 
2526  return GetName();
2527 }
Definition: Creature.h:258
std::string const & GetName() const
Definition: Object.h:479
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint8_t uint8
Definition: g3dmath.h:164
StringVector Name
Definition: Creature.h:260
uint8_t uint8
Definition: Define.h:152
uint32 GetEntry() const
Definition: Object.h:107
#define DEFAULT_LOCALE
Definition: Common.h:134

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 Creature::GetOriginalEntry ( ) const
inline
699 { return m_originalEntry; }
uint32 m_originalEntry
Definition: Creature.h:757

+ Here is the caller graph for this function:

int8 Creature::GetOriginalEquipmentId ( ) const
inline
546 { return m_originalEquipmentId; }
int8 m_originalEquipmentId
Definition: Creature.h:749

+ Here is the caller graph for this function:

uint32 Creature::GetPetAutoSpellOnPos ( uint8  pos) const
virtual

Reimplemented in Pet.

2530 {
2531  if (pos >= MAX_SPELL_CHARM || m_charmInfo->GetCharmSpell(pos)->GetType() != ACT_ENABLED)
2532  return 0;
2533  else
2534  return m_charmInfo->GetCharmSpell(pos)->GetAction();
2535 }
uint32 GetAction() const
Definition: Unit.h:1156
#define MAX_SPELL_CHARM
Definition: Unit.h:325
ActiveStates GetType() const
Definition: Unit.h:1155
CharmSpellInfo * GetCharmSpell(uint8 index)
Definition: Unit.h:1233
CharmInfo * m_charmInfo
Definition: Unit.h:2292
Definition: Unit.h:1121

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual uint8 Creature::GetPetAutoSpellSize ( ) const
inlinevirtual

Reimplemented in Pet.

664 { return MAX_SPELL_CHARM; }
#define MAX_SPELL_CHARM
Definition: Unit.h:325

+ Here is the caller graph for this function:

ReactStates Creature::GetReactState ( ) const
inline
503 { return m_reactState; }
ReactStates m_reactState
Definition: Creature.h:742

+ Here is the caller graph for this function:

uint32 Creature::GetRespawnDelay ( ) const
inline
637 { return m_respawnDelay; }
uint32 m_respawnDelay
Definition: Creature.h:735

+ Here is the caller graph for this function:

void Creature::GetRespawnPosition ( float &  x,
float &  y,
float &  z,
float *  ori = nullptr,
float *  dist = nullptr 
) const
2356 {
2357  if (m_spawnId)
2358  {
2359  if (CreatureData const* data = sObjectMgr->GetCreatureData(GetSpawnId()))
2360  {
2361  x = data->posX;
2362  y = data->posY;
2363  z = data->posZ;
2364  if (ori)
2365  *ori = data->orientation;
2366  if (dist)
2367  *dist = data->spawndist;
2368 
2369  return;
2370  }
2371  }
2372 
2373  x = GetPositionX();
2374  y = GetPositionY();
2375  z = GetPositionZ();
2376  if (ori)
2377  *ori = GetOrientation();
2378  if (dist)
2379  *dist = 0;
2380 }
Definition: Creature.h:287
ObjectGuid::LowType GetSpawnId() const
Definition: Creature.h:487
#define sObjectMgr
Definition: ObjectMgr.h:1567
float GetOrientation() const
Definition: Position.h:107
float GetPositionY() const
Definition: Position.h:105
G3D::int16 z
Definition: Vector3int16.h:46
float GetPositionZ() const
Definition: Position.h:106
G3D::int16 y
Definition: Vector2int16.h:38
ObjectGuid::LowType m_spawnId
For new or temporary creatures is 0 for saved it is lowguid.
Definition: Creature.h:747
G3D::int16 x
Definition: Vector2int16.h:37
float GetPositionX() const
Definition: Position.h:104

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

float Creature::GetRespawnRadius ( ) const
inline
640 { return m_respawnradius; }
float m_respawnradius
Definition: Creature.h:737

+ Here is the caller graph for this function:

time_t const& Creature::GetRespawnTime ( ) const
inline
631 { return m_respawnTime; }
time_t m_respawnTime
Definition: Creature.h:734

+ Here is the caller graph for this function:

time_t Creature::GetRespawnTimeEx ( ) const
2347 {
2348  time_t now = time(NULL);
2349  if (m_respawnTime > now)
2350  return m_respawnTime;
2351  else
2352  return now;
2353 }
time_t m_respawnTime
Definition: Creature.h:734
arena_t NULL
Definition: jemalloc_internal.h:624

+ Here is the caller graph for this function:

uint32 Creature::GetScriptId ( ) const
2428 {
2429  return sObjectMgr->GetCreatureTemplate(GetEntry())->ScriptID;
2430 }
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32 GetEntry() const
Definition: Object.h:107

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string Creature::GetScriptName ( ) const
2423 {
2424  return sObjectMgr->GetScriptName(GetScriptId());
2425 }
uint32 GetScriptId() const
Definition: Creature.cpp:2427
#define sObjectMgr
Definition: ObjectMgr.h:1567

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ObjectGuid Creature::GetSkinner ( ) const
inline
583 { return _skinner; } // Returns the player who skinned this creature
ObjectGuid _skinner
Definition: Creature.h:729
ObjectGuid::LowType Creature::GetSpawnId ( ) const
inline
487 { return m_spawnId; }
ObjectGuid::LowType m_spawnId
For new or temporary creatures is 0 for saved it is lowguid.
Definition: Creature.h:747

+ Here is the caller graph for this function:

float Creature::GetSpellDamageMod ( int32  Rank) const
1265 {
1266  switch (Rank) // define rates for each elite rank
1267  {
1268  case CREATURE_ELITE_NORMAL:
1269  return sWorld->getRate(RATE_CREATURE_NORMAL_SPELLDAMAGE);
1270  case CREATURE_ELITE_ELITE:
1276  case CREATURE_ELITE_RARE:
1278  default:
1280  }
1281 }
#define sWorld
Definition: World.h:887
Definition: SharedDefines.h:3707
Definition: SharedDefines.h:3704
Definition: SharedDefines.h:3706
Definition: SharedDefines.h:3708
Definition: SharedDefines.h:3705
Definition: World.h:422

+ Here is the caller graph for this function:

CreatureTextRepeatIds Creature::GetTextRepeatGroup ( uint8  textGroup)
2805 {
2807 
2808  CreatureTextRepeatGroup::const_iterator groupItr = m_textRepeat.find(textGroup);
2809  if (groupItr != m_textRepeat.end())
2810  ids = groupItr->second;
2811 
2812  return ids;
2813 }
std::vector< uint8 > CreatureTextRepeatIds
Definition: Creature.h:464
CreatureTextRepeatGroup m_textRepeat
Definition: Creature.h:787

+ Here is the caller graph for this function:

TrainerSpellData const * Creature::GetTrainerSpells ( ) const
2508 {
2509  return sObjectMgr->GetNpcTrainerSpells(GetEntry());
2510 }
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32 GetEntry() const
Definition: Object.h:107

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::GetTransportHomePosition ( float &  x,
float &  y,
float &  z,
float &  ori 
) const
inline
Position m_transportHomePosition
Definition: Creature.h:760
G3D::int16 z
Definition: Vector3int16.h:46
void GetPosition(float &x, float &y) const
Definition: Position.h:109
G3D::int16 y
Definition: Vector2int16.h:38
G3D::int16 x
Definition: Vector2int16.h:37

+ Here is the caller graph for this function:

Position const& Creature::GetTransportHomePosition ( ) const
inline
678 { return m_transportHomePosition; }
Position m_transportHomePosition
Definition: Creature.h:760
uint32 Creature::GetVendorItemCurrentCount ( VendorItem const vItem)
2438 {
2439  if (!vItem->maxcount)
2440  return vItem->maxcount;
2441 
2442  VendorItemCounts::iterator itr = m_vendorItemCounts.begin();
2443  for (; itr != m_vendorItemCounts.end(); ++itr)
2444  if (itr->itemId == vItem->item)
2445  break;
2446 
2447  if (itr == m_vendorItemCounts.end())
2448  return vItem->maxcount;
2449 
2450  VendorItemCount* vCount = &*itr;
2451 
2452  time_t ptime = time(NULL);
2453 
2454  if (time_t(vCount->lastIncrementTime + vItem->incrtime) <= ptime)
2455  if (ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(vItem->item))
2456  {
2457  uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime);
2458  if ((vCount->count + diff * pProto->GetBuyCount()) >= vItem->maxcount)
2459  {
2460  m_vendorItemCounts.erase(itr);
2461  return vItem->maxcount;
2462  }
2463 
2464  vCount->count += diff * pProto->GetBuyCount();
2465  vCount->lastIncrementTime = ptime;
2466  }
2467 
2468  return vCount->count;
2469 }
arena_t NULL
Definition: jemalloc_internal.h:624
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32_t uint32
Definition: Define.h:150
Definition: Creature.h:410
VendorItemCounts m_vendorItemCounts
Definition: Creature.h:723
Definition: ItemTemplate.h:647
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the caller graph for this function:

VendorItemData const * Creature::GetVendorItems ( ) const
2433 {
2434  return sObjectMgr->GetNpcVendorItemList(GetEntry());
2435 }
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32 GetEntry() const
Definition: Object.h:107

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 Creature::GetWaypointPath ( ) const
inline
680 { return m_path_id; }
uint32 m_path_id
Definition: Creature.h:778

+ Here is the caller graph for this function:

bool Creature::hasInvolvedQuest ( uint32  quest_id) const
overridevirtual

Reimplemented from Object.

1464 {
1465  QuestRelationBounds qir = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(GetEntry());
1466  for (QuestRelations::const_iterator itr = qir.first; itr != qir.second; ++itr)
1467  {
1468  if (itr->second == quest_id)
1469  return true;
1470  }
1471  return false;
1472 }
std::pair< QuestRelations::const_iterator, QuestRelations::const_iterator > QuestRelationBounds
Definition: ObjectMgr.h:442
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32 GetEntry() const
Definition: Object.h:107

+ Here is the call graph for this function:

bool Creature::HasLootMode ( uint16  lootMode)
inline
593 { return (m_LootMode & lootMode) != 0; }
uint16 m_LootMode
Definition: Creature.h:767

+ Here is the caller graph for this function:

bool Creature::hasLootRecipient ( ) const
inline
ObjectGuid m_lootRecipient
Definition: Creature.h:727
ObjectGuid m_lootRecipientGroup
Definition: Creature.h:728
bool IsEmpty() const
Definition: ObjectGuid.h:242

+ Here is the caller graph for this function:

bool Creature::hasQuest ( uint32  quest_id) const
overridevirtual

Reimplemented from Object.

1453 {
1454  QuestRelationBounds qr = sObjectMgr->GetCreatureQuestRelationBounds(GetEntry());
1455  for (QuestRelations::const_iterator itr = qr.first; itr != qr.second; ++itr)
1456  {
1457  if (itr->second == quest_id)
1458  return true;
1459  }
1460  return false;
1461 }
std::pair< QuestRelations::const_iterator, QuestRelations::const_iterator > QuestRelationBounds
Definition: ObjectMgr.h:442
#define qr(a_type)
Definition: qr.h:2
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32 GetEntry() const
Definition: Object.h:107

+ Here is the call graph for this function:

bool Creature::HasReactState ( ReactStates  state) const
inline
504 { return (m_reactState == state); }
ReactStates m_reactState
Definition: Creature.h:742

+ Here is the caller graph for this function:

bool Creature::HasSearchedAssistance ( ) const
inline
620 { return m_AlreadySearchedAssistance; }
bool m_AlreadySearchedAssistance
Definition: Creature.h:752

+ Here is the caller graph for this function:

bool Creature::HasSpell ( uint32  spellID) const
overridevirtual

Reimplemented from Unit.

Reimplemented in Pet.

2338 {
2339  uint8 i;
2340  for (i = 0; i < CREATURE_MAX_SPELLS; ++i)
2341  if (spellID == m_spells[i])
2342  break;
2343  return i < CREATURE_MAX_SPELLS; //broke before end of iteration of known spells
2344 }
#define CREATURE_MAX_SPELLS
Definition: Creature.h:75
uint32 m_spells[CREATURE_MAX_SPELLS]
Definition: Creature.h:602
uint8_t uint8
Definition: Define.h:152

+ Here is the caller graph for this function:

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

change the entry of creature until respawn

308 {
309  CreatureTemplate const* normalInfo = sObjectMgr->GetCreatureTemplate(entry);
310  if (!normalInfo)
311  {
312  TC_LOG_ERROR("sql.sql", "Creature::InitEntry creature entry %u does not exist.", entry);
313  return false;
314  }
315 
316  // get difficulty 1 mode entry
317  CreatureTemplate const* cinfo = nullptr;
318  DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(GetMap()->GetSpawnMode());
319  while (!cinfo && difficultyEntry)
320  {
322  if (idx == -1)
323  break;
324 
325  if (normalInfo->DifficultyEntry[idx])
326  {
327  cinfo = sObjectMgr->GetCreatureTemplate(normalInfo->DifficultyEntry[idx]);
328  break;
329  }
330 
331  if (!difficultyEntry->FallbackDifficultyID)
332  break;
333 
334  difficultyEntry = sDifficultyStore.LookupEntry(difficultyEntry->FallbackDifficultyID);
335  }
336 
337  if (!cinfo)
338  cinfo = normalInfo;
339 
340  // Initialize loot duplicate count depending on raid difficulty
341  if (GetMap()->Is25ManRaid())
342  loot.maxDuplicates = 3;
343 
344  SetEntry(entry); // normal entry always
345  m_creatureInfo = cinfo; // map mode related always
346 
347  // equal to player Race field, but creature does not have race
349 
350  // known valid are: CLASS_WARRIOR, CLASS_PALADIN, CLASS_ROGUE, CLASS_MAGE
352 
353  // Cancel load if no model defined
354  if (!(cinfo->GetFirstValidModelId()))
355  {
356  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", entry);
357  return false;
358  }
359 
361  CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID);
362  if (!minfo) // Cancel load if no model defined
363  {
364  TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid model %u defined in table `creature_template`, can't load.", entry, displayID);
365  return false;
366  }
367 
368  SetDisplayId(displayID);
369  SetNativeDisplayId(displayID);
371 
372  // Load creature equipment
373  if (data && data->equipmentId != 0)
374  {
375  m_originalEquipmentId = data->equipmentId;
376  LoadEquipment(data->equipmentId);
377  }
378  else
379  LoadEquipment(0, true);
380 
381  SetName(normalInfo->Name); // at normal entry always
382 
385 
386  SetSpeed(MOVE_WALK, cinfo->speed_walk);
387  SetSpeed(MOVE_RUN, cinfo->speed_run);
388  SetSpeed(MOVE_SWIM, 1.0f); // using 1.0 rate
389  SetSpeed(MOVE_FLIGHT, 1.0f); // using 1.0 rate
390 
391  // Will set UNIT_FIELD_BOUNDINGRADIUS and UNIT_FIELD_COMBATREACH
392  SetObjectScale(cinfo->scale);
393 
395 
396  // checked at loading
400 
401  for (uint8 i=0; i < CREATURE_MAX_SPELLS; ++i)
403 
404  return true;
405 }
CreatureTemplate const * m_creatureInfo
Definition: Creature.h:764
Definition: MotionMaster.h:37
Definition: Unit.h:234
Definition: Unit.h:605
uint32 spells[CREATURE_MAX_SPELLS]
Definition: Creature.h:123
std::string Name
Definition: Creature.h:88
#define CREATURE_MAX_SPELLS
Definition: Creature.h:75
float scale
Definition: Creature.h:101
uint32 FallbackDifficultyID
Definition: DBCStructure.h:341
Map * GetMap() const
Definition: Object.h:543
uint32 ID
Definition: DBCStructure.h:340
uint32 GetFirstValidModelId() const
Definition: Creature.cpp:99
Definition: UpdateFields.h:96
float HoverHeight
Definition: Creature.h:130
float speed_run
Definition: Creature.h:100
float speed_walk
Definition: Creature.h:99
Loot loot
Definition: Creature.h:578
Definition: UpdateFields.h:129
Definition: MotionMaster.h:38
static uint32 ChooseDisplayId(CreatureTemplate const *cinfo, CreatureData const *data=NULL)
Definition: ObjectMgr.cpp:1265
void SetNativeDisplayId(uint32 modelId)
Definition: Unit.h:2016
Definition: Unit.h:599
MovementGeneratorType m_defaultMovementType
Definition: Creature.h:746
void SetEntry(uint32 entry)
Definition: Object.h:108
void SetName(std::string const &newname)
Definition: Object.h:480
void SetObjectScale(float scale) override
Definition: Creature.cpp:2653
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: Unit.h:233
Definition: UpdateFields.h:160
float m_respawnradius
Definition: Creature.h:737
Definition: Unit.h:602
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
Definition: Creature.h:317
uint32 m_spells[CREATURE_MAX_SPELLS]
Definition: Creature.h:602
void LoadEquipment(int8 id=1, bool force=false)
Definition: Creature.cpp:1429
uint32 MovementType
Definition: Creature.h:128
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition: Object.cpp:1080
Definition: UpdateFields.h:130
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
static int32 DifficultyIDToDifficultyEntryIndex(uint32 difficulty)
Definition: Creature.h:176
uint8_t uint8
Definition: g3dmath.h:164
uint8 maxDuplicates
Definition: LootMgr.h:326
Definition: Unit.h:600
Definition: Unit.h:232
void SetDisplayId(uint32 modelId) override
Definition: Creature.cpp:2664
void SetFloatValue(uint16 index, float value)
Definition: Object.cpp:1067
MovementGeneratorType
Definition: MotionMaster.h:35
uint8_t uint8
Definition: Define.h:152
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition: Unit.cpp:10531
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
DBCStorage< DifficultyEntry > sDifficultyStore(DifficultyFmt)
uint32 unit_class
Definition: Creature.h:108
Definition: Creature.h:79
uint32 DifficultyEntry[MAX_CREATURE_DIFFICULTIES]
Definition: Creature.h:82
int8 m_originalEquipmentId
Definition: Creature.h:749
int8 gender
Definition: Creature.h:321
Definition: DBCStructure.h:338

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::InitializeReactState ( )
927 {
928  if (IsTotem() || IsTrigger() || IsCritter() || IsSpiritService())
930  /*
931  else if (IsCivilian())
932  SetReactState(REACT_DEFENSIVE);
933  */
934  else
936 }
Definition: Unit.h:1131
Definition: Unit.h:1129
bool IsTrigger() const
Definition: Creature.h:496
bool IsTotem() const
Definition: Unit.h:1405
bool IsCritter() const
Definition: Unit.h:1580
void SetReactState(ReactStates st)
Definition: Creature.h:502
bool IsSpiritService() const
Definition: Unit.h:1579

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Creature::isCanInteractWithBattleMaster ( Player player,
bool  msg 
) const
Todo:
Rename these properly
939 {
940  if (!IsBattleMaster())
941  return false;
942 
943  BattlegroundTypeId bgTypeId = sBattlegroundMgr->GetBattleMasterBG(GetEntry());
944  if (!msg)
945  return player->GetBGAccessByLevel(bgTypeId);
946 
947  if (!player->GetBGAccessByLevel(bgTypeId))
948  {
949  player->PlayerTalkClass->ClearMenus();
950  switch (bgTypeId)
951  {
952  case BATTLEGROUND_AV: player->PlayerTalkClass->SendGossipMenu(7616, GetGUID()); break;
953  case BATTLEGROUND_WS: player->PlayerTalkClass->SendGossipMenu(7599, GetGUID()); break;
954  case BATTLEGROUND_AB: player->PlayerTalkClass->SendGossipMenu(7642, GetGUID()); break;
955  case BATTLEGROUND_EY:
956  case BATTLEGROUND_NA:
957  case BATTLEGROUND_BE:
958  case BATTLEGROUND_AA:
959  case BATTLEGROUND_RL:
960  case BATTLEGROUND_SA:
961  case BATTLEGROUND_DS:
962  case BATTLEGROUND_RV: player->PlayerTalkClass->SendGossipMenu(10024, GetGUID()); break;
963  default: break;
964  }
965  return false;
966  }
967  return true;
968 }
Definition: SharedDefines.h:4564
Definition: SharedDefines.h:4563
Definition: SharedDefines.h:4569
BattlegroundTypeId
Definition: SharedDefines.h:4558
Definition: SharedDefines.h:4566
Definition: SharedDefines.h:4562
bool IsBattleMaster() const
Definition: Unit.h:1570
Definition: SharedDefines.h:4568
Definition: SharedDefines.h:4567
Definition: SharedDefines.h:4565
Definition: SharedDefines.h:4571
Definition: SharedDefines.h:4561
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: SharedDefines.h:4570
#define sBattlegroundMgr
Definition: BattlegroundMgr.h:181
uint32 GetEntry() const
Definition: Object.h:107

+ Here is the call graph for this function:

bool Creature::isCanTrainingAndResetTalentsOf ( Player player) const
971 {
972  return player->getLevel() >= 10
974  && player->getClass() == GetCreatureTemplate()->trainer_class;
975 }
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
uint32 trainer_type
Definition: Creature.h:113
uint32 trainer_class
Definition: Creature.h:114
Definition: SharedDefines.h:3543

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Creature::IsCivilian ( ) const
inline
495 { return (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN) != 0; }
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
Definition: Creature.h:43

+ Here is the caller graph for this function:

bool Creature::IsDamageEnoughForLootingAndReward ( ) const
inline
CreatureTemplate const * m_creatureInfo
Definition: Creature.h:764
uint32 flags_extra
Definition: Creature.h:142
uint32 m_PlayerDamageReq
Definition: Creature.h:697

+ Here is the caller graph for this function:

bool Creature::IsDungeonBoss ( ) const
2552 {
2553  CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(GetEntry());
2554  return cinfo && (cinfo->flags_extra & CREATURE_FLAG_EXTRA_DUNGEON_BOSS);
2555 }
uint32 flags_extra
Definition: Creature.h:142
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32 GetEntry() const
Definition: Object.h:107
Definition: Creature.h:58
Definition: Creature.h:79

+ Here is the call graph for this function:

bool Creature::isElite ( ) const
1825 {
1826  if (IsPet())
1827  return false;
1828 
1829  uint32 rank = GetCreatureTemplate()->rank;
1830  return rank != CREATURE_ELITE_NORMAL && rank != CREATURE_ELITE_RARE;
1831 }
uint32 rank
Definition: Creature.h:102
Definition: SharedDefines.h:3704
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
uint32_t uint32
Definition: Define.h:150
bool IsPet() const
Definition: Unit.h:1403
Definition: SharedDefines.h:3708

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Creature::IsFocusing ( Spell const focusSpell = nullptr,
bool  withDelay = false 
)
2748 {
2749  if (!IsAlive()) // dead creatures cannot focus
2750  {
2751  ReleaseFocus(nullptr, false);
2752  return false;
2753  }
2754 
2755  if (focusSpell && (focusSpell != _focusSpell))
2756  return false;
2757 
2758  if (!_focusSpell)
2759  {
2760  if (!withDelay || !_focusDelay)
2761  return false;
2762  if (GetMSTimeDiffToNow(_focusDelay) > 1000) // @todo figure out if we can get rid of this magic number somehow
2763  {
2764  _focusDelay = 0; // save checks in the future
2765  return false;
2766  }
2767  }
2768 
2769  return true;
2770 }
bool IsAlive() const
Definition: Unit.h:1692
Spell const * _focusSpell
Definition: Creature.h:784
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
uint32 _focusDelay
Locks the target during spell cast for proper facing
Definition: Creature.h:785
void ReleaseFocus(Spell const *focusSpell=nullptr, bool withDelay=true)
Definition: Creature.cpp:2772

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Creature::IsGuard ( ) const
inline
497 { return (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_GUARD) != 0; }
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
Definition: Creature.h:52

+ Here is the caller graph for this function:

bool Creature::IsImmunedToSpell ( SpellInfo const spellInfo) const
overridevirtual

Reimplemented from Unit.

1783 {
1784  if (!spellInfo)
1785  return false;
1786 
1787  // Creature is immune to main mechanic of the spell
1788  if (GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1)))
1789  return true;
1790 
1791  // This check must be done instead of 'if (GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1)))' for not break
1792  // the check of mechanic immunity on DB (tested) because GetCreatureTemplate()->MechanicImmuneMask and m_spellImmune[IMMUNITY_MECHANIC] don't have same data.
1793  bool immunedToAllEffects = true;
1794  for (SpellEffectInfo const* effect : spellInfo->GetEffectsForDifficulty(GetMap()->GetDifficultyID()))
1795  {
1796  if (!effect || !effect->IsEffect())
1797  continue;
1798  if (!IsImmunedToSpellEffect(spellInfo, effect->EffectIndex))
1799  {
1800  immunedToAllEffects = false;
1801  break;
1802  }
1803  }
1804  if (immunedToAllEffects)
1805  return true;
1806 
1807  return Unit::IsImmunedToSpell(spellInfo);
1808 }
Map * GetMap() const
Definition: Object.h:543
virtual bool IsImmunedToSpell(SpellInfo const *spellInfo) const
Definition: Unit.cpp:9255
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
Definition: SpellInfo.h:238
bool IsImmunedToSpellEffect(SpellInfo const *spellInfo, uint32 index) const override
Definition: Creature.cpp:1810

+ Here is the call graph for this function:

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

Reimplemented from Unit.

Reimplemented in Totem.

1811 {
1812  SpellEffectInfo const* effect = spellInfo->GetEffect(this, index);
1813  if (!effect)
1814  return true;
1815  if (GetCreatureTemplate()->MechanicImmuneMask & (1 << (effect->Mechanic - 1)))
1816  return true;
1817 
1819  return true;
1820 
1821  return Unit::IsImmunedToSpellEffect(spellInfo, index);
1822 }
Definition: SharedDefines.h:3562
virtual bool IsImmunedToSpellEffect(SpellInfo const *spellInfo, uint32 index) const
Definition: Unit.cpp:9339
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
Mechanics Mechanic
Definition: SpellInfo.h:255
Definition: SpellInfo.h:238
Definition: SharedDefines.h:1020
uint32 Effect
Definition: SpellInfo.h:243

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Creature::IsInEvadeMode ( ) const
inline
520 { return HasUnitState(UNIT_STATE_EVADE); }
Definition: Unit.h:571
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1395

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Creature::IsInvisibleDueToDespawn ( ) const
overrideprotectedvirtual

Reimplemented from WorldObject.

1507 {
1509  return true;
1510 
1511  if (IsAlive() || isDying() || m_corpseRemoveTime > time(NULL))
1512  return false;
1513 
1514  return true;
1515 }
arena_t NULL
Definition: jemalloc_internal.h:624
virtual bool IsInvisibleDueToDespawn() const
Definition: Object.h:640
time_t m_corpseRemoveTime
Definition: Creature.h:733
bool IsAlive() const
Definition: Unit.h:1692
bool isDying() const
Definition: Unit.h:1693

+ Here is the call graph for this function:

bool Creature::IsRacialLeader ( ) const
inline
494 { return GetCreatureTemplate()->RacialLeader; }
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
bool RacialLeader
Definition: Creature.h:138
bool Creature::isRegeneratingHealth ( )
inline
662 { return m_regenHealth; }
bool m_regenHealth
Definition: Creature.h:753

+ Here is the caller graph for this function:

bool Creature::IsReputationGainDisabled ( ) const
inline
693 { return DisableReputationGain; }
bool DisableReputationGain
Definition: Creature.h:762
bool Creature::isTappedBy ( Player const player) const
1023 {
1024  if (player->GetGUID() == m_lootRecipient)
1025  return true;
1026 
1027  Group const* playerGroup = player->GetGroup();
1028  if (!playerGroup || playerGroup != GetLootRecipientGroup()) // if we dont have a group we arent the recipient
1029  return false; // if creature doesnt have group bound it means it was solo killed by someone else
1030 
1031  return true;
1032 }
ObjectGuid m_lootRecipient
Definition: Creature.h:727
Group * GetLootRecipientGroup() const
Definition: Creature.cpp:985
Definition: Group.h:191

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Creature::IsTrigger ( ) const
inline
496 { return (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER) != 0; }
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
Definition: Creature.h:49

+ Here is the caller graph for this function:

bool Creature::isWorldBoss ( ) const
1834 {
1835  if (IsPet())
1836  return false;
1837 
1838  return (GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_BOSS) != 0;
1839 }
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
bool IsPet() const
Definition: Unit.h:1403
Definition: SharedDefines.h:3658

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Creature::LoadCreatureFromDB ( ObjectGuid::LowType  spawnId,
Map map,
bool  addToMap = true,
bool  allowDuplicate = false 
)
1328 {
1329  if (!allowDuplicate)
1330  {
1331  // If an alive instance of this spawnId is already found, skip creation
1332  // If only dead instance(s) exist, despawn them and spawn a new (maybe also dead) version
1333  const auto creatureBounds = map->GetCreatureBySpawnIdStore().equal_range(spawnId);
1334  std::vector <Creature*> despawnList;
1335 
1336  if (creatureBounds.first != creatureBounds.second)
1337  {
1338  for (auto itr = creatureBounds.first; itr != creatureBounds.second; ++itr)
1339  {
1340  if (itr->second->IsAlive())
1341  {
1342  TC_LOG_DEBUG("maps", "Would have spawned " UI64FMTD " but %s already exists", spawnId, creatureBounds.first->second->GetGUID().ToString().c_str());
1343  return false;
1344  }
1345  else
1346  {
1347  despawnList.push_back(itr->second);
1348  TC_LOG_DEBUG("maps", "Despawned dead instance of spawn " UI64FMTD " (%s)", spawnId, itr->second->GetGUID().ToString().c_str());
1349  }
1350  }
1351 
1352  for (Creature* despawnCreature : despawnList)
1353  {
1354  despawnCreature->AddObjectToRemoveList();
1355  }
1356  }
1357  }
1358 
1359  CreatureData const* data = sObjectMgr->GetCreatureData(spawnId);
1360  if (!data)
1361  {
1362  TC_LOG_ERROR("sql.sql", "Creature (GUID: " UI64FMTD ") not found in table `creature`, can't load. ", spawnId);
1363  return false;
1364  }
1365 
1366  m_spawnId = spawnId;
1367  if (!Create(map->GenerateLowGuid<HighGuid::Creature>(), map, data->phaseMask, data->id, data->posX, data->posY, data->posZ, data->orientation, data))
1368  return false;
1369 
1370  //We should set first home position, because then AI calls home movement
1371  SetHomePosition(data->posX, data->posY, data->posZ, data->orientation);
1372 
1373  m_respawnradius = data->spawndist;
1374 
1375  m_respawnDelay = data->spawntimesecs;
1376  m_deathState = ALIVE;
1377 
1379  if (m_respawnTime) // respawn on Update
1380  {
1381  m_deathState = DEAD;
1382  if (CanFly())
1383  {
1384  float tz = map->GetHeight(GetPhaseMask(), data->posX, data->posY, data->posZ, false);
1385  if (data->posZ - tz > 0.1f)
1386  Relocate(data->posX, data->posY, tz);
1387  }
1388  }
1389 
1390  uint32 curhealth;
1391 
1392  if (!m_regenHealth)
1393  {
1394  curhealth = data->curhealth;
1395  if (curhealth)
1396  {
1397  curhealth = uint32(curhealth*_GetHealthMod(GetCreatureTemplate()->rank));
1398  if (curhealth < 1)
1399  curhealth = 1;
1400  }
1401  SetPower(POWER_MANA, data->curmana);
1402  }
1403  else
1404  {
1405  curhealth = GetMaxHealth();
1407  }
1408 
1409  SetHealth(m_deathState == ALIVE ? curhealth : 0);
1410 
1411  // checked at creature_template loading
1413 
1414  m_creatureData = data;
1415 
1416  loot.SetGUID(ObjectGuid::Create<HighGuid::LootObject>(data->mapid, data->id, GetMap()->GenerateLowGuid<HighGuid::LootObject>()));
1417 
1418  if (addToMap && !GetMap()->AddToMap(this))
1419  return false;
1420  return true;
1421 }
Definition: Creature.h:287
Definition: Unit.h:544
CreatureData const * m_creatureData
Definition: Creature.h:765
uint32 GetMaxHealth() const
Definition: Unit.h:1427
Map * GetMap() const
Definition: Object.h:543
uint8 movementType
Definition: Creature.h:307
uint32 id
Definition: Creature.h:293
time_t m_respawnTime
Definition: Creature.h:734
uint32 curhealth
Definition: Creature.h:305
Loot loot
Definition: Creature.h:578
uint32 curmana
Definition: Creature.h:306
Definition: Unit.h:541
float GetHeight(float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
Definition: Map.cpp:2314
bool Create(ObjectGuid::LowType guidlow, Map *map, uint32 phaseMask, uint32 entry, float x, float y, float z, float ang, CreatureData const *data=nullptr, uint32 vehId=0)
Definition: Creature.cpp:834
void SetHomePosition(float x, float y, float z, float o)
Definition: Creature.h:670
float spawndist
Definition: Creature.h:303
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Definition: Creature.h:467
MovementGeneratorType m_defaultMovementType
Definition: Creature.h:746
#define sObjectMgr
Definition: ObjectMgr.h:1567
float posX
Definition: Creature.h:298
float m_respawnradius
Definition: Creature.h:737
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
uint32 spawntimesecs
Definition: Creature.h:302
void Relocate(float x, float y)
Definition: Position.h:67
static float _GetHealthMod(int32 Rank)
Definition: Creature.cpp:1220
uint32 GetPhaseMask() const
Definition: Object.h:461
float posY
Definition: Creature.h:299
DeathState m_deathState
Definition: Unit.h:2259
#define UI64FMTD
Definition: Define.h:137
bool m_regenHealth
Definition: Creature.h:753
uint32_t uint32
Definition: Define.h:150
bool CanFly() const override
Definition: Creature.h:500
void SetPower(Powers power, int32 val)
Definition: Unit.cpp:11607
uint32 m_respawnDelay
Definition: Creature.h:735
CreatureBySpawnIdContainer & GetCreatureBySpawnIdStore()
Definition: Map.h:469
MovementGeneratorType
Definition: MotionMaster.h:35
float orientation
Definition: Creature.h:301
uint16 mapid
Definition: Creature.h:294
ObjectGuid::LowType m_spawnId
For new or temporary creatures is 0 for saved it is lowguid.
Definition: Creature.h:747
int32 GetMaxPower(Powers power) const
Definition: Unit.cpp:11598
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32 phaseMask
Definition: Creature.h:295
uint32_t uint32
Definition: g3dmath.h:168
void SetHealth(uint32 val)
Definition: Unit.cpp:11537
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:561
time_t GetCreatureRespawnTime(ObjectGuid::LowType dbGuid) const
Definition: Map.h:515
float posZ
Definition: Creature.h:300
Definition: SharedDefines.h:248
void SetGUID(ObjectGuid const &guid)
Definition: LootMgr.h:336

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Creature::LoadCreaturesAddon ( )

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.

2215 {
2216  CreatureAddon const* cainfo = GetCreatureAddon();
2217  if (!cainfo)
2218  return false;
2219 
2220  if (cainfo->mount != 0)
2221  Mount(cainfo->mount);
2222 
2223  if (cainfo->bytes1 != 0)
2224  {
2225  // 0 StandState
2226  // 1 FreeTalentPoints Pet only, so always 0 for default creature
2227  // 2 StandFlags
2228  // 3 StandMiscFlags
2229 
2230  SetByteValue(UNIT_FIELD_BYTES_1, 0, uint8(cainfo->bytes1 & 0xFF));
2231  //SetByteValue(UNIT_FIELD_BYTES_1, 1, uint8((cainfo->bytes1 >> 8) & 0xFF));
2233  SetByteValue(UNIT_FIELD_BYTES_1, 2, uint8((cainfo->bytes1 >> 16) & 0xFF));
2234  SetByteValue(UNIT_FIELD_BYTES_1, 3, uint8((cainfo->bytes1 >> 24) & 0xFF));
2235 
2243  }
2244 
2245  if (cainfo->bytes2 != 0)
2246  {
2247  // 0 SheathState
2248  // 1 Bytes2Flags
2249  // 2 UnitRename Pet only, so always 0 for default creature
2250  // 3 ShapeshiftForm Must be determined/set by shapeshift spell/aura
2251 
2252  SetByteValue(UNIT_FIELD_BYTES_2, 0, uint8(cainfo->bytes2 & 0xFF));
2253  //SetByteValue(UNIT_FIELD_BYTES_2, 1, uint8((cainfo->bytes2 >> 8) & 0xFF));
2254  //SetByteValue(UNIT_FIELD_BYTES_2, 2, uint8((cainfo->bytes2 >> 16) & 0xFF));
2256  //SetByteValue(UNIT_FIELD_BYTES_2, 3, uint8((cainfo->bytes2 >> 24) & 0xFF));
2258  }
2259 
2260  if (cainfo->emote != 0)
2262 
2263  //Load Path
2264  if (cainfo->path_id != 0)
2265  m_path_id = cainfo->path_id;
2266 
2267  if (!cainfo->auras.empty())
2268  {
2269  for (std::vector<uint32>::const_iterator itr = cainfo->auras.begin(); itr != cainfo->auras.end(); ++itr)
2270  {
2271  SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(*itr);
2272  if (!AdditionalSpellInfo)
2273  {
2274  TC_LOG_ERROR("sql.sql", "Creature (%s) has wrong spell %u defined in `auras` field.", GetGUID().ToString().c_str(), *itr);
2275  continue;
2276  }
2277 
2278  // skip already applied aura
2279  if (HasAura(*itr))
2280  continue;
2281 
2282  AddAura(*itr, this);
2283  TC_LOG_DEBUG("entities.unit", "Spell: %u added to creature (%s)", *itr, GetGUID().ToString().c_str());
2284  }
2285  }
2286 
2287  return true;
2288 }
uint32 mount
Definition: Creature.h:356
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4240
Definition: UpdateFields.h:136
Definition: UpdateFields.h:146
CreatureAddon const * GetCreatureAddon() const
Definition: Creature.cpp:2201
Definition: SpellInfo.h:326
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:14463
Definition: Unit.h:254
uint32 path_id
Definition: Creature.h:355
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
uint32 bytes2
Definition: Creature.h:358
Definition: Creature.h:333
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
void Mount(uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
Definition: Unit.cpp:9695
void AddUnitMovementFlag(uint32 f)
Definition: Unit.h:2107
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
uint32 bytes1
Definition: Creature.h:357
Definition: Unit.h:804
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition: Object.cpp:1080
std::string ToString() const
Definition: Position.cpp:160
#define sSpellMgr
Definition: SpellMgr.h:756
uint32 m_path_id
Definition: Creature.h:778
Definition: Creature.h:353
uint8_t uint8
Definition: g3dmath.h:164
ObjectGuid const & GetGUID() const
Definition: Object.h:105
std::vector< uint32 > auras
Definition: Creature.h:360
Definition: UpdateFields.h:124
uint32 emote
Definition: Creature.h:359
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint8 GetByteValue(uint16 index, uint8 offset) const
Definition: Object.cpp:318

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::LoadEquipment ( int8  id = 1,
bool  force = false 
)
1430 {
1431  if (id == 0)
1432  {
1433  if (force)
1434  {
1435  for (uint8 i = 0; i < MAX_EQUIPMENT_ITEMS; ++i)
1436  SetVirtualItem(i, 0);
1437  m_equipmentId = 0;
1438  }
1439 
1440  return;
1441  }
1442 
1443  EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(GetEntry(), id);
1444  if (!einfo)
1445  return;
1446 
1447  m_equipmentId = id;
1448  for (uint8 i = 0; i < MAX_EQUIPMENT_ITEMS; ++i)
1449  SetVirtualItem(i, einfo->ItemEntry[i]);
1450 }
void SetVirtualItem(uint32 slot, uint32 itemId, uint16 appearanceModId=0)
Definition: Unit.cpp:16427
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint8 m_equipmentId
Definition: Creature.h:748
uint8_t uint8
Definition: Define.h:152
uint32 GetEntry() const
Definition: Object.h:107
#define MAX_EQUIPMENT_ITEMS
Definition: Unit.h:1297
Definition: Creature.h:277
uint32 ItemEntry[MAX_EQUIPMENT_ITEMS]
Definition: Creature.h:279

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Creature::LoadFromDB ( ObjectGuid::LowType  spawnId,
Map map 
)
inline
571 { return LoadCreatureFromDB(spawnId, map, false); }
bool LoadCreatureFromDB(ObjectGuid::LowType spawnId, Map *map, bool addToMap=true, bool allowDuplicate=false)
Definition: Creature.cpp:1327
void Creature::LoadPath ( uint32  pathid)
inline
681 { m_path_id = pathid; }
uint32 m_path_id
Definition: Creature.h:778

+ Here is the caller graph for this function:

void Creature::LowerPlayerDamageReq ( uint32  unDamage)
1240 {
1241  if (m_PlayerDamageReq)
1242  m_PlayerDamageReq > unDamage ? m_PlayerDamageReq -= unDamage : m_PlayerDamageReq = 0;
1243 }
uint32 m_PlayerDamageReq
Definition: Creature.h:697

+ Here is the caller graph for this function:

void Creature::Motion_Initialize ( )
820 {
821  if (!m_formation)
823  else if (m_formation->getLeader() == this)
824  {
825  m_formation->FormationReset(false);
827  }
828  else if (m_formation->isFormed())
829  GetMotionMaster()->MoveIdle(); //wait the order of leader
830  else
832 }
void MoveIdle()
Definition: MotionMaster.cpp:185
MotionMaster * GetMotionMaster()
Definition: Unit.h:2101
Creature * getLeader() const
Definition: CreatureGroups.h:71
CreatureGroup * m_formation
Definition: Creature.h:781
bool isFormed() const
Definition: CreatureGroups.h:74
void Initialize()
Definition: MotionMaster.cpp:39
void FormationReset(bool dismiss)
Definition: CreatureGroups.cpp:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SpellInfo const * Creature::reachWithSpellAttack ( Unit victim)
1842 {
1843  if (!victim)
1844  return NULL;
1845 
1846  for (uint32 i=0; i < CREATURE_MAX_SPELLS; ++i)
1847  {
1848  if (!m_spells[i])
1849  continue;
1850  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]);
1851  if (!spellInfo)
1852  {
1853  TC_LOG_ERROR("entities.unit", "WORLD: unknown spell id %i", m_spells[i]);
1854  continue;
1855  }
1856 
1857  bool bcontinue = true;
1858  for (SpellEffectInfo const* effect : spellInfo->GetEffectsForDifficulty(GetMap()->GetDifficultyID()))
1859  {
1860  if (effect && ((effect->Effect == SPELL_EFFECT_SCHOOL_DAMAGE) ||
1861  (effect->Effect == SPELL_EFFECT_INSTAKILL) ||
1862  (effect->Effect == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) ||
1863  (effect->Effect == SPELL_EFFECT_HEALTH_LEECH)
1864  ))
1865  {
1866  bcontinue = false;
1867  break;
1868  }
1869  }
1870  if (bcontinue)
1871  continue;
1872 
1873  std::vector<SpellInfo::CostData> costs = spellInfo->CalcPowerCost(this, SpellSchoolMask(spellInfo->SchoolMask));
1874  auto m = std::find_if(costs.begin(), costs.end(), [](SpellInfo::CostData const& cost) { return cost.Power == POWER_MANA; });
1875  if (m != costs.end())
1876  if (m->Amount > GetPower(POWER_MANA))
1877  continue;
1878 
1879  float range = spellInfo->GetMaxRange(false);
1880  float minrange = spellInfo->GetMinRange(false);
1881  float dist = GetDistance(victim);
1882  if (dist > range || dist < minrange)
1883  continue;
1885  continue;
1887  continue;
1888  return spellInfo;
1889  }
1890  return NULL;
1891 }
Definition: SharedDefines.h:2058
#define CREATURE_MAX_SPELLS
Definition: Creature.h:75
Definition: Unit.h:686
Map * GetMap() const
Definition: Object.h:543
SpellSchoolMask
Definition: SharedDefines.h:285
Definition: SpellInfo.h:326
Definition: SharedDefines.h:1019
float GetMaxRange(bool positive=false, Unit *caster=NULL, Spell *spell=NULL) const
Definition: SpellInfo.cpp:2475
uint32 SchoolMask
Definition: SpellInfo.h:401
arena_t NULL
Definition: jemalloc_internal.h:624
float GetMinRange(bool positive=false) const
Definition: SpellInfo.cpp:2466
Definition: SharedDefines.h:1017
Definition: SpellInfo.h:553
int32 GetPower(Powers power) const
Definition: Unit.cpp:11589
std::vector< CostData > CalcPowerCost(Unit const *caster, SpellSchoolMask schoolMask) const
Definition: SpellInfo.cpp:2564
Definition: SharedDefines.h:1011
Definition: Unit.h:690
uint32 m_spells[CREATURE_MAX_SPELLS]
Definition: Creature.h:602
float GetDistance(WorldObject const *obj) const
Definition: Object.cpp:1594
#define sSpellMgr
Definition: SpellMgr.h:756
Definition: SpellInfo.h:238
uint32_t uint32
Definition: Define.h:150
uint32 PreventionType
Definition: SpellInfo.h:399
Definition: UpdateFields.h:109
SpellEffectInfoVector GetEffectsForDifficulty(uint32 difficulty) const
Definition: SpellInfo.cpp:3311
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.cpp:1239
Definition: SharedDefines.h:2059
Definition: SharedDefines.h:1012
Definition: SharedDefines.h:248

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SpellInfo const * Creature::reachWithSpellCure ( Unit victim)
1894 {
1895  if (!victim)
1896  return NULL;
1897 
1898  for (uint32 i=0; i < CREATURE_MAX_SPELLS; ++i)
1899  {
1900  if (!m_spells[i])
1901  continue;
1902  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]);
1903  if (!spellInfo)
1904  {
1905  TC_LOG_ERROR("entities.unit", "WORLD: unknown spell id %i", m_spells[i]);
1906  continue;
1907  }
1908 
1909  bool bcontinue = true;
1910  for (SpellEffectInfo const* effect : spellInfo->GetEffectsForDifficulty(GetMap()->GetDifficultyID()))
1911  {
1912  if (effect && (effect->Effect == SPELL_EFFECT_HEAL))
1913  {
1914  bcontinue = false;
1915  break;
1916  }
1917  }
1918  if (bcontinue)
1919  continue;
1920 
1921  std::vector<SpellInfo::CostData> costs = spellInfo->CalcPowerCost(this, SpellSchoolMask(spellInfo->SchoolMask));
1922  auto m = std::find_if(costs.begin(), costs.end(), [](SpellInfo::CostData const& cost) { return cost.Power == POWER_MANA; });
1923  if (m != costs.end())
1924  if (m->Amount > GetPower(POWER_MANA))
1925  continue;
1926 
1927  float range = spellInfo->GetMaxRange(true);
1928  float minrange = spellInfo->GetMinRange(true);
1929  float dist = GetDistance(victim);
1930  //if (!isInFront(victim, range) && spellInfo->AttributesEx)
1931  // continue;
1932  if (dist > range || dist < minrange)
1933  continue;
1935  continue;
1937  continue;
1938  return spellInfo;
1939  }
1940  return NULL;
1941 }
Definition: SharedDefines.h:2058
#define CREATURE_MAX_SPELLS
Definition: Creature.h:75
Definition: Unit.h:686
Map * GetMap() const
Definition: Object.h:543
SpellSchoolMask
Definition: SharedDefines.h:285
Definition: SpellInfo.h:326
float GetMaxRange(bool positive=false, Unit *caster=NULL, Spell *spell=NULL) const
Definition: SpellInfo.cpp:2475
uint32 SchoolMask
Definition: SpellInfo.h:401
arena_t NULL
Definition: jemalloc_internal.h:624
float GetMinRange(bool positive=false) const
Definition: SpellInfo.cpp:2466
Definition: SpellInfo.h:553
int32 GetPower(Powers power) const
Definition: Unit.cpp:11589
std::vector< CostData > CalcPowerCost(Unit const *caster, SpellSchoolMask schoolMask) const
Definition: SpellInfo.cpp:2564
Definition: Unit.h:690
uint32 m_spells[CREATURE_MAX_SPELLS]
Definition: Creature.h:602
float GetDistance(WorldObject const *obj) const
Definition: Object.cpp:1594
#define sSpellMgr
Definition: SpellMgr.h:756
Definition: SpellInfo.h:238
uint32_t uint32
Definition: Define.h:150
Definition: SharedDefines.h:1020
uint32 PreventionType
Definition: SpellInfo.h:399
Definition: UpdateFields.h:109
SpellEffectInfoVector GetEffectsForDifficulty(uint32 difficulty) const
Definition: SpellInfo.cpp:3311
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.cpp:1239
Definition: SharedDefines.h:2059
Definition: SharedDefines.h:248

+ Here is the call graph for this function:

void Creature::Regenerate ( Powers  power)
protected
634 {
635  uint32 curValue = GetPower(power);
636  uint32 maxValue = GetMaxPower(power);
637 
638  if (curValue >= maxValue)
639  return;
640 
641  float addvalue = 0.0f;
642 
643  switch (power)
644  {
645  case POWER_FOCUS:
646  {
647  // For hunter pets.
648  addvalue = 24 * sWorld->getRate(RATE_POWER_FOCUS);
649  break;
650  }
651  case POWER_ENERGY:
652  {
653  // For deathknight's ghoul.
654  addvalue = 20;
655  break;
656  }
657  default:
658  return;
659  }
660 
661  // Apply modifiers (if any).
663  for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
664  if (Powers((*i)->GetMiscValue()) == power)
665  AddPct(addvalue, (*i)->GetAmount());
666 
668 
669  ModifyPower(power, int32(addvalue));
670 }
int32 ModifyPower(Powers power, int32 val)
Definition: Unit.cpp:10285
int32 GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const
Definition: Unit.cpp:4521
#define PET_FOCUS_REGEN_INTERVAL
Definition: Pet.h:25
std::list< AuraEffect * > AuraEffectList
Definition: Unit.h:1322
#define sWorld
Definition: World.h:887
int32 GetPower(Powers power) const
Definition: Unit.cpp:11589
Definition: SharedDefines.h:250
Definition: SpellAuraDefines.h:170
bool IsHunterPet() const
Definition: Unit.h:1404
Powers
Definition: SharedDefines.h:246
#define CREATURE_REGEN_INTERVAL
Definition: Creature.h:70
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1832
uint32_t uint32
Definition: Define.h:150
Definition: SpellAuraDefines.h:145
Definition: SharedDefines.h:251
Definition: Common.h:103
T AddPct(T &base, U pct)
Definition: Util.h:98
int32_t int32
Definition: g3dmath.h:167
int32 GetMaxPower(Powers power) const
Definition: Unit.cpp:11598
Definition: World.h:389

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::RegenerateHealth ( )
protected
725 {
726  if (!isRegeneratingHealth())
727  return;
728 
729  uint32 curValue = GetHealth();
730  uint32 maxValue = GetMaxHealth();
731 
732  if (curValue >= maxValue)
733  return;
734 
735  uint32 addvalue = 0;
736 
737  // Not only pet, but any controlled creature
738  if (!GetCharmerOrOwnerGUID().IsEmpty())
739  {
740  float HealthIncreaseRate = sWorld->getRate(RATE_HEALTH);
741  float Spirit = GetStat(STAT_SPIRIT);
742 
743  if (GetPower(POWER_MANA) > 0)
744  addvalue = uint32(Spirit * 0.25 * HealthIncreaseRate);
745  else
746  addvalue = uint32(Spirit * 0.80 * HealthIncreaseRate);
747  }
748  else
749  addvalue = maxValue/3;
750 
751  // Apply modifiers (if any).
753  for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
754  AddPct(addvalue, (*i)->GetAmount());
755 
757 
758  ModifyHealth(addvalue);
759 }
uint32 GetMaxHealth() const
Definition: Unit.h:1427
int32 GetTotalAuraModifier(AuraType auratype) const
Definition: Unit.cpp:4396
std::list< AuraEffect * > AuraEffectList
Definition: Unit.h:1322
int32 ModifyHealth(int32 val)
Definition: Unit.cpp:10216
#define sWorld
Definition: World.h:887
int32 GetPower(Powers power) const
Definition: Unit.cpp:11589
Definition: SpellAuraDefines.h:148
#define CREATURE_REGEN_INTERVAL
Definition: Creature.h:70
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1832
uint32_t uint32
Definition: Define.h:150
ObjectGuid GetCharmerOrOwnerGUID() const
Definition: Unit.cpp:12677
bool isRegeneratingHealth()
Definition: Creature.h:662
Definition: SpellAuraDefines.h:144
Definition: Common.h:103
Definition: World.h:383
T AddPct(T &base, U pct)
Definition: Util.h:98
Definition: SharedDefines.h:241
uint32_t uint32
Definition: g3dmath.h:168
uint32 GetHealth() const
Definition: Unit.h:1426
float GetStat(Stats stat) const
Definition: Unit.h:1417
Definition: SharedDefines.h:248

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::RegenerateMana ( )
protected
693 {
694  uint32 curValue = GetPower(POWER_MANA);
695  uint32 maxValue = GetMaxPower(POWER_MANA);
696 
697  if (curValue >= maxValue)
698  return;
699 
700  uint32 addvalue = 0;
701 
702  // Combat and any controlled creature
703  if (IsInCombat() || !GetCharmerOrOwnerGUID().IsEmpty())
704  {
705  float ManaIncreaseRate = sWorld->getRate(RATE_POWER_MANA);
706  float Spirit = GetStat(STAT_SPIRIT);
707 
708  addvalue = uint32((Spirit / 5.0f + 17.0f) * ManaIncreaseRate);
709  }
710  else
711  addvalue = maxValue / 3;
712 
713  // Apply modifiers (if any).
715  for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
716  if ((*i)->GetMiscValue() == POWER_MANA)
717  AddPct(addvalue, (*i)->GetAmount());
718 
720 
721  ModifyPower(POWER_MANA, addvalue);
722 }
int32 ModifyPower(Powers power, int32 val)
Definition: Unit.cpp:10285
int32 GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const
Definition: Unit.cpp:4521
bool IsInCombat() const
Definition: Unit.h:1584
std::list< AuraEffect * > AuraEffectList
Definition: Unit.h:1322
#define sWorld
Definition: World.h:887
int32 GetPower(Powers power) const
Definition: Unit.cpp:11589
Definition: SpellAuraDefines.h:170
#define CREATURE_REGEN_INTERVAL
Definition: Creature.h:70
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1832
uint32_t uint32
Definition: Define.h:150
ObjectGuid GetCharmerOrOwnerGUID() const
Definition: Unit.cpp:12677
Definition: World.h:384
Definition: SpellAuraDefines.h:145
Definition: Common.h:103
T AddPct(T &base, U pct)
Definition: Util.h:98
Definition: SharedDefines.h:241
int32 GetMaxPower(Powers power) const
Definition: Unit.cpp:11598
uint32_t uint32
Definition: g3dmath.h:168
float GetStat(Stats stat) const
Definition: Unit.h:1417
Definition: SharedDefines.h:248

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::ReleaseFocus ( Spell const focusSpell = nullptr,
bool  withDelay = true 
)
2773 {
2774  if (!_focusSpell)
2775  return;
2776 
2777  // focused to something else
2778  if (focusSpell && focusSpell != _focusSpell)
2779  return;
2780 
2782 
2785 
2786  _focusSpell = nullptr;
2787  _focusDelay = withDelay ? getMSTime() : 0; // don't allow re-target right away to prevent visual bugs
2788 }
Definition: UpdateFields.h:89
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
uint32 getMSTime()
Definition: Timer.h:24
void SetGuidValue(uint16 index, ObjectGuid const &value)
Definition: Object.cpp:1120
void ClearUnitState(uint32 f)
Definition: Unit.h:1396
Definition: Unit.h:591
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:462
SpellInfo const * GetSpellInfo() const
Definition: Spell.h:614
Spell const * _focusSpell
Definition: Creature.h:784
uint32 _focusDelay
Locks the target during spell cast for proper facing
Definition: Creature.h:785
Definition: SharedDefines.h:555

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::RemoveCorpse ( bool  setSpawnTime = true)
281 {
282  if (getDeathState() != CORPSE)
283  return;
284 
285  m_corpseRemoveTime = time(NULL);
287  RemoveAllAuras();
289  loot.clear();
290  uint32 respawnDelay = m_respawnDelay;
291  if (IsAIEnabled)
292  AI()->CorpseRemoved(respawnDelay);
293 
294  // Should get removed later, just keep "compatibility" with scripts
295  if (setSpawnTime)
296  m_respawnTime = time(NULL) + respawnDelay;
297 
298  float x, y, z, o;
299  GetRespawnPosition(x, y, z, &o);
300  SetHomePosition(x, y, z, o);
301  GetMap()->CreatureRelocation(this, x, y, z, o);
302 }
void CreatureRelocation(Creature *creature, float x, float y, float z, float ang, bool respawnRelocationOnFail=true)
Definition: Map.cpp:982
void RemoveAllAuras()
Definition: Unit.cpp:3920
Definition: Unit.h:544
Map * GetMap() const
Definition: Object.h:543
time_t m_respawnTime
Definition: Creature.h:734
Loot loot
Definition: Creature.h:578
arena_t NULL
Definition: jemalloc_internal.h:624
void UpdateObjectVisibility(bool forced=true) override
Definition: Unit.cpp:14630
void SetHomePosition(float x, float y, float z, float o)
Definition: Creature.h:670
Definition: Unit.h:543
void clear()
Definition: LootMgr.h:349
bool IsAIEnabled
Definition: Unit.h:2161
void setDeathState(DeathState s) override
Definition: Creature.cpp:1624
time_t m_corpseRemoveTime
Definition: Creature.h:733
G3D::int16 z
Definition: Vector3int16.h:46
CreatureAI * AI() const
Definition: Creature.h:525
uint32_t uint32
Definition: Define.h:150
G3D::int16 y
Definition: Vector2int16.h:38
void GetRespawnPosition(float &x, float &y, float &z, float *ori=nullptr, float *dist=nullptr) const
Definition: Creature.cpp:2355
uint32 m_respawnDelay
Definition: Creature.h:735
virtual void CorpseRemoved(uint32 &)
== Triggered Actions Requested ==================
Definition: CreatureAI.h:176
G3D::int16 x
Definition: Vector2int16.h:37
DeathState getDeathState() const
Definition: Unit.h:1695

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::RemoveFromWorld ( )
overridevirtual

Reimplemented from WorldObject.

Reimplemented in Puppet, Minion, Pet, and TempSummon.

239 {
240  if (IsInWorld())
241  {
242  if (GetZoneScript())
244 
245  if (m_formation)
246  sFormationMgr->RemoveCreatureFromGroup(m_formation, this);
247 
249 
250  if (m_spawnId)
251  Trinity::Containers::MultimapErasePair(GetMap()->GetCreatureBySpawnIdStore(), m_spawnId, this);
253  }
254 }
void RemoveFromWorld() override
Definition: Unit.cpp:11733
Map * GetMap() const
Definition: Object.h:543
Definition: Creature.h:467
CreatureGroup * m_formation
Definition: Creature.h:781
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:466
virtual void OnCreatureRemove(Creature *)
Definition: ZoneScript.h:36
ObjectGuid const & GetGUID() const
Definition: Object.h:105
ZoneScript * GetZoneScript() const
Definition: Object.h:551
void MultimapErasePair(M< K, V, Rest...> &multimap, K const &key, V const &value)
Definition: Containers.h:149
#define sFormationMgr
Definition: CreatureGroups.h:84
ObjectGuid::LowType m_spawnId
For new or temporary creatures is 0 for saved it is lowguid.
Definition: Creature.h:747
bool Remove(KEY_TYPE const &handle)
Definition: TypeContainer.h:125
bool IsInWorld() const
Definition: Object.h:100

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::RemoveLootMode ( uint16  lootMode)
inline
596 { m_LootMode &= ~lootMode; }
uint16 m_LootMode
Definition: Creature.h:767

+ Here is the caller graph for this function:

void Creature::ResetLootMode ( )
inline
uint16 m_LootMode
Definition: Creature.h:767
Definition: SharedDefines.h:69

+ Here is the caller graph for this function:

void Creature::ResetPickPocketRefillTimer ( )
inline
580 { _pickpocketLootRestore = 0; }
time_t _pickpocketLootRestore
Timers.
Definition: Creature.h:732

+ Here is the caller graph for this function:

void Creature::ResetPlayerDamageReq ( )
inline
696 { m_PlayerDamageReq = GetHealth() / 2; }
uint32 m_PlayerDamageReq
Definition: Creature.h:697
uint32 GetHealth() const
Definition: Unit.h:1426

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::Respawn ( bool  force = false)
1698 {
1700 
1701  if (force)
1702  {
1703  if (IsAlive())
1705  else if (getDeathState() != CORPSE)
1707  }
1708 
1709  RemoveCorpse(false);
1710 
1711  if (getDeathState() == DEAD)
1712  {
1713  if (m_spawnId)
1715 
1716  TC_LOG_DEBUG("entities.unit", "Respawning creature %s (%s)",
1717  GetName().c_str(), GetGUID().ToString().c_str());
1718  m_respawnTime = 0;
1720  loot.clear();
1721  if (m_originalEntry != GetEntry())
1723 
1724  SelectLevel();
1725 
1727 
1728  uint32 displayID = GetNativeDisplayId();
1729  CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID);
1730  if (minfo) // Cancel load if no model defined
1731  {
1732  SetDisplayId(displayID);
1733  SetNativeDisplayId(displayID);
1735  }
1736 
1738 
1739  //Call AI respawn virtual function
1740  if (IsAIEnabled)
1741  {
1742  //reset the AI to be sure no dirty or uninitialized values will be used till next tick
1743  AI()->Reset();
1744  TriggerJustRespawned = true;//delay event to next tick so all creatures are created on the map before processing
1745  }
1746 
1747  uint32 poolid = GetSpawnId() ? sPoolMgr->IsPartOfAPool<Creature>(GetSpawnId()) : 0;
1748  if (poolid)
1749  sPoolMgr->UpdatePool<Creature>(poolid, GetSpawnId());
1750 
1751  //Re-initialize reactstate that could be altered by movementgenerators
1753  }
1754 
1756 }
Definition: Unit.h:544
Definition: Unit.h:234
Map * GetMap() const
Definition: Object.h:543
Definition: UpdateFields.h:96
Definition: Unit.h:542
time_t m_respawnTime
Definition: Creature.h:734
void InitializeReactState()
Definition: Creature.cpp:926
std::string const & GetName() const
Definition: Object.h:479
MotionMaster * GetMotionMaster()
Definition: Unit.h:2101
Loot loot
Definition: Creature.h:578
ObjectGuid::LowType GetSpawnId() const
Definition: Creature.h:487
void UpdateObjectVisibility(bool forced=true) override
Definition: Unit.cpp:14630
void SetNativeDisplayId(uint32 modelId)
Definition: Unit.h:2016
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Definition: Creature.h:467
Definition: Unit.h:543
void clear()
Definition: LootMgr.h:349
bool IsAIEnabled
Definition: Unit.h:2161
#define sObjectMgr
Definition: ObjectMgr.h:1567
void InitDefault()
Definition: MotionMaster.cpp:54
Definition: Creature.h:317
void setDeathState(DeathState s) override
Definition: Creature.cpp:1624
Definition: Unit.h:545
#define sPoolMgr
Definition: PoolMgr.h:166
bool IsAlive() const
Definition: Unit.h:1692
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition: Object.cpp:1080
std::string ToString() const
Definition: Position.cpp:160
CreatureAI * AI() const
Definition: Creature.h:525
uint32_t uint32
Definition: Define.h:150
uint32 m_originalEntry
Definition: Creature.h:757
bool TriggerJustRespawned
Definition: Creature.h:782
ObjectGuid const & GetGUID() const
Definition: Object.h:105
uint32 GetNativeDisplayId() const
Definition: Unit.h:2014
void SetDisplayId(uint32 modelId) override
Definition: Creature.cpp:2664
void SelectLevel()
Definition: Creature.cpp:1154
void ResetPickPocketRefillTimer()
Definition: Creature.h:580
void RemoveCorpse(bool setSpawnTime=true)
Definition: Creature.cpp:280
ObjectGuid::LowType m_spawnId
For new or temporary creatures is 0 for saved it is lowguid.
Definition: Creature.h:747
void DestroyForNearbyPlayers()
Definition: Object.cpp:2974
uint32 GetEntry() const
Definition: Object.h:107
virtual void Reset()
Definition: UnitAI.h:132
bool UpdateEntry(uint32 entry, CreatureData const *data=nullptr)
Definition: Creature.cpp:407
void RemoveCreatureRespawnTime(ObjectGuid::LowType dbGuid)
Definition: Map.cpp:3589
DeathState getDeathState() const
Definition: Unit.h:1695
int8 gender
Definition: Creature.h:321

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::SaveRespawnTime ( )
overridevirtual

Reimplemented from WorldObject.

2162 {
2164  return;
2165 
2167 }
CreatureData const * m_creatureData
Definition: Creature.h:765
Map * GetMap() const
Definition: Object.h:543
time_t m_respawnTime
Definition: Creature.h:734
void SaveCreatureRespawnTime(ObjectGuid::LowType dbGuid, time_t respawnTime)
Definition: Map.cpp:3570
bool dbData
Definition: Creature.h:314
ObjectGuid::LowType m_spawnId
For new or temporary creatures is 0 for saved it is lowguid.
Definition: Creature.h:747
bool IsSummon() const
Definition: Unit.h:1401

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::SaveToDB ( )
1035 {
1036  // this should only be used when the creature has already been loaded
1037  // preferably after adding to map, because mapid may not be valid otherwise
1038  CreatureData const* data = sObjectMgr->GetCreatureData(m_spawnId);
1039  if (!data)
1040  {
1041  TC_LOG_ERROR("entities.unit", "Creature::SaveToDB failed, cannot get creature data!");
1042  return;
1043  }
1044 
1045  uint32 mapId = GetTransport() ? GetTransport()->GetGOInfo()->moTransport.mapID : GetMapId();
1046  SaveToDB(mapId, data->spawnMask, GetPhaseMask());
1047 }
Definition: Creature.h:287
void SaveToDB()
Definition: Creature.cpp:1034
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32 GetPhaseMask() const
Definition: Object.h:461
uint32_t uint32
Definition: Define.h:150
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:894
uint32 GetMapId() const
Definition: Position.h:254
Transport * GetTransport() const
Definition: Object.h:602
uint32 spawnMask
Definition: Creature.h:308
struct GameObjectTemplate::@221::@238 moTransport
ObjectGuid::LowType m_spawnId
For new or temporary creatures is 0 for saved it is lowguid.
Definition: Creature.h:747
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Reimplemented in Pet, and TempSummon.

1050 {
1051  // update in loaded data
1052  if (!m_spawnId)
1053  m_spawnId = sObjectMgr->GenerateCreatureSpawnId();
1054 
1055  CreatureData& data = sObjectMgr->NewOrExistCreatureData(m_spawnId);
1056 
1057  uint32 displayId = GetNativeDisplayId();
1059  uint32 unit_flags = GetUInt32Value(UNIT_FIELD_FLAGS);
1060  uint32 dynamicflags = GetUInt32Value(OBJECT_DYNAMIC_FLAGS);
1061 
1062  // check if it's a custom model and if not, use 0 for displayId
1063  CreatureTemplate const* cinfo = GetCreatureTemplate();
1064  if (cinfo)
1065  {
1066  if (displayId == cinfo->Modelid1 || displayId == cinfo->Modelid2 ||
1067  displayId == cinfo->Modelid3 || displayId == cinfo->Modelid4)
1068  displayId = 0;
1069 
1070  if (npcflag == cinfo->npcflag)
1071  npcflag = 0;
1072 
1073  if (unit_flags == cinfo->unit_flags)
1074  unit_flags = 0;
1075 
1076  if (dynamicflags == cinfo->dynamicflags)
1077  dynamicflags = 0;
1078  }
1079 
1080  // data->guid = guid must not be updated at save
1081  data.id = GetEntry();
1082  data.mapid = mapid;
1083  data.phaseMask = phaseMask;
1084  data.displayid = displayId;
1086  if (!GetTransport())
1087  {
1088  data.posX = GetPositionX();
1089  data.posY = GetPositionY();
1090  data.posZ = GetPositionZMinusOffset();
1091  data.orientation = GetOrientation();
1092  }
1093  else
1094  {
1095  data.posX = GetTransOffsetX();
1096  data.posY = GetTransOffsetY();
1097  data.posZ = GetTransOffsetZ();
1098  data.orientation = GetTransOffsetO();
1099  }
1100 
1102  // prevent add data integrity problems
1104  data.currentwaypoint = 0;
1105  data.curhealth = GetHealth();
1106  data.curmana = GetPower(POWER_MANA);
1107  // prevent add data integrity problems
1110  data.spawnMask = spawnMask;
1111  data.npcflag = npcflag;
1112  data.unit_flags = unit_flags;
1113  data.dynamicflags = dynamicflags;
1114 
1115  data.phaseid = GetDBPhase() > 0 ? GetDBPhase() : 0;
1116  data.phaseGroup = GetDBPhase() < 0 ? abs(GetDBPhase()) : 0;
1117 
1118  // update in DB
1120 
1122  stmt->setUInt64(0, m_spawnId);
1123  trans->Append(stmt);
1124 
1125  uint8 index = 0;
1126 
1128  stmt->setUInt64(index++, m_spawnId);
1129  stmt->setUInt32(index++, GetEntry());
1130  stmt->setUInt16(index++, uint16(mapid));
1131  stmt->setUInt32(index++, spawnMask);
1132  stmt->setUInt32(index++, data.phaseid);
1133  stmt->setUInt32(index++, data.phaseGroup);
1134  stmt->setUInt32(index++, displayId);
1135  stmt->setUInt8(index++, GetCurrentEquipmentId());
1136  stmt->setFloat(index++, GetPositionX());
1137  stmt->setFloat(index++, GetPositionY());
1138  stmt->setFloat(index++, GetPositionZ());
1139  stmt->setFloat(index++, GetOrientation());
1140  stmt->setUInt32(index++, m_respawnDelay);
1141  stmt->setFloat(index++, m_respawnradius);
1142  stmt->setUInt32(index++, 0);
1143  stmt->setUInt32(index++, GetHealth());
1144  stmt->setUInt32(index++, GetPower(POWER_MANA));
1145  stmt->setUInt8(index++, uint8(GetDefaultMovementType()));
1146  stmt->setUInt64(index++, npcflag);
1147  stmt->setUInt32(index++, unit_flags);
1148  stmt->setUInt32(index++, dynamicflags);
1149  trans->Append(stmt);
1150 
1152 }
Definition: Creature.h:287
G3D::Matrix abs(const G3D::Matrix &M)
Definition: Matrix.h:632
Definition: MotionMaster.h:37
float GetTransOffsetZ() const
Definition: Object.h:605
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
uint32 phaseid
Definition: Creature.h:312
uint8 movementType
Definition: Creature.h:307
uint32 id
Definition: Creature.h:293
uint32 dynamicflags
Definition: Creature.h:111
uint64 npcflag
Definition: Creature.h:98
uint32 displayid
Definition: Creature.h:296
Definition: WorldDatabase.h:84
uint32 curhealth
Definition: Creature.h:305
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
uint32 curmana
Definition: Creature.h:306
MovementGeneratorType GetDefaultMovementType() const
Definition: Creature.h:624
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
Definition: MotionMaster.h:38
float spawndist
Definition: Creature.h:303
float GetTransOffsetY() const
Definition: Object.h:604
int32 GetPower(Powers power) const
Definition: Unit.cpp:11589
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint16_t uint16
Definition: g3dmath.h:166
Definition: PreparedStatement.h:74
float posX
Definition: Creature.h:298
uint32 phaseGroup
Definition: Creature.h:313
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
float m_respawnradius
Definition: Creature.h:737
Definition: WorldDatabase.h:92
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
uint32 spawntimesecs
Definition: Creature.h:302
float GetOrientation() const
Definition: Position.h:107
float GetTransOffsetX() const
Definition: Object.h:603
float posY
Definition: Creature.h:299
float GetPositionY() const
Definition: Position.h:105
uint32 unit_flags
Definition: Creature.h:109
int8 equipmentId
Definition: Creature.h:297
void setUInt16(const uint8 index, const uint16 value)
Definition: PreparedStatement.cpp:106
float GetPositionZ() const
Definition: Position.h:106
uint32_t uint32
Definition: Define.h:150
uint64_t uint64
Definition: Define.h:149
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
uint8_t uint8
Definition: g3dmath.h:164
uint32 GetNativeDisplayId() const
Definition: Unit.h:2014
Transport * GetTransport() const
Definition: Object.h:602
int32 GetDBPhase() const
Definition: Object.h:468
uint32 Modelid1
Definition: Creature.h:84
uint32 m_respawnDelay
Definition: Creature.h:735
uint32 dynamicflags
Definition: Creature.h:311
uint32 Modelid3
Definition: Creature.h:86
uint32 spawnMask
Definition: Creature.h:308
uint32 Modelid2
Definition: Creature.h:85
uint32 unit_flags
Definition: Creature.h:310
Definition: UpdateFields.h:109
float GetTransOffsetO() const
Definition: Object.h:606
uint32 currentwaypoint
Definition: Creature.h:304
void setFloat(const uint8 index, const float value)
Definition: PreparedStatement.cpp:169
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
float orientation
Definition: Creature.h:301
uint8_t uint8
Definition: Define.h:152
uint8 GetCurrentEquipmentId() const
Definition: Creature.h:547
Definition: UpdateFields.h:135
Definition: UpdateFields.h:30
uint16 mapid
Definition: Creature.h:294
ObjectGuid::LowType m_spawnId
For new or temporary creatures is 0 for saved it is lowguid.
Definition: Creature.h:747
uint32 GetEntry() const
Definition: Object.h:107
uint32 phaseMask
Definition: Creature.h:295
uint32 Modelid4
Definition: Creature.h:87
float GetPositionX() const
Definition: Position.h:104
uint32 GetHealth() const
Definition: Unit.h:1426
uint64 npcflag
Definition: Creature.h:309
uint64 GetUInt64Value(uint16 index) const
Definition: Object.cpp:306
float posZ
Definition: Creature.h:300
Definition: Creature.h:79
Definition: SharedDefines.h:248
float GetPositionZMinusOffset() const
Definition: Unit.cpp:13799
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

void Creature::SearchFormation ( )
267 {
268  if (IsSummon())
269  return;
270 
271  ObjectGuid::LowType lowguid = GetSpawnId();
272  if (!lowguid)
273  return;
274 
275  CreatureGroupInfoType::iterator frmdata = sFormationMgr->CreatureGroupMap.find(lowguid);
276  if (frmdata != sFormationMgr->CreatureGroupMap.end())
277  sFormationMgr->AddCreatureToGroup(frmdata->second->leaderGUID, this);
278 }
ObjectGuid::LowType GetSpawnId() const
Definition: Creature.h:487
uint64 LowType
Definition: ObjectGuid.h:199
#define sFormationMgr
Definition: CreatureGroups.h:84
bool IsSummon() const
Definition: Unit.h:1401

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::SelectLevel ( )
1155 {
1156  CreatureTemplate const* cInfo = GetCreatureTemplate();
1157 
1158  uint32 rank = IsPet() ? 0 : cInfo->rank;
1159 
1160  // level
1161  uint8 minlevel = std::min(cInfo->maxlevel, cInfo->minlevel);
1162  uint8 maxlevel = std::max(cInfo->maxlevel, cInfo->minlevel);
1163  uint8 level = minlevel == maxlevel ? minlevel : urand(minlevel, maxlevel);
1164  SetLevel(level);
1165 
1166  CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(level, cInfo->unit_class);
1167 
1168  // health
1169  float healthmod = _GetHealthMod(rank);
1170 
1171  uint32 basehp = stats->GenerateHealth(cInfo);
1172  uint32 health = uint32(basehp * healthmod);
1173 
1174  SetCreateHealth(health);
1175  SetMaxHealth(health);
1176  SetHealth(health);
1178 
1179  // mana
1180  uint32 mana = stats->GenerateMana(cInfo);
1181  SetCreateMana(mana);
1182 
1183  switch (getClass())
1184  {
1185  case CLASS_WARRIOR:
1187  break;
1188  case CLASS_ROGUE:
1190  break;
1191  default:
1192  SetMaxPower(POWER_MANA, mana); // MAX Mana
1193  SetPower(POWER_MANA, mana);
1194  break;
1195  }
1196 
1197  SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, (float)health);
1198  SetModifierValue(UNIT_MOD_MANA, BASE_VALUE, (float)mana);
1199 
1200  // damage
1201 
1202  float basedamage = stats->GenerateBaseDamage(cInfo);
1203 
1204  float weaponBaseMinDamage = basedamage;
1205  float weaponBaseMaxDamage = basedamage * 1.5f;
1206 
1207  SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, weaponBaseMinDamage);
1208  SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, weaponBaseMaxDamage);
1209 
1210  SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, weaponBaseMinDamage);
1211  SetBaseWeaponDamage(OFF_ATTACK, MAXDAMAGE, weaponBaseMaxDamage);
1212 
1213  SetBaseWeaponDamage(RANGED_ATTACK, MINDAMAGE, weaponBaseMinDamage);
1214  SetBaseWeaponDamage(RANGED_ATTACK, MAXDAMAGE, weaponBaseMaxDamage);
1215 
1218 }
Definition: SharedDefines.h:170
int16 maxlevel
Definition: Creature.h:94
void ResetPlayerDamageReq()
Definition: Creature.h:696
uint32 rank
Definition: Creature.h:102
int16 minlevel
Definition: Creature.h:93
Definition: Unit.h:444
void SetModifierValue(UnitMods unitMod, UnitModifierType modifierType, float value)
Definition: Unit.h:1952
Definition: Unit.h:619
Definition: Unit.h:434
void SetCreateHealth(uint32 val)
Definition: Unit.h:1894
Definition: Unit.h:508
Definition: SharedDefines.h:249
#define sObjectMgr
Definition: ObjectMgr.h:1567
void setPowerType(Powers power)
Definition: Unit.cpp:6977
T max(const T &x, const T &y)
Definition: g3dmath.h:320
Definition: SharedDefines.h:167
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
T min(const T &x, const T &y)
Definition: g3dmath.h:305
Definition: Unit.h:618
static float _GetHealthMod(int32 Rank)
Definition: Creature.cpp:1220
void SetLevel(uint8 lvl)
Definition: Unit.cpp:11523
uint32 AttackPower
Definition: Creature.h:223
void SetCreateMana(uint32 val)
Definition: Unit.h:1896
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
float GenerateBaseDamage(CreatureTemplate const *info) const
Definition: Creature.h:248
uint32_t uint32
Definition: Define.h:150
uint32 GenerateMana(CreatureTemplate const *info) const
Definition: Creature.h:234
void SetMaxHealth(uint32 val)
Definition: Unit.cpp:11565
void SetBaseWeaponDamage(WeaponAttackType attType, WeaponDamageRange damageRange, float value)
Definition: Unit.h:1972
bool IsPet() const
Definition: Unit.h:1403
void SetPower(Powers power, int32 val)
Definition: Unit.cpp:11607
Definition: Unit.h:490
Definition: Unit.h:489
Definition: Unit.h:445
uint32 RangedAttackPower
Definition: Creature.h:224
uint32 GenerateHealth(CreatureTemplate const *info) const
Definition: Creature.h:229
Definition: SharedDefines.h:251
uint8 getClass() const
Definition: Unit.h:1413
Definition: Unit.h:509
uint8_t uint8
Definition: Define.h:152
void SetMaxPower(Powers power, int32 val)
Definition: Unit.cpp:11641
uint32_t uint32
Definition: g3dmath.h:168
void SetHealth(uint32 val)
Definition: Unit.cpp:11537
uint32 unit_class
Definition: Creature.h:108
Definition: Creature.h:79
Definition: Unit.h:617
Definition: SharedDefines.h:248
Definition: Creature.h:218

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Unit * Creature::SelectNearestHostileUnitInAggroRange ( bool  useLOS = false) const
2607 {
2608  // Selects nearest hostile target within creature's aggro range. Used primarily by
2609  // pets set to aggressive. Will not return neutral or friendly targets.
2610 
2611  Unit* target = NULL;
2612 
2613  {
2614  Trinity::NearestHostileUnitInAggroRangeCheck u_check(this, useLOS);
2616 
2618  }
2619 
2620  return target;
2621 }
Definition: GridNotifiers.h:1069
Definition: GridNotifiers.h:376
arena_t NULL
Definition: jemalloc_internal.h:624
void VisitNearbyGridObject(float const &radius, NOTIFIER &notifier) const
Definition: Object.h:588
#define MAX_AGGRO_RADIUS
Definition: Unit.h:331
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Player * Creature::SelectNearestPlayer ( float  distance = 0) const
1999 {
2000  Player* target = NULL;
2001 
2004  VisitNearbyObject(distance, searcher);
2005 
2006  return target;
2007 }
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: GridNotifiers.h:525
double distance(double x, double y)
Definition: g3dmath.h:731
void VisitNearbyObject(float const &radius, NOTIFIER &notifier) const
Definition: Object.h:587
Definition: GridNotifiers.h:1209

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Unit * Creature::SelectNearestTarget ( float  dist = 0,
bool  playerOnly = false 
) const
1945 {
1947  Cell cell(p);
1948  cell.SetNoCreate();
1949 
1950  Unit* target = NULL;
1951 
1952  {
1953  if (dist == 0.0f)
1954  dist = MAX_VISIBILITY_DISTANCE;
1955 
1956  Trinity::NearestHostileUnitCheck u_check(this, dist, playerOnly);
1957  Trinity::UnitLastSearcher<Trinity::NearestHostileUnitCheck> searcher(this, target, u_check);
1958 
1961 
1962  cell.Visit(p, world_unit_searcher, *GetMap(), *this, dist);
1963  cell.Visit(p, grid_unit_searcher, *GetMap(), *this, dist);
1964  }
1965 
1966  return target;
1967 }
Definition: TypeContainerVisitor.h:32
Map * GetMap() const
Definition: Object.h:543
Definition: GridNotifiers.h:1005
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:193
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: TypeContainer.h:86
float GetPositionY() const
Definition: Position.h:105
#define MAX_VISIBILITY_DISTANCE
Definition: Object.h:38
Definition: GridNotifiers.h:393
Definition: Cell.h:49
float GetPositionX() const
Definition: Position.h:104
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Unit * Creature::SelectNearestTargetInAttackDistance ( float  dist = 0) const
1971 {
1973  Cell cell(p);
1974  cell.SetNoCreate();
1975 
1976  Unit* target = NULL;
1977 
1978  if (dist > MAX_VISIBILITY_DISTANCE)
1979  {
1980  TC_LOG_ERROR("entities.unit", "Creature (%s) SelectNearestTargetInAttackDistance called with dist > MAX_VISIBILITY_DISTANCE. Distance set to ATTACK_DISTANCE.", GetGUID().ToString().c_str());
1981  dist = ATTACK_DISTANCE;
1982  }
1983 
1984  {
1987 
1990 
1991  cell.Visit(p, world_unit_searcher, *GetMap(), *this, ATTACK_DISTANCE > dist ? ATTACK_DISTANCE : dist);
1992  cell.Visit(p, grid_unit_searcher, *GetMap(), *this, ATTACK_DISTANCE > dist ? ATTACK_DISTANCE : dist);
1993  }
1994 
1995  return target;
1996 }
#define ATTACK_DISTANCE
Definition: Object.h:35
Definition: TypeContainerVisitor.h:32
Map * GetMap() const
Definition: Object.h:543
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:193
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: TypeContainer.h:86
float GetPositionY() const
Definition: Position.h:105
std::string ToString() const
Definition: Position.cpp:160
#define MAX_VISIBILITY_DISTANCE
Definition: Object.h:38
Definition: GridNotifiers.h:393
Definition: Cell.h:49
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: GridNotifiers.h:1034
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
float GetPositionX() const
Definition: Position.h:104
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Unit * Creature::SelectVictim ( )
Todo:
a vehicle may eat some mob, so mob should not evade
10776 {
10777  // function provides main threat functionality
10778  // next-victim-selection algorithm and evade mode are called
10779  // threat list sorting etc.
10780 
10781  Unit* target = nullptr;
10782  // First checking if we have some taunt on us
10784  if (!tauntAuras.empty())
10785  {
10786  Unit* caster = tauntAuras.back()->GetCaster();
10787 
10788  // The last taunt aura caster is alive an we are happy to attack him
10789  if (caster && caster->IsAlive())
10790  return GetVictim();
10791  else if (tauntAuras.size() > 1)
10792  {
10793  // We do not have last taunt aura caster but we have more taunt auras,
10794  // so find first available target
10795 
10796  // Auras are pushed_back, last caster will be on the end
10797  AuraEffectList::const_iterator aura = --tauntAuras.end();
10798  do
10799  {
10800  --aura;
10801  caster = (*aura)->GetCaster();
10802  if (caster && CanSeeOrDetect(caster, true) && IsValidAttackTarget(caster) && caster->isInAccessiblePlaceFor(ToCreature()))
10803  {
10804  target = caster;
10805  break;
10806  }
10807  } while (aura != tauntAuras.begin());
10808  }
10809  else
10810  target = GetVictim();
10811  }
10812 
10813  if (CanHaveThreatList())
10814  {
10815  if (!target && !m_ThreatManager.isThreatListEmpty())
10816  // No taunt aura or taunt aura caster is dead standard target selection
10817  target = m_ThreatManager.getHostilTarget();
10818  }
10819  else if (!HasReactState(REACT_PASSIVE))
10820  {
10821  // We have player pet probably
10822  target = getAttackerForHelper();
10823  if (!target && IsSummon())
10824  {
10825  if (Unit* owner = ToTempSummon()->GetOwner())
10826  {
10827  if (owner->IsInCombat())
10828  target = owner->getAttackerForHelper();
10829  if (!target)
10830  {
10831  for (ControlList::const_iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr)
10832  {
10833  if ((*itr)->IsInCombat())
10834  {
10835  target = (*itr)->getAttackerForHelper();
10836  if (target)
10837  break;
10838  }
10839  }
10840  }
10841  }
10842  }
10843  }
10844  else
10845  return nullptr;
10846 
10847  if (target && _IsTargetAcceptable(target) && CanCreatureAttack(target))
10848  {
10849  if(!IsFocusing())
10850  SetInFront(target);
10851  return target;
10852  }
10853 
10854  // last case when creature must not go to evade mode:
10855  // it in combat but attacker not make any damage and not enter to aggro radius to have record in threat list
10856  // for example at owner command to pet attack some far away creature
10857  // Note: creature does not have targeted movement generator but has attacker in this case
10858  for (AttackerSet::const_iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr)
10859  {
10860  if ((*itr) && !CanCreatureAttack(*itr) && (*itr)->GetTypeId() != TYPEID_PLAYER
10861  && !(*itr)->ToCreature()->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
10862  return nullptr;
10863  }
10864 
10866  if (GetVehicle())
10867  return nullptr;
10868 
10869  // search nearby enemy before enter evade mode
10871  {
10873 
10874  if (target && _IsTargetAcceptable(target) && CanCreatureAttack(target))
10875  return target;
10876  }
10877 
10879  if (!iAuras.empty())
10880  {
10881  for (Unit::AuraEffectList::const_iterator itr = iAuras.begin(); itr != iAuras.end(); ++itr)
10882  {
10883  if ((*itr)->GetBase()->IsPermanent())
10884  {
10886  break;
10887  }
10888  }
10889  return nullptr;
10890  }
10891 
10892  // enter in evade mode in other case
10894 
10895  return nullptr;
10896 }
#define ATTACK_DISTANCE
Definition: Object.h:35
Definition: Unit.h:1131
Unit * SelectNearestTargetInAttackDistance(float dist=0) const
Definition: Creature.cpp:1970
Definition: Unit.h:1129
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Definition: CreatureAI.cpp:168
std::list< AuraEffect * > AuraEffectList
Definition: Unit.h:1322
bool IsValidAttackTarget(Unit const *target) const
Definition: Unit.cpp:10002
bool HasReactState(ReactStates state) const
Definition: Creature.h:504
bool isThreatListEmpty() const
Definition: ThreatManager.h:220
bool CanHaveThreatList(bool skipAliveCheck=false) const
Definition: Unit.cpp:10652
Definition: Unit.h:866
Unit * getHostilTarget()
Definition: ThreatManager.cpp:459
TempSummon * ToTempSummon()
Definition: Unit.h:2206
bool _IsTargetAcceptable(const Unit *target) const
Definition: Creature.cpp:2127
Definition: CreatureAI.h:90
bool IsAlive() const
Definition: Unit.h:1692
Unit * GetVictim() const
Definition: Unit.h:1379
CreatureAI * AI() const
Definition: Creature.h:525
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1832
Definition: CreatureAI.h:87
Definition: SpellAuraDefines.h:71
bool isInAccessiblePlaceFor(Creature const *c) const
Definition: Unit.cpp:2956
ThreatManager m_ThreatManager
Definition: Unit.h:2302
Definition: ObjectGuid.h:33
Vehicle * GetVehicle() const
Definition: Unit.h:2166
bool IsFocusing(Spell const *focusSpell=nullptr, bool withDelay=false)
Definition: Creature.cpp:2747
AttackerSet m_attackers
Definition: Unit.h:2255
bool CanCreatureAttack(Unit const *victim, bool force=true) const
Definition: Creature.cpp:2170
Unit * GetOwner() const
Definition: Unit.cpp:7542
Creature * ToCreature()
Definition: Object.h:194
Unit * getAttackerForHelper() const
Definition: Unit.cpp:7211
Definition: SpellAuraDefines.h:78
bool CanSeeOrDetect(WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
Definition: Object.cpp:1940
bool IsSummon() const
Definition: Unit.h:1401
void SetInFront(WorldObject const *target)
Definition: Unit.cpp:15771
Definition: Unit.h:1305
float m_CombatDistance
Definition: Creature.h:704

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::SendAIReaction ( AiReaction  reactionType)
2010 {
2012 
2013  packet.UnitGUID = GetGUID();
2014  packet.Reaction = reactionType;
2015 
2016  SendMessageToSet(packet.Write(), true);
2017 
2018  TC_LOG_DEBUG("network", "WORLD: Sent SMSG_AI_REACTION, type %u.", reactionType);
2019 }
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
WorldPacket const * Write() override
Definition: CombatPackets.cpp:89
ObjectGuid UnitGUID
Definition: CombatPackets.h:129
uint32 Reaction
Definition: CombatPackets.h:130
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: CombatPackets.h:122
virtual void SendMessageToSet(WorldPacket const *data, bool self)
Definition: Object.cpp:2144

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::SendZoneUnderAttackMessage ( Player attacker)

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

2292 {
2293  uint32 enemy_team = attacker->GetTeam();
2295  packet.AreaID = GetAreaId();
2296  sWorld->SendGlobalMessage(packet.Write(), NULL, (enemy_team == ALLIANCE ? HORDE : ALLIANCE));
2297 }
arena_t NULL
Definition: jemalloc_internal.h:624
#define sWorld
Definition: World.h:887
int32 AreaID
Definition: MiscPackets.h:568
Definition: SharedDefines.h:1000
Definition: MiscPackets.h:561
uint32_t uint32
Definition: Define.h:150
uint32 GetAreaId() const
Definition: Object.cpp:1530
WorldPacket const * Write() override
Definition: MiscPackets.cpp:414
Definition: SharedDefines.h:999

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::SetCanDualWield ( bool  value)
overridevirtual

Reimplemented from Unit.

1424 {
1427 }
Definition: Unit.h:618
virtual void SetCanDualWield(bool value)
Definition: Unit.h:1360
virtual void UpdateDamagePhysical(WeaponAttackType attType)
Definition: StatSystem.cpp:60
const FieldDescriptor value
Definition: descriptor.h:1522

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::SetCombatPulseDelay ( uint32  delay)
inline
646  {
647  m_combatPulseDelay = delay;
648  if (m_combatPulseTime == 0 || m_combatPulseTime > delay)
649  m_combatPulseTime = delay;
650  }
uint32 m_combatPulseDelay
Definition: Creature.h:740
uint32 m_combatPulseTime
Definition: Creature.h:739

+ Here is the caller graph for this function:

void Creature::SetCorpseDelay ( uint32  delay)
inline
492 { m_corpseDelay = delay; }
uint32 m_corpseDelay
Definition: Creature.h:736

+ Here is the caller graph for this function:

void Creature::SetCurrentEquipmentId ( uint8  id)
inline
548 { m_equipmentId = id; }
uint8 m_equipmentId
Definition: Creature.h:748

+ Here is the caller graph for this function:

void Creature::setDeathState ( DeathState  s)
overridevirtual

Reimplemented from Unit.

Reimplemented in Pet.

1625 {
1627 
1628  if (s == JUST_DIED)
1629  {
1632 
1633  // always save boss respawn time at death to prevent crash cheating
1634  if (sWorld->getBoolConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY) || isWorldBoss())
1635  SaveRespawnTime();
1636 
1637  ReleaseFocus(); // remove spellcast focus (this also clears unit target)
1638  SetTarget(ObjectGuid::Empty); // drop target - dead mobs shouldn't ever target things
1639 
1641 
1642  SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0); // if creature is mounted on a virtual mount, remove it at death
1643 
1644  setActive(false);
1645 
1646  if (HasSearchedAssistance())
1647  {
1648  SetNoSearchAssistance(false);
1649  UpdateSpeed(MOVE_RUN, false);
1650  }
1651 
1652  //Dismiss group if is leader
1653  if (m_formation && m_formation->getLeader() == this)
1654  m_formation->FormationReset(true);
1655 
1656  if ((CanFly() || IsFlying()))
1658 
1660  }
1661  else if (s == JUST_RESPAWNED)
1662  {
1663  //if (IsPet())
1664  // setActive(true);
1665  SetFullHealth();
1668 
1670 
1672 
1673  if (!IsPet())
1674  {
1676  CreatureTemplate const* cinfo = GetCreatureTemplate();
1677 
1678  uint64 npcflag;
1679  uint32 unit_flags, dynamicflags;
1680  ObjectMgr::ChooseCreatureFlags(cinfo, npcflag, unit_flags, dynamicflags, creatureData);
1681 
1682  SetUInt64Value(UNIT_NPC_FLAGS, npcflag);
1683  SetUInt32Value(UNIT_FIELD_FLAGS, unit_flags);
1684  SetUInt32Value(OBJECT_DYNAMIC_FLAGS, dynamicflags);
1685 
1687 
1689  }
1690 
1694  }
1695 }
Definition: Creature.h:287
uint32 m_corpseDelay
Definition: Creature.h:736
void ResetPlayerDamageReq()
Definition: Creature.h:696
bool IsFlying() const
Definition: Unit.h:2189
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
Definition: Unit.h:542
time_t m_respawnTime
Definition: Creature.h:734
Definition: Unit.h:594
void setActive(bool isActiveObject)
Definition: Object.cpp:1473
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition: Unit.cpp:10378
void Motion_Initialize()
Definition: Creature.cpp:819
MotionMaster * GetMotionMaster()
Definition: Unit.h:2101
Definition: Unit.h:541
CreatureData const * GetCreatureData() const
Definition: Creature.h:559
arena_t NULL
Definition: jemalloc_internal.h:624
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
SpellSchools
Definition: SharedDefines.h:272
bool HasSearchedAssistance() const
Definition: Creature.h:620
ObjectData const creatureData[]
Definition: instance_blackrock_caverns.cpp:22
Creature * getLeader() const
Definition: CreatureGroups.h:71
#define sWorld
Definition: World.h:887
Definition: Unit.h:543
static void ChooseCreatureFlags(CreatureTemplate const *cinfo, uint64 &npcflag, uint32 &unit_flags, uint32 &dynamicflags, CreatureData const *data=NULL)
Definition: ObjectMgr.cpp:1278
void MoveFall(uint32 id=0)
Definition: MotionMaster.cpp:440
void SetLootRecipient(Unit *unit)
Definition: Creature.cpp:993
void ClearUnitState(uint32 f)
Definition: Unit.h:1396
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
void SetMeleeDamageSchool(SpellSchools school)
Definition: Creature.h:528
Definition: Unit.h:692
CreatureGroup * m_formation
Definition: Creature.h:781
time_t m_corpseRemoveTime
Definition: Creature.h:733
Definition: Unit.h:545
uint32_t uint32
Definition: Define.h:150
uint64_t uint64
Definition: Define.h:149
Definition: Unit.h:734
void UpdateMovementFlags()
Definition: Creature.cpp:2623
bool CanFly() const override
Definition: Creature.h:500
bool IsPet() const
Definition: Unit.h:1403
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
Definition: Unit.h:600
uint32 m_respawnDelay
Definition: Creature.h:735
virtual void setDeathState(DeathState s)
Definition: Unit.cpp:10593
void SaveRespawnTime() override
Definition: Creature.cpp:2161
Definition: UpdateFields.h:109
void SetNoSearchAssistance(bool val)
Definition: Creature.h:619
uint32 dmgschool
Definition: Creature.h:103
bool LoadCreaturesAddon()
Definition: Creature.cpp:2214
Definition: UpdateFields.h:135
Definition: UpdateFields.h:30
void SetUInt64Value(uint16 index, uint64 value)
Definition: Object.cpp:1017
void SetFullHealth()
Definition: Unit.h:1440
uint32_t uint32
Definition: g3dmath.h:168
bool isWorldBoss() const
Definition: Creature.cpp:1833
void ReleaseFocus(Spell const *focusSpell=nullptr, bool withDelay=true)
Definition: Creature.cpp:2772
Definition: UpdateFields.h:119
Definition: Unit.h:577
Definition: Creature.h:79
void SetTarget(ObjectGuid const &guid) override
Definition: Creature.cpp:2675
void FormationReset(bool dismiss)
Definition: CreatureGroups.cpp:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::SetDefaultMovementType ( MovementGeneratorType  mgt)
inline
625 { m_defaultMovementType = mgt; }
MovementGeneratorType m_defaultMovementType
Definition: Creature.h:746

+ Here is the caller graph for this function:

void Creature::SetDisableReputationGain ( bool  disable)
inline
692 { DisableReputationGain = disable; }
bool DisableReputationGain
Definition: Creature.h:762

+ Here is the caller graph for this function:

void Creature::SetDisplayId ( uint32  modelId)
overridevirtual

Reimplemented from Unit.

Reimplemented in Pet.

2665 {
2666  Unit::SetDisplayId(modelId);
2667 
2668  if (CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelInfo(modelId))
2669  {
2670  SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, minfo->bounding_radius * GetObjectScale());
2671  SetFloatValue(UNIT_FIELD_COMBATREACH, minfo->combat_reach * GetObjectScale());
2672  }
2673 }
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: UpdateFields.h:115
Definition: Creature.h:317
virtual void SetDisplayId(uint32 modelId)
Definition: Unit.cpp:12799
Definition: UpdateFields.h:116
void SetFloatValue(uint16 index, float value)
Definition: Object.cpp:1067
float GetObjectScale() const
Definition: Object.h:110

+ Here is the call graph for this function:

void Creature::SetFormation ( CreatureGroup formation)
inline
688 { m_formation = formation; }
CreatureGroup * m_formation
Definition: Creature.h:781

+ Here is the caller graph for this function:

void Creature::SetHomePosition ( float  x,
float  y,
float  z,
float  o 
)
inline
670 { m_homePosition.Relocate(x, y, z, o); }
Position m_homePosition
Definition: Creature.h:759
void Relocate(float x, float y)
Definition: Position.h:67
G3D::int16 z
Definition: Vector3int16.h:46
G3D::int16 y
Definition: Vector2int16.h:38
G3D::int16 x
Definition: Vector2int16.h:37
void Creature::SetHomePosition ( const Position pos)
inline
671 { m_homePosition.Relocate(pos); }
Position m_homePosition
Definition: Creature.h:759
void Relocate(float x, float y)
Definition: Position.h:67
void Creature::SetInCombatWithZone ( )
2300 {
2301  if (!CanHaveThreatList())
2302  {
2303  TC_LOG_ERROR("entities.unit", "Creature entry %u call SetInCombatWithZone but creature cannot have threat list.", GetEntry());
2304  return;
2305  }
2306 
2307  Map* map = GetMap();
2308 
2309  if (!map->IsDungeon())
2310  {
2311  TC_LOG_ERROR("entities.unit", "Creature entry %u call SetInCombatWithZone for map (id: %u) that isn't an instance.", GetEntry(), map->GetId());
2312  return;
2313  }
2314 
2315  Map::PlayerList const &PlList = map->GetPlayers();
2316 
2317  if (PlList.isEmpty())
2318  return;
2319 
2320  for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i)
2321  {
2322  if (Player* player = i->GetSource())
2323  {
2324  if (player->IsGameMaster())
2325  continue;
2326 
2327  if (player->IsAlive())
2328  {
2329  this->SetInCombatWith(player);
2330  player->SetInCombatWith(this);
2331  AddThreat(player, 0.0f);
2332  }
2333  }
2334  }
2335 }
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=NULL)
Definition: Unit.cpp:10691
Map * GetMap() const
Definition: Object.h:543
bool IsDungeon() const
Definition: Map.h:395
iterator begin()
Definition: MapRefManager.h:37
bool CanHaveThreatList(bool skipAliveCheck=false) const
Definition: Unit.cpp:10652
uint32 GetId(void) const
Definition: Map.h:325
Definition: LinkedList.h:141
bool isEmpty() const
Definition: LinkedList.h:102
Definition: Map.h:259
PlayerList const & GetPlayers() const
Definition: Map.h:433
Definition: MapRefManager.h:26
uint32 GetEntry() const
Definition: Object.h:107
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
iterator end()
Definition: MapRefManager.h:38
void SetInCombatWith(Unit *enemy)
Definition: Unit.cpp:9840

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::SetLootMode ( uint16  lootMode)
inline
594 { m_LootMode = lootMode; }
uint16 m_LootMode
Definition: Creature.h:767

+ Here is the caller graph for this function:

void Creature::SetLootRecipient ( Unit unit)
994 {
995  // set the player whose group should receive the right
996  // to loot the creature after it dies
997  // should be set to NULL after the loot disappears
998 
999  if (!unit)
1000  {
1004  return;
1005  }
1006 
1007  if (unit->GetTypeId() != TYPEID_PLAYER && !unit->IsVehicle())
1008  return;
1009 
1011  if (!player) // normal creature, no player involved
1012  return;
1013 
1014  m_lootRecipient = player->GetGUID();
1015  if (Group* group = player->GetGroup())
1016  m_lootRecipientGroup = group->GetGUID();
1017 
1019 }
bool IsVehicle() const
Definition: Unit.h:1406
ObjectGuid m_lootRecipient
Definition: Creature.h:727
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
TypeID GetTypeId() const
Definition: Object.h:113
Definition: SharedDefines.h:4201
void Clear()
Definition: ObjectGuid.h:215
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
Definition: SharedDefines.h:4203
Definition: ObjectGuid.h:33
ObjectGuid m_lootRecipientGroup
Definition: Creature.h:728
Definition: UpdateFields.h:30
Definition: Group.h:191
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition: Unit.cpp:7560

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::SetMeleeDamageSchool ( SpellSchools  school)
inline
528 { m_meleeDamageSchoolMask = SpellSchoolMask(1 << school); }
SpellSchoolMask
Definition: SharedDefines.h:285
SpellSchoolMask m_meleeDamageSchoolMask
Definition: Creature.h:756

+ Here is the caller graph for this function:

void Creature::SetNoCallAssistance ( bool  val)
inline
618 { m_AlreadyCallAssistance = val; }
bool m_AlreadyCallAssistance
Definition: Creature.h:751

+ Here is the caller graph for this function:

void Creature::SetNoSearchAssistance ( bool  val)
inline
bool m_AlreadySearchedAssistance
Definition: Creature.h:752

+ Here is the caller graph for this function:

void Creature::SetObjectScale ( float  scale)
overridevirtual

Reimplemented from Object.

2654 {
2655  Unit::SetObjectScale(scale);
2656 
2657  if (CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelInfo(GetDisplayId()))
2658  {
2659  SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, minfo->bounding_radius * scale);
2660  SetFloatValue(UNIT_FIELD_COMBATREACH, minfo->combat_reach * scale);
2661  }
2662 }
uint32 GetDisplayId() const
Definition: Unit.h:2012
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: UpdateFields.h:115
Definition: Creature.h:317
Definition: UpdateFields.h:116
virtual void SetObjectScale(float scale)
Definition: Object.h:111
void SetFloatValue(uint16 index, float value)
Definition: Object.cpp:1067

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::SetOriginalEntry ( uint32  entry)
inline
700 { m_originalEntry = entry; }
uint32 m_originalEntry
Definition: Creature.h:757

+ Here is the caller graph for this function:

void Creature::SetPosition ( float  x,
float  y,
float  z,
float  o 
)
2538 {
2539  // prevent crash when a bad coord is sent by the client
2540  if (!Trinity::IsValidMapCoord(x, y, z, o))
2541  {
2542  TC_LOG_DEBUG("entities.unit", "Creature::SetPosition(%f, %f, %f) .. bad coordinates!", x, y, z);
2543  return;
2544  }
2545 
2546  GetMap()->CreatureRelocation(this, x, y, z, o);
2547  if (IsVehicle())
2549 }
void CreatureRelocation(Creature *creature, float x, float y, float z, float ang, bool respawnRelocationOnFail=true)
Definition: Map.cpp:982
void RelocatePassengers()
Relocate passengers. Must be called after m_base::Relocate.
Definition: Vehicle.cpp:520
Map * GetMap() const
Definition: Object.h:543
bool IsVehicle() const
Definition: Unit.h:1406
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
bool IsValidMapCoord(float c)
Definition: GridDefines.h:218
G3D::int16 z
Definition: Vector3int16.h:46
G3D::int16 y
Definition: Vector2int16.h:38
G3D::int16 x
Definition: Vector2int16.h:37
Vehicle * GetVehicleKit() const
Definition: Unit.h:2165

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::SetPosition ( const Position pos)
inline
668 { SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); }
void SetPosition(float x, float y, float z, float o)
Definition: Creature.cpp:2537
float GetOrientation() const
Definition: Position.h:107
float GetPositionY() const
Definition: Position.h:105
float GetPositionZ() const
Definition: Position.h:106
float GetPositionX() const
Definition: Position.h:104

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::SetReactState ( ReactStates  st)
inline
502 { m_reactState = st; }
ReactStates m_reactState
Definition: Creature.h:742
void Creature::setRegeneratingHealth ( bool  regenHealth)
inline
663 { m_regenHealth = regenHealth; }
bool m_regenHealth
Definition: Creature.h:753

+ Here is the caller graph for this function:

void Creature::SetRespawnDelay ( uint32  delay)
inline
638 { m_respawnDelay = delay; }
uint32 m_respawnDelay
Definition: Creature.h:735

+ Here is the caller graph for this function:

void Creature::SetRespawnRadius ( float  dist)
inline
641 { m_respawnradius = dist; }
float m_respawnradius
Definition: Creature.h:737

+ Here is the caller graph for this function:

void Creature::SetRespawnTime ( uint32  respawn)
inline
633 { m_respawnTime = respawn ? time(NULL) + respawn : 0; }
time_t m_respawnTime
Definition: Creature.h:734
arena_t NULL
Definition: jemalloc_internal.h:624

+ Here is the caller graph for this function:

void Creature::SetSkinner ( ObjectGuid  guid)
inline
582 { _skinner = guid; }
ObjectGuid _skinner
Definition: Creature.h:729
void Creature::SetTarget ( ObjectGuid const guid)
overridevirtual

Implements Unit.

2676 {
2677  if (!IsFocusing())
2679 }
Definition: UpdateFields.h:89
void SetGuidValue(uint16 index, ObjectGuid const &value)
Definition: Object.cpp:1120
bool IsFocusing(Spell const *focusSpell=nullptr, bool withDelay=false)
Definition: Creature.cpp:2747

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::SetTextRepeatId ( uint8  textGroup,
uint8  id 
)
2796 {
2797  CreatureTextRepeatIds& repeats = m_textRepeat[textGroup];
2798  if (std::find(repeats.begin(), repeats.end(), id) == repeats.end())
2799  repeats.push_back(id);
2800  else
2801  TC_LOG_ERROR("sql.sql", "CreatureTextMgr: TextGroup %u for Creature (%s) %s, id %u already added", uint32(textGroup), GetName().c_str(), GetGUID().ToString().c_str(), uint32(id));
2802 }
std::string const & GetName() const
Definition: Object.h:479
std::vector< uint8 > CreatureTextRepeatIds
Definition: Creature.h:464
CreatureTextRepeatGroup m_textRepeat
Definition: Creature.h:787
std::string ToString() const
Definition: Position.cpp:160
ObjectGuid const & GetGUID() const
Definition: Object.h:105
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::SetTransportHomePosition ( float  x,
float  y,
float  z,
float  o 
)
inline
Position m_transportHomePosition
Definition: Creature.h:760
void Relocate(float x, float y)
Definition: Position.h:67
G3D::int16 z
Definition: Vector3int16.h:46
G3D::int16 y
Definition: Vector2int16.h:38
G3D::int16 x
Definition: Vector2int16.h:37

+ Here is the caller graph for this function:

void Creature::SetTransportHomePosition ( const Position pos)
inline
Position m_transportHomePosition
Definition: Creature.h:760
void Relocate(float x, float y)
Definition: Position.h:67
void Creature::StartPickPocketRefillTimer ( )
2791 {
2793 }
Definition: World.h:368
arena_t NULL
Definition: jemalloc_internal.h:624
#define sWorld
Definition: World.h:887
time_t _pickpocketLootRestore
Timers.
Definition: Creature.h:732
void Creature::Update ( uint32  time)
overridevirtual

Reimplemented from Unit.

Reimplemented in Puppet, Pet, TempSummon, and Totem.

495 {
497  {
498  TriggerJustRespawned = false;
499  AI()->JustRespawned();
500  if (m_vehicleKit)
501  m_vehicleKit->Reset();
502  }
503 
505 
506  switch (m_deathState)
507  {
508  case JUST_RESPAWNED:
509  // Must not be called, see Creature::setDeathState JUST_RESPAWNED -> ALIVE promoting.
510  TC_LOG_ERROR("entities.unit", "Creature (%s) in wrong state: JUST_RESPAWNED (4)", GetGUID().ToString().c_str());
511  break;
512  case JUST_DIED:
513  // Must not be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting.
514  TC_LOG_ERROR("entities.unit", "Creature (%s) in wrong state: JUST_DEAD (1)", GetGUID().ToString().c_str());
515  break;
516  case DEAD:
517  {
518  time_t now = time(NULL);
519  if (m_respawnTime <= now)
520  {
521  bool allowed = IsAIEnabled ? AI()->CanRespawn() : true; // First check if there are any scripts that object to us respawning
522  if (!allowed) // Will be rechecked on next Update call
523  break;
524 
525  ObjectGuid dbtableHighGuid = ObjectGuid::Create<HighGuid::Creature>(GetMapId(), GetEntry(), m_spawnId);
526  time_t linkedRespawntime = GetMap()->GetLinkedRespawnTime(dbtableHighGuid);
527  if (!linkedRespawntime) // Can respawn
528  Respawn();
529  else // the master is dead
530  {
531  ObjectGuid targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid);
532  if (targetGuid == dbtableHighGuid) // if linking self, never respawn (check delayed to next day)
534  else
535  m_respawnTime = (now > linkedRespawntime ? now : linkedRespawntime) + urand(5, MINUTE); // else copy time from master and add a little
536  SaveRespawnTime(); // also save to DB immediately
537  }
538  }
539  break;
540  }
541  case CORPSE:
542  {
543  Unit::Update(diff);
544  // deathstate changed on spells update, prevent problems
545  if (m_deathState != CORPSE)
546  break;
547 
549  {
550  if (m_groupLootTimer <= diff)
551  {
552  if (Group* group = sGroupMgr->GetGroupByGUID(lootingGroupLowGUID))
553  group->EndRoll(&loot);
554 
555  m_groupLootTimer = 0;
557  }
558  else
559  m_groupLootTimer -= diff;
560  }
561  else if (m_corpseRemoveTime <= time(NULL))
562  {
563  RemoveCorpse(false);
564  TC_LOG_DEBUG("entities.unit", "Removing corpse... %u ", GetUInt32Value(OBJECT_FIELD_ENTRY));
565  }
566  break;
567  }
568  case ALIVE:
569  {
570  Unit::Update(diff);
571 
572  // creature can be dead after Unit::Update call
573  // CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly)
574  if (!IsAlive())
575  break;
576 
577  // if creature is charmed, switch to charmed AI (and back)
578  if (NeedChangeAI)
579  {
580  UpdateCharmAI();
581  NeedChangeAI = false;
582  IsAIEnabled = true;
584  if (Unit* charmer = ObjectAccessor::GetUnit(*this, LastCharmerGUID))
585  i_AI->AttackStart(charmer);
586 
588  }
589 
590  // periodic check to see if the creature has passed an evade boundary
591  if (IsAIEnabled && !IsInEvadeMode() && IsInCombat())
592  {
593  if (diff >= m_boundaryCheckTime)
594  {
595  AI()->CheckInRoom();
596  m_boundaryCheckTime = 2500;
597  } else
598  m_boundaryCheckTime -= diff;
599  }
600 
601  // if periodic combat pulse is enabled and we are both in combat and in a dungeon, do this now
602  if (m_combatPulseDelay > 0 && IsInCombat() && GetMap()->IsDungeon())
603  {
604  if (diff > m_combatPulseTime)
605  m_combatPulseTime = 0;
606  else
607  m_combatPulseTime -= diff;
608 
609  if (m_combatPulseTime == 0)
610  {
611  Map::PlayerList const &players = GetMap()->GetPlayers();
612  if (!players.isEmpty())
613  for (Map::PlayerList::const_iterator it = players.begin(); it != players.end(); ++it)
614  {
615  if (Player* player = it->GetSource())
616  {
617  if (player->IsGameMaster())
618  continue;
619 
620  if (player->IsAlive() && this->IsHostileTo(player))
621  {
622  if (CanHaveThreatList())
623  AddThreat(player, 0.0f);
624  this->SetInCombatWith(player);
625  player->SetInCombatWith(this);
626  }
627  }
628  }
629 
631  }
632  }
633 
634  if (!IsInEvadeMode() && IsAIEnabled)
635  {
636  // do not allow the AI to be changed during update
637  m_AI_locked = true;
638 
639  i_AI->UpdateAI(diff);
640  m_AI_locked = false;
641  }
642 
643  // creature can be dead after UpdateAI call
644  // CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly)
645  if (!IsAlive())
646  break;
647 
648  if (m_regenTimer > 0)
649  {
650  if (diff >= m_regenTimer)
651  m_regenTimer = 0;
652  else
653  m_regenTimer -= diff;
654  }
655 
656  if (m_regenTimer != 0)
657  break;
658 
659  bool bInCombat = IsInCombat() && (!GetVictim() || // if IsInCombat() is true and this has no victim
660  !EnsureVictim()->GetCharmerOrOwnerPlayerOrPlayerItself() || // or the victim/owner/charmer is not a player
661  !EnsureVictim()->GetCharmerOrOwnerPlayerOrPlayerItself()->IsGameMaster()); // or the victim/owner/charmer is not a GameMaster
662 
663  /*if (m_regenTimer <= diff)
664  {*/
665  if (!IsInEvadeMode() && (!bInCombat || IsPolymorphed())) // regenerate health if not in combat or if polymorphed
667 
669  {
670  if (getPowerType() == POWER_ENERGY)
672  else
673  RegenerateMana();
674  }
675 
676  /*if (!bIsPolymorphed) // only increase the timer if not polymorphed
677  m_regenTimer += CREATURE_REGEN_INTERVAL - diff;
678  }
679  else
680  if (!bIsPolymorphed) // if polymorphed, skip the timer
681  m_regenTimer -= diff;*/
683  break;
684  }
685  default:
686  break;
687  }
688 
689  sScriptMgr->OnCreatureUpdate(this, diff);
690 }
Unit * EnsureVictim() const
Definition: Unit.h:1381
void SetRespawnTime(uint32 respawn)
Definition: Creature.h:633
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=NULL)
Definition: Unit.cpp:10691
Definition: Unit.h:544
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
uint32 m_boundaryCheckTime
Definition: Creature.h:738
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:163
Map * GetMap() const
Definition: Object.h:543
ObjectGuid lootingGroupLowGUID
Definition: Creature.h:653
Definition: Unit.h:542
time_t m_respawnTime
Definition: Creature.h:734
bool IsInCombat() const
Definition: Unit.h:1584
Loot loot
Definition: Creature.h:578
Vehicle * m_vehicleKit
Definition: Unit.h:2305
Definition: Unit.h:541
Definition: Unit.h:721
arena_t NULL
Definition: jemalloc_internal.h:624
virtual void JustRespawned()
Definition: CreatureAI.h:140
bool IsInEvadeMode() const
Definition: Creature.h:520
void UpdateCharmAI()
Definition: Unit.cpp:11809
Definition: UpdateFields.h:110
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
virtual void UpdateAI(uint32 diff)=0
Definition: Unit.h:543
iterator begin()
Definition: MapRefManager.h:37
bool IsAIEnabled
Definition: Unit.h:2161
time_t GetLinkedRespawnTime(ObjectGuid guid) const
Definition: Map.cpp:3684
#define sObjectMgr
Definition: ObjectMgr.h:1567
bool CanHaveThreatList(bool skipAliveCheck=false) const
Definition: Unit.cpp:10652
Definition: Common.h:97
uint32 m_combatPulseDelay
Definition: Creature.h:740
UnitAI * i_AI
Definition: Unit.h:2242
Powers getPowerType() const
Definition: Unit.h:1444
Definition: UpdateFields.h:29
time_t m_corpseRemoveTime
Definition: Creature.h:733
#define CREATURE_REGEN_INTERVAL
Definition: Creature.h:70
Definition: Unit.h:545
bool IsAlive() const
Definition: Unit.h:1692
Unit * GetVictim() const
Definition: Unit.h:1379
virtual void Update(uint32 time) override
Definition: Unit.cpp:361
DeathState m_deathState
Definition: Unit.h:2259
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
std::string ToString() const
Definition: Position.cpp:160
Definition: Common.h:99
CreatureAI * AI() const
Definition: Creature.h:525
#define sGroupMgr
Definition: GroupMgr.h:59
Definition: LinkedList.h:141
bool m_AI_locked
Definition: Creature.h:754
void Reset(bool evading=false)
Reapplies immunities and reinstalls accessories. Only has effect for creatures.
Definition: Vehicle.cpp:141
virtual bool CheckInRoom()
Definition: CreatureAI.cpp:366
uint32 m_combatPulseTime
Definition: Creature.h:739
uint32 GetMapId() const
Definition: Position.h:254
bool isEmpty() const
Definition: LinkedList.h:102
bool NeedChangeAI
Definition: Unit.h:2161
void UpdateMovementFlags()
Definition: Creature.cpp:2623
bool TriggerJustRespawned
Definition: Creature.h:782
void Clear()
Definition: ObjectGuid.h:215
void RegenerateMana()
Definition: Creature.cpp:692
PlayerList const & GetPlayers() const
Definition: Map.h:433
void Respawn(bool force=false)
Definition: Creature.cpp:1697
ObjectGuid const & GetGUID() const
Definition: Object.h:105
void RegenerateHealth()
Definition: Creature.cpp:724
virtual bool CanRespawn()
Definition: CreatureAI.h:108
Definition: MapRefManager.h:26
void SaveRespawnTime() override
Definition: Creature.cpp:2161
Definition: SharedDefines.h:251
void Regenerate(Powers power)
Definition: Pet.cpp:633
uint32 m_groupLootTimer
Definition: Creature.h:652
Definition: Common.h:103
bool IsPolymorphed() const
Definition: Unit.cpp:12786
bool IsHostileTo(Unit const *unit) const
Definition: Unit.cpp:7165
void RemoveCorpse(bool setSpawnTime=true)
Definition: Creature.cpp:280
ObjectGuid::LowType m_spawnId
For new or temporary creatures is 0 for saved it is lowguid.
Definition: Creature.h:747
#define sScriptMgr
Definition: ScriptMgr.h:837
uint32 GetEntry() const
Definition: Object.h:107
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: ObjectGuid.h:189
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.cpp:1239
Definition: Unit.h:1305
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:29
bool IsEmpty() const
Definition: ObjectGuid.h:242
iterator end()
Definition: MapRefManager.h:38
void SetInCombatWith(Unit *enemy)
Definition: Unit.cpp:9840
Definition: Group.h:191
uint32 m_regenTimer
Definition: Unit.h:2300
ObjectGuid LastCharmerGUID
Definition: Unit.h:2162
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition: Unit.cpp:7560

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Creature::UpdateAllStats ( )
overridevirtual

Implements Unit.

Reimplemented in Guardian, and Totem.

834 {
835  UpdateMaxHealth();
838 
839  for (uint8 i = POWER_MANA; i < MAX_POWERS; ++i)
841 
843 
844  return true;
845 }
void UpdateAttackPowerAndDamage(bool ranged=false) override
Definition: StatSystem.cpp:878
void UpdateMaxHealth() override
Definition: StatSystem.cpp:864
Powers
Definition: SharedDefines.h:246
uint8_t uint8
Definition: Define.h:152
Definition: SharedDefines.h:265
void UpdateMaxPower(Powers power) override
Definition: StatSystem.cpp:870
virtual void UpdateAllResistances()
Definition: StatSystem.cpp:54
Definition: SharedDefines.h:248

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::UpdateArmor ( )
overridevirtual

Implements Unit.

Reimplemented in Guardian, and Totem.

859 {
861  SetArmor(int32(value));
862 }
void SetArmor(int32 val)
Definition: Unit.h:1420
int32_t int32
Definition: g3dmath.h:167
const FieldDescriptor value
Definition: descriptor.h:1522
float GetTotalAuraModValue(UnitMods unitMod) const
Definition: Unit.cpp:11419
Definition: Unit.h:501

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Implements Unit.

Reimplemented in Guardian, and Totem.

879 {
881 
884 
885  if (ranged)
886  {
889  }
890 
891  float baseAttackPower = GetModifierValue(unitMod, BASE_VALUE) * GetModifierValue(unitMod, BASE_PCT);
892  float attackPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f;
893 
894  SetInt32Value(index, uint32(baseAttackPower)); // UNIT_FIELD_(RANGED)_ATTACK_POWER
895  SetFloatValue(indexMulti, attackPowerMultiplier); // UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER
896 
897  // automatically update weapon damage after attack power modification
898  if (ranged)
900  else
901  {
904  }
905 }
Definition: UpdateFields.h:150
UnitMods
Definition: Unit.h:482
Definition: Unit.h:619
void SetInt32Value(uint16 index, int32 value)
Definition: Object.cpp:983
Definition: Unit.h:434
Definition: Unit.h:508
Definition: UpdateFields.h:151
Definition: Unit.h:618
Definition: UpdateFields.h:154
uint16_t uint16
Definition: Define.h:151
float GetModifierValue(UnitMods unitMod, UnitModifierType modifierType) const
Definition: Unit.cpp:11388
Definition: UpdateFields.h:147
Definition: Unit.h:438
virtual void UpdateDamagePhysical(WeaponAttackType attType)
Definition: StatSystem.cpp:60
void SetFloatValue(uint16 index, float value)
Definition: Object.cpp:1067
Definition: Unit.h:509
Definition: Unit.h:436
uint32_t uint32
Definition: g3dmath.h:168
Definition: Unit.h:617

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Creature::UpdateEntry ( uint32  entry,
CreatureData const data = nullptr 
)
Todo:
Why is this treated as uint32 when it's a float?
408 {
409  if (!InitEntry(entry, data))
410  return false;
411 
412  CreatureTemplate const* cInfo = GetCreatureTemplate();
413 
414  m_regenHealth = cInfo->RegenHealth;
415 
416  // creatures always have melee weapon ready if any unless specified otherwise
417  if (!GetCreatureAddon())
419 
420  setFaction(cInfo->faction);
421 
422  uint32 unit_flags, dynamicflags;
423  uint64 npcflag;
424  ObjectMgr::ChooseCreatureFlags(cInfo, npcflag, unit_flags, dynamicflags, data);
425 
427  SetUInt64Value(UNIT_NPC_FLAGS, npcflag | sGameEventMgr->GetNPCFlag(this));
428  else
429  SetUInt64Value(UNIT_NPC_FLAGS, npcflag);
430 
431  SetUInt32Value(UNIT_FIELD_FLAGS, unit_flags);
433 
434  SetUInt32Value(OBJECT_DYNAMIC_FLAGS, dynamicflags);
435 
437 
441 
442  SelectLevel();
443 
445  CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(getLevel(), cInfo->unit_class);
446  float armor = (float)stats->GenerateArmor(cInfo);
454 
455  SetCanModifyStats(true);
456  UpdateAllStats();
457 
458  // checked and error show at loading templates
459  if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->faction))
460  {
461  if (factionTemplate->Flags & FACTION_TEMPLATE_FLAG_PVP)
462  SetPvP(true);
463  else
464  SetPvP(false);
465  }
466 
467  // updates spell bars for vehicles and set player's faction - should be called here, to overwrite faction that is set from the new template
468  if (IsVehicle())
469  {
470  if (Player* owner = Creature::GetCharmerOrOwnerPlayerOrPlayerItself()) // this check comes in case we don't have a player
471  {
472  setFaction(owner->getFaction()); // vehicles should have same as owner faction
473  owner->VehicleSpellInitialize();
474  }
475  }
476 
477  // trigger creature is always not selectable and can not be attacked
478  if (IsTrigger())
480 
482 
484  {
487  }
488 
491  return true;
492 }
bool RegenHealth
Definition: Creature.h:140
Definition: Unit.h:502
bool IsVehicle() const
Definition: Unit.h:1406
CreatureAddon const * GetCreatureAddon() const
Definition: Creature.cpp:2201
void SetModifierValue(UnitMods unitMod, UnitModifierType modifierType, float value)
Definition: Unit.h:1952
void SetAttackTime(WeaponAttackType att, uint32 val)
Definition: Unit.h:1458
Definition: Unit.h:619
void InitializeReactState()
Definition: Creature.cpp:926
Definition: Creature.h:50
Definition: SharedDefines.h:1861
Definition: Unit.h:434
Definition: SharedDefines.h:1124
Definition: SharedDefines.h:278
Definition: SharedDefines.h:277
void SetCanModifyStats(bool modifyStats)
Definition: Unit.h:1960
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
uint32 GenerateArmor(CreatureTemplate const *info) const
Definition: Creature.h:243
SpellSchools
Definition: SharedDefines.h:272
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition: Unit.cpp:9615
bool IsTrigger() const
Definition: Creature.h:496
Definition: UpdateFields.h:110
uint32 flags_extra
Definition: Creature.h:142
bool InitEntry(uint32 entry, CreatureData const *data=nullptr)
Definition: Creature.cpp:307
bool UpdateAllStats() override
Definition: StatSystem.cpp:833
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32 faction
Definition: Creature.h:97
Definition: SharedDefines.h:275
static void ChooseCreatureFlags(CreatureTemplate const *cinfo, uint64 &npcflag, uint32 &unit_flags, uint32 &dynamicflags, CreatureData const *data=NULL)
Definition: ObjectMgr.cpp:1278
uint8 getLevel() const
Definition: Unit.h:1408
uint32 unit_flags2
Definition: Creature.h:110
void setFaction(uint32 faction)
Definition: Unit.h:1467
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
void SetMeleeDamageSchool(SpellSchools school)
Definition: Creature.h:528
Definition: Unit.h:692
Definition: SharedDefines.h:280
Definition: Unit.h:618
Definition: SharedDefines.h:276
Definition: Unit.h:504
Definition: Unit.h:503
Definition: Creature.h:51
bool m_regenHealth
Definition: Creature.h:753
uint32_t uint32
Definition: Define.h:150
uint64_t uint64
Definition: Define.h:149
Definition: SpellAuraDefines.h:71
virtual void SetSheath(SheathState sheathed)
Definition: Unit.h:1463
int32 resistance[MAX_SPELL_SCHOOL]
Definition: Creature.h:122
void UpdateMovementFlags()
Definition: Creature.cpp:2623
Definition: DBCStructure.h:433
Definition: SharedDefines.h:279
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
uint32 RangeAttackTime
Definition: Creature.h:105
#define sGameEventMgr
Definition: GameEventMgr.h:184
void SelectLevel()
Definition: Creature.cpp:1154
Definition: UpdateFields.h:109
Definition: Unit.h:506
uint32 BaseAttackTime
Definition: Creature.h:104
Definition: Unit.h:507
uint32 dmgschool
Definition: Creature.h:103
virtual void SetPvP(bool state)
Definition: Unit.cpp:14455
bool LoadCreaturesAddon()
Definition: Creature.cpp:2214
Definition: UpdateFields.h:135
Definition: UpdateFields.h:30
Definition: DBCEnums.h:462
void SetUInt64Value(uint16 index, uint64 value)
Definition: Object.cpp:1017
Definition: Unit.h:505
Definition: SharedDefines.h:1860
Definition: Unit.h:299
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplatefmt)
uint32 unit_class
Definition: Creature.h:108
Definition: Unit.h:698
Definition: Creature.h:79
Definition: Unit.h:501
Definition: Unit.h:617
Definition: Creature.h:218
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition: Unit.cpp:7560

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::UpdateMaxHealth ( )
overridevirtual

Implements Unit.

Reimplemented in Guardian, and Totem.

865 {
867  SetMaxHealth(uint32(value));
868 }
void SetMaxHealth(uint32 val)
Definition: Unit.cpp:11565
Definition: Unit.h:489
const FieldDescriptor value
Definition: descriptor.h:1522
uint32_t uint32
Definition: g3dmath.h:168
float GetTotalAuraModValue(UnitMods unitMod) const
Definition: Unit.cpp:11419

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::UpdateMaxPower ( Powers  power)
overridevirtual

Implements Unit.

Reimplemented in Guardian, and Totem.

871 {
872  UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
873 
874  float value = GetTotalAuraModValue(unitMod);
875  SetMaxPower(power, uint32(value));
876 }
UnitMods
Definition: Unit.h:482
Definition: Unit.h:519
void SetMaxPower(Powers power, int32 val)
Definition: Unit.cpp:11641
const FieldDescriptor value
Definition: descriptor.h:1522
uint32_t uint32
Definition: g3dmath.h:168
float GetTotalAuraModValue(UnitMods unitMod) const
Definition: Unit.cpp:11419

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::UpdateMovementFlags ( )
2624 {
2625  // Do not update movement flags if creature is controlled by a player (charm/vehicle)
2626  if (m_movedPlayer)
2627  return;
2628 
2629  // Set the movement flags if the creature is in that mode. (Only fly if actually in air, only swim if in water, etc)
2631 
2632  bool isInAir = (G3D::fuzzyGt(GetPositionZMinusOffset(), ground + 0.05f) || G3D::fuzzyLt(GetPositionZMinusOffset(), ground - 0.05f)); // Can be underground too, prevent the falling
2633 
2634  if (GetCreatureTemplate()->InhabitType & INHABIT_AIR && isInAir && !IsFalling())
2635  {
2637  SetCanFly(true);
2638  else
2639  SetDisableGravity(true);
2640  }
2641  else
2642  {
2643  SetCanFly(false);
2644  SetDisableGravity(false);
2645  }
2646 
2647  if (!isInAir)
2648  SetFall(false);
2649 
2650  SetSwim(GetCreatureTemplate()->InhabitType & INHABIT_WATER && IsInWater());
2651 }
Map * GetMap() const
Definition: Object.h:543
uint32 InhabitType
Definition: Creature.h:129
Definition: Creature.h:332
float GetHeight(float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
Definition: Map.cpp:2314
Definition: Creature.h:333
bool SetDisableGravity(bool disable, bool packetOnly=false)
Definition: Unit.cpp:15818
bool SetSwim(bool enable)
Definition: Unit.cpp:15880
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
uint32 GetPhaseMask() const
Definition: Object.h:461
bool IsFalling() const
Definition: Unit.cpp:15402
float GetPositionY() const
Definition: Position.h:105
bool SetCanFly(bool enable)
Definition: Unit.cpp:15899
virtual bool IsInWater() const
Definition: Unit.cpp:2964
Definition: Creature.h:331
bool fuzzyGt(double a, double b)
Definition: g3dmath.h:865
float GetPositionX() const
Definition: Position.h:104
bool SetFall(bool enable)
Definition: Unit.cpp:15864
Player * m_movedPlayer
Definition: Unit.h:1753
bool fuzzyLt(double a, double b)
Definition: g3dmath.h:873
float GetPositionZMinusOffset() const
Definition: Unit.cpp:13799

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Creature::UpdateResistances ( uint32  school)
overridevirtual

Implements Unit.

Reimplemented in Guardian, and Totem.

848 {
849  if (school > SPELL_SCHOOL_NORMAL)
850  {
852  SetResistance(SpellSchools(school), int32(value));
853  }
854  else
855  UpdateArmor();
856 }
UnitMods
Definition: Unit.h:482
Definition: Unit.h:517
SpellSchools
Definition: SharedDefines.h:272
void SetResistance(SpellSchools school, int32 val)
Definition: Unit.h:1424
Definition: SharedDefines.h:274
void UpdateArmor() override
Definition: StatSystem.cpp:858
int32_t int32
Definition: g3dmath.h:167
const FieldDescriptor value
Definition: descriptor.h:1522
float GetTotalAuraModValue(UnitMods unitMod) const
Definition: Unit.cpp:11419

+ Here is the call graph for this function:

bool Creature::UpdateStats ( Stats  stat)
overridevirtual

Implements Unit.

Reimplemented in Guardian, and Totem.

829 {
830  return true;
831 }
uint32 Creature::UpdateVendorItemCurrentCount ( VendorItem const vItem,
uint32  used_count 
)
2472 {
2473  if (!vItem->maxcount)
2474  return 0;
2475 
2476  VendorItemCounts::iterator itr = m_vendorItemCounts.begin();
2477  for (; itr != m_vendorItemCounts.end(); ++itr)
2478  if (itr->itemId == vItem->item)
2479  break;
2480 
2481  if (itr == m_vendorItemCounts.end())
2482  {
2483  uint32 new_count = vItem->maxcount > used_count ? vItem->maxcount-used_count : 0;
2484  m_vendorItemCounts.push_back(VendorItemCount(vItem->item, new_count));
2485  return new_count;
2486  }
2487 
2488  VendorItemCount* vCount = &*itr;
2489 
2490  time_t ptime = time(NULL);
2491 
2492  if (time_t(vCount->lastIncrementTime + vItem->incrtime) <= ptime)
2493  if (ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(vItem->item))
2494  {
2495  uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime);
2496  if ((vCount->count + diff * pProto->GetBuyCount()) < vItem->maxcount)
2497  vCount->count += diff * pProto->GetBuyCount();
2498  else
2499  vCount->count = vItem->maxcount;
2500  }
2501 
2502  vCount->count = vCount->count > used_count ? vCount->count-used_count : 0;
2503  vCount->lastIncrementTime = ptime;
2504  return vCount->count;
2505 }
arena_t NULL
Definition: jemalloc_internal.h:624
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32_t uint32
Definition: Define.h:150
Definition: Creature.h:410
VendorItemCounts m_vendorItemCounts
Definition: Creature.h:723
Definition: ItemTemplate.h:647
uint32_t uint32
Definition: g3dmath.h:168
time_t lastIncrementTime
Definition: Creature.h:417
uint32 count
Definition: Creature.h:416
void Creature::UpdateWaypointID ( uint32  wpID)
inline
684 { m_waypointID = wpID; }
uint32 m_waypointID
Definition: Creature.h:777

+ Here is the caller graph for this function:

Member Data Documentation

uint32 Creature::_focusDelay
private

Locks the target during spell cast for proper facing

Spell const* Creature::_focusSpell
private
time_t Creature::_pickpocketLootRestore
protected

Timers.

ObjectGuid Creature::_skinner
protected
bool Creature::DisableReputationGain
protected
Loot Creature::loot
ObjectGuid Creature::lootingGroupLowGUID
bool Creature::m_AI_locked
protected
bool Creature::m_AlreadyCallAssistance
protected
bool Creature::m_AlreadySearchedAssistance
protected
uint32 Creature::m_boundaryCheckTime
protected
float Creature::m_CombatDistance
uint32 Creature::m_combatPulseDelay
protected
uint32 Creature::m_combatPulseTime
protected
uint32 Creature::m_corpseDelay
protected
time_t Creature::m_corpseRemoveTime
protected
CreatureData const* Creature::m_creatureData
protected
CreatureTemplate const* Creature::m_creatureInfo
protected
MovementGeneratorType Creature::m_defaultMovementType
protected
uint8 Creature::m_equipmentId
protected
CreatureGroup* Creature::m_formation
private
uint32 Creature::m_groupLootTimer
Position Creature::m_homePosition
protected
bool Creature::m_isTempWorldObject
uint16 Creature::m_LootMode
protected
ObjectGuid Creature::m_lootRecipient
protected
ObjectGuid Creature::m_lootRecipientGroup
protected
SpellSchoolMask Creature::m_meleeDamageSchoolMask
protected
uint32 Creature::m_originalEntry
protected
int8 Creature::m_originalEquipmentId
protected
uint32 Creature::m_path_id
private
uint32 Creature::m_PlayerDamageReq
ReactStates Creature::m_reactState
protected
bool Creature::m_regenHealth
protected
uint32 Creature::m_respawnDelay
protected
float Creature::m_respawnradius
protected
time_t Creature::m_respawnTime
protected
float Creature::m_SightDistance
ObjectGuid::LowType Creature::m_spawnId
protected

For new or temporary creatures is 0 for saved it is lowguid.

uint32 Creature::m_spells[CREATURE_MAX_SPELLS]
CreatureTextRepeatGroup Creature::m_textRepeat
private
Position Creature::m_transportHomePosition
protected
VendorItemCounts Creature::m_vendorItemCounts
protected
uint32 Creature::m_waypointID
private
bool Creature::TriggerJustRespawned
private

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