OregonCore  revision fb2a440-git
Your Favourite TBC server
Creature Class Reference

#include <Creature.h>

+ Inheritance diagram for Creature:

Public Member Functions

 Creature (bool isWorldObject=false)
 
 ~Creature () override
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void DisappearAndDie ()
 
bool Create (uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 team, float x, float y, float z, float ang, const CreatureData *data=NULL)
 
bool LoadCreaturesAddon (bool reload=false)
 
void SelectLevel ()
 
void LoadEquipment (uint32 equip_entry, bool force=false)
 
uint32 GetDBTableGUIDLow () const
 
char const * GetSubName () const
 
void Update (uint32 time) override
 
void GetRespawnPosition (float &x, float &y, float &z, float *ori=NULL, float *dist=NULL) const
 
uint32 GetEquipmentId () const
 
void SetVirtualItem (VirtualItemSlot slot, uint32 item_id)
 
void SetVirtualItemRaw (VirtualItemSlot slot, uint32 display_id, uint32 info0, uint32 info1)
 
void SetCorpseDelay (uint32 delay)
 
bool IsRacialLeader () const
 
bool IsCivilian () const
 
bool IsTrigger () const
 
bool IsGuard () const
 
bool CanWalk () const
 
bool CanSwim () const
 
bool CanFly () const
 
void SetReactState (ReactStates st)
 
ReactStates GetReactState () const
 
bool HasReactState (ReactStates state) const
 
void InitializeReactState ()
 
bool IsTrainerOf (Player *player, bool msg) const
 
bool CanInteractWithBattleMaster (Player *player, bool msg) const
 
bool CanTrainAndResetTalentsOf (Player *pPlayer) const
 
bool CanCreatureAttack (Unit const *victim, bool force=true) const
 
bool IsImmuneToSpell (SpellEntry const *spellInfo, bool useCharges=false) override
 
bool IsImmuneToSpellEffect (SpellEntry const *spellInfo, uint32 index, bool castOnSelf) const override
 
bool isElite () const
 
bool isWorldBoss () const
 
uint8 getLevelForTarget (Unit const *target) const
 
bool IsInEvadeMode () const
 
bool AIM_Initialize (CreatureAI *ai=NULL)
 
CreatureAIAI () const
 
uint32 GetShieldBlockValue () const override
 
SpellSchoolMask GetMeleeDamageSchoolMask () const override
 
void SetMeleeDamageSchool (SpellSchools school)
 
void _AddCreatureSpellCooldown (uint32 spell_id, time_t end_time)
 
void _AddCreatureCategoryCooldown (uint32 category, time_t apply_time)
 
void AddCreatureSpellCooldown (uint32 spellid)
 
bool HasSpellCooldown (uint32 spell_id) const
 
bool HasCategoryCooldown (uint32 spell_id) const
 
bool HasSpell (uint32 spellID) const override
 
bool UpdateEntry (uint32 entry, uint32 team=ALLIANCE, const CreatureData *data=NULL)
 
void UpdateMovementFlags (bool packetOnly=false)
 
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)
 
void SetCurrentEquipmentId (uint8 id)
 
uint32 GetCurrentEquipmentId ()
 
float GetSpellDamageMod (int32 Rank) const
 
VendorItemData const * GetVendorItems () const
 
uint32 GetVendorItemCurrentCount (VendorItem const *vItem)
 
uint32 UpdateVendorItemCurrentCount (VendorItem const *vItem, uint32 used_count)
 
TrainerSpellData const * GetTrainerSpells () const
 
CreatureInfo const * GetCreatureTemplate () const
 
CreatureData const * GetCreatureData () const
 
CreatureDataAddon const * GetCreatureAddon () const
 
std::string GetAIName () const
 
std::string GetScriptName ()
 
uint32 GetScriptId ()
 
void setEmoteState (uint8 emote)
 
void Say (const char *text, uint32 language, uint64 TargetGuid)
 
void Yell (const char *text, uint32 language, uint64 TargetGuid)
 
void TextEmote (const char *text, uint64 TargetGuid, bool IsBossEmote=false)
 
void Whisper (const char *text, uint64 receiver, bool IsBossWhisper=false)
 
void Say (int32 textId, uint32 language, uint64 TargetGuid)
 
void Yell (int32 textId, uint32 language, uint64 TargetGuid)
 
void TextEmote (int32 textId, uint64 TargetGuid, bool IsBossEmote=false)
 
void Whisper (int32 textId, uint64 receiver, bool IsBossWhisper=false)
 
const char * GetNameForLocaleIdx (int32 locale_idx) const override
 
void setDeathState (DeathState s) override
 
bool LoadFromDB (uint32 guid, Map *map)
 
bool LoadCreatureFromDB (uint32 guid, Map *map, bool addToMap=true)
 
virtual void SaveToDB ()
 
virtual void SaveToDB (uint32 mapid, uint8 spawnMask, uint32 phaseMask)
 
virtual void DeleteFromDB ()
 
void StartPickPocketRefillTimer ()
 
void ResetPickPocketRefillTimer ()
 
bool CanGeneratePickPocketLoot () const
 
void SetSkinner (uint64 guid)
 
uint64 GetSkinner () const
 
PlayerGetLootRecipient () const
 
GroupGetLootRecipientGroup () const
 
bool hasLootRecipient () const
 
bool isTappedBy (Player const *player) const
 
void SetLootRecipient (Unit *unit)
 
void AllLootRemovedFromCorpse ()
 
SpellEntry const * reachWithSpellAttack (Unit *pVictim)
 
SpellEntry const * reachWithSpellCure (Unit *pVictim)
 
bool canStartAttack (Unit const *u, bool force) const
 
float GetAttackDistance (Unit const *pl) const
 
float GetAggroRange (Unit const *target) const
 
void SendAIReaction (AiReaction reactionType)
 
UnitSelectNearestTarget (float dist=0, bool playerOnly=false) const
 
UnitSelectNearestTargetInAttackDistance (float dist=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)
 
Cell const & GetCurrentCell () const
 
void SetCurrentCell (Cell const &cell)
 
void RemoveCorpse (bool setSpawnTime=true)
 
void ForcedDespawn (uint32 timeMSToDespawn=0)
 
void DespawnOrUnsummon (uint32 msTimeToDespawn=0)
 
time_t const & GetRespawnTime () const
 
time_t GetRespawnTimeEx () const
 
void SetRespawnTime (uint32 respawn)
 
void Respawn (bool force=false)
 
void SaveRespawnTime () override
 
uint32 GetRespawnDelay () const
 
void SetRespawnDelay (uint32 delay)
 
float GetRespawnRadius () const
 
void SetRespawnRadius (float dist)
 
uint32 GetCombatPulseDelay () const
 
void SetCombatPulseDelay (uint32 delay)
 
time_t GetLinkedCreatureRespawnTime () const
 
const CreatureDataGetLinkedRespawnCreatureData () const
 
void SendZoneUnderAttackMessage (Player *attacker)
 
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 SetHomePosition (float x, float y, float z, float o)
 
void SetHomePosition (const Position &pos)
 
void GetHomePosition (float &x, float &y, float &z, float &ori)
 
Position GetHomePosition ()
 
uint32 GetGlobalCooldown () const
 
uint32 GetWaypointPath ()
 
void LoadPath (uint32 pathid)
 
uint32 GetCurrentWaypointID ()
 
void UpdateWaypointID (uint32 wpID)
 
void SearchFormation ()
 
CreatureGroupGetFormation ()
 
void SetFormation (CreatureGroup *formation)
 
UnitSelectVictim ()
 
void SetDisableReputationGain (bool disable)
 
bool IsReputationGainDisabled ()
 
bool IsDamageEnoughForLootingAndReward () const
 
void SetPlayerDamaged (bool set)
 
uint32 GetOriginalEntry () const
 
void SetOriginalEntry (uint32 entry)
 
bool SetLevitate (bool enable, bool packetOnly=false) override
 
bool SetWalk (bool enable) override
 
bool SetSwim (bool enable) override
 
bool SetCanFly (bool enable, bool packetOnly=false) override
 
bool SetFeatherFall (bool enable, bool packetOnly=false) override
 
bool SetWaterWalking (bool enable, bool packetOnly=false) override
 
bool SetHover (bool enable, bool packetOnly=false) override
 
CreatureTextRepeatIds GetTextRepeatGroup (uint8 textGroup)
 
void SetTextRepeatId (uint8 textGroup, uint8 id)
 
void ClearTextRepeatGroup (uint8 textGroup)
 
- Public Member Functions inherited from Unit
 ~Unit () override
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void CleanupsBeforeDelete () override
 
DiminishingLevels GetDiminishing (DiminishingGroup group)
 
void IncrDiminishing (DiminishingGroup group)
 
void ApplyDiminishingToDuration (DiminishingGroup group, int32 &duration, Unit *caster, DiminishingLevels Level)
 
void ApplyDiminishingAura (DiminishingGroup group, bool apply)
 
void ClearDiminishings ()
 
uint32 GetSpellRadiusForTarget (Unit *target, const SpellRadiusEntry *radiusEntry)
 
void Update (uint32 time) override
 
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 UpdateMeleeAttackingState ()
 
bool CanUseEquippedWeapon (WeaponAttackType attackType) const
 
bool CanDualWield () const
 
float GetCombatReach () const
 
float GetMeleeReach () const
 
bool IsWithinCombatRange (const Unit *obj, float dist2compare) const
 
bool IsWithinMeleeRange (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 CastStop (uint32 except_spellid=0)
 
bool AttackStop ()
 
void RemoveAllAttackers ()
 
AttackerSet const & getAttackers () const
 
bool isAttackingPlayer () const
 
UnitGetVictim () const
 
void CombatStop (bool cast=false)
 
void CombatStopWithPets (bool cast=false)
 
UnitSelectNearbyTarget (Unit *exclude=NULL, float dist=NOMINAL_MELEE_RANGE) const
 
PlayerSelectNearestPlayer (float distance=0) const
 
void SendMeleeAttackStop (Unit *victim=NULL)
 
void SendMeleeAttackStart (Unit *victim)
 
void SetCritterGUID (uint64 guid)
 
uint64 GetCritterGUID () const
 
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 IsDuringRemoveFromWorld () const
 
PetToPet ()
 
Pet const * ToPet () const
 
uint8 getLevel () const
 
uint8 getLevelForTarget (WorldObject const *) const override
 
void SetLevel (uint32 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
 
void SetResistance (SpellSchools school, int32 val)
 
uint32 GetHealth () const
 
uint32 GetMaxHealth () const
 
bool ShouldRevealHealthTo (Player *player) const
 
void SendHealthUpdateDueToCharm (Player *charmer)
 
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)
 
Powers getPowerType () const
 
void setPowerType (Powers power)
 
uint32 GetPower (Powers power) const
 
uint32 GetMaxPower (Powers power) const
 
void SetPower (Powers power, uint32 val)
 
void SetMaxPower (Powers power, uint32 val)
 
int32 ModifyPower (Powers power, int32 val)
 
void ApplyPowerMod (Powers power, uint32 val, bool apply)
 
void ApplyMaxPowerMod (Powers power, uint32 val, bool apply)
 
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 const * GetFactionTemplateEntry () 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 GetPartyMember (std::list< Unit * > &units, float dist)
 
void GetRaidMember (std::list< Unit * > &units, float dist)
 
bool IsContestedGuard () const
 
bool IsInSanctuary () const
 
bool IsPvP () const
 
void SetPvP (bool state)
 
uint32 GetCreatureType () const
 
uint32 GetCreatureTypeMask () const
 
uint8 GetStandState () const
 
bool IsSitState () const
 
bool IsStandState () const
 
void SetStandState (uint8 state)
 
void SetStandFlags (uint8 flags)
 
void RemoveStandFlags (uint8 flags)
 
bool IsMounted () const
 
uint32 GetMountID () const
 
void Mount (uint32 mount, uint32 spellId=0)
 
void Dismount ()
 
bool HasShapeshiftChangingModel () const
 
uint32 GetMaxSkillValueForLevel (Unit const *target=nullptr) const
 
void RemoveSpellbyDamageTaken (uint32 damage, uint32 spell)
 
uint32 DealDamage (Unit *victim, uint32 damage, CleanDamage const *cleanDamage=NULL, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *spellProto=NULL, bool durabilityLoss=true)
 
void Kill (Unit *victim, bool durabilityLoss=true)
 
void ProcDamageAndSpell (Unit *victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType=BASE_ATTACK, SpellEntry const *procSpell=NULL, bool canTrigger=true)
 
void ProcDamageAndSpellFor (bool isVictim, Unit *pTarget, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellEntry const *procSpell, uint32 damage)
 
void HandleEmoteCommand (uint32 anim_id)
 
void AttackerStateUpdate (Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false)
 
float MeleeMissChanceCalc (const Unit *victim, WeaponAttackType attType) const
 
void CalculateMeleeDamage (Unit *victim, uint32 damage, CalcDamageInfo *damageInfo, WeaponAttackType attackType=BASE_ATTACK)
 
void DealMeleeDamage (CalcDamageInfo *damageInfo, bool durabilityLoss)
 
void CalculateSpellDamageTaken (SpellNonMeleeDamage *damageInfo, int32 damage, SpellEntry const *spellInfo, WeaponAttackType attackType=BASE_ATTACK, bool crit=false)
 
void DealSpellDamage (SpellNonMeleeDamage *damageInfo, bool durabilityLoss)
 
float MeleeSpellMissChance (const Unit *victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
 
SpellMissInfo MeleeSpellHitResult (Unit *victim, SpellEntry const *spell, bool cMiss=true)
 
SpellMissInfo MagicSpellHitResult (Unit *victim, SpellEntry const *spell)
 
SpellMissInfo SpellHitResult (Unit *victim, SpellEntry const *spell, bool canReflect=false, bool canMiss=true)
 
float GetUnitDodgeChance () const
 
float GetUnitParryChance () const
 
float GetUnitBlockChance () const
 
float GetUnitCriticalChance (WeaponAttackType attackType, const Unit *victim) const
 
int32 GetMechanicResistChance (const SpellEntry *spell)
 
bool CanUseAttackType (uint8 attacktype) const
 
uint32 GetUnitMeleeSkill (Unit const *target=NULL) const
 
uint32 GetDefenseSkillValue (Unit const *target=NULL) const
 
uint32 GetWeaponSkillValue (WeaponAttackType attType, Unit const *target=NULL) const
 
float GetWeaponProcChance () const
 
float GetPPMProcChance (uint32 WeaponSpeed, float PPM) const
 
MeleeHitOutcome RollMeleeOutcomeAgainst (const Unit *victim, WeaponAttackType attType) const
 
MeleeHitOutcome RollMeleeOutcomeAgainst (const Unit *victim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance, bool SpellCasted) 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 IsPlayer () const
 
bool IsInFlight () const
 
bool IsInitiatingCombat () const
 
bool IsInCombat () const
 
bool IsPetInCombat () const
 
bool IsInCombatWith (Unit const *who) const
 
void CombatStart (Unit *target, bool initialAggro=true)
 
void SetInCombatState (bool PvP, Unit *enemy=NULL)
 
void SetInitiatingCombat (bool flag)
 
void SetInCombatWith (Unit *enemy)
 
void ClearInCombat ()
 
void ClearInPetCombat ()
 
uint32 IsInPvPCombat () const
 
uint32 GetAuraCount (uint32 spellId) const
 
bool HasAuraType (AuraType auraType) const
 
bool HasAuraTypeWithCaster (AuraType auratype, uint64 caster) const
 
bool HasAuraTypeWithMiscvalue (AuraType auratype, int32 miscvalue) const
 
bool HasAuraTypeWithFamilyFlags (AuraType auraType, uint32 familyName, uint64 familyFlags) const
 
bool HasNegativeAuraWithInterruptFlag (uint32 flag)
 
bool HasAura (uint32 spellId, uint8 effIndex=0) const
 
bool HasHigherRankOfAura (uint32 spellid, uint8 effIndex) 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, SpellEntry const *bySpell, WorldObject const *obj=NULL) const
 
bool isAttackableByAOE (float x=0, float y=0, float z=0, bool LosCheck=false) const
 
bool IsValidAssistTarget (Unit const *target) const
 
bool _IsValidAssistTarget (Unit const *target, SpellEntry const *bySpell) const
 
virtual bool IsInWater () const
 
virtual bool IsUnderWater () const
 
bool isInAccessiblePlaceFor (Creature const *c) const
 
virtual uint32 GetHighestLearnedRankOf (uint32 spellid) const
 
void SendHealSpellLog (Unit *victim, uint32 SpellID, uint32 Damage, bool critical=false)
 
void SendEnergizeSpellLog (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
 
void EnergizeBySpell (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
 
uint32 SpellNonMeleeDamageLog (Unit *victim, uint32 spellID, uint32 damage, bool isTriggeredSpell=false, bool useSpellDamage=true)
 
void CastSpell (Unit *Victim, uint32 spellId, bool triggered, Item *castItem=NULL, Aura *triggeredByAura=NULL, uint64 originalCaster=0)
 
void CastSpell (Unit *Victim, SpellEntry const *spellInfo, bool triggered, Item *castItem=NULL, Aura *triggeredByAura=NULL, uint64 originalCaster=0)
 
void CastCustomSpell (Unit *Victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=NULL, Aura *triggeredByAura=NULL, uint64 originalCaster=0)
 
void CastCustomSpell (uint32 spellId, SpellValueMod mod, uint32 value, Unit *Victim=NULL, bool triggered=true, Item *castItem=NULL, Aura *triggeredByAura=NULL, uint64 originalCaster=0)
 
void CastCustomSpell (uint32 spellId, CustomSpellValues const &value, Unit *Victim=NULL, bool triggered=true, Item *castItem=NULL, Aura *triggeredByAura=NULL, uint64 originalCaster=0)
 
void CastSpell (float x, float y, float z, uint32 spellId, bool triggered, Item *castItem=NULL, Aura *triggeredByAura=NULL, uint64 originalCaster=0)
 
void CastSpell (GameObject *go, uint32 spellId, bool triggered, Item *castItem=NULL, Aura *triggeredByAura=NULL, uint64 originalCaster=0)
 
void AddAura (uint32 spellId, Unit *target)
 
void DeMorph ()
 
void SendAttackStateUpdate (CalcDamageInfo *damageInfo)
 
void SendAttackStateUpdate (uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount)
 
void SendSpellNonMeleeDamageLog (SpellNonMeleeDamage *log)
 
void SendSpellNonMeleeDamageLog (Unit *target, uint32 SpellID, uint32 Damage, SpellSchoolMask damageSchoolMask, uint32 AbsorbedDamage, uint32 Resist, bool PhysicalDamage, uint32 Blocked, bool CriticalHit=false)
 
void SendSpellMiss (Unit *target, uint32 spellID, SpellMissInfo missInfo)
 
void SendSpellDamageImmune (Unit *target, uint32 spellId)
 
virtual bool SetPosition (float x, float y, float z, float orientation, bool teleport=false)
 
bool SetPosition (const Position &pos, bool teleport=false)
 
void NearTeleportTo (float x, float y, float z, float orientation, bool casting=false)
 
void SendTeleportPacket (Position &pos)
 
void SendMovementFlagUpdate (bool self=false)
 
void BuildHeartBeatMsg (WorldPacket *data) const
 
void BuildMovementPacket (ByteBuffer *data) const
 
bool isMoving () const
 
bool IsAlive () const
 
bool isDying () const
 
bool isDead () const
 
DeathState getDeathState () const
 
uint64 GetOwnerGUID () const
 
uint64 GetCreatorGUID () const
 
void SetCreatorGUID (uint64 creator)
 
uint64 GetMinionGUID () const
 
void SetMinionGUID (uint64 guid)
 
uint64 GetCharmerGUID () const
 
void SetCharmerGUID (uint64 owner)
 
uint64 GetCharmGUID () const
 
void SetPetGUID (uint64 guid)
 
uint64 GetPetGUID () const
 
bool IsControlledByPlayer () const
 
uint64 GetCharmerOrOwnerGUID () const
 
uint64 GetCharmerOrOwnerOrOwnGUID () const
 
bool IsCharmedOwnedByPlayerOrPlayer () const
 
PlayerGetAffectingPlayer () const
 
PlayerGetSpellModOwner () const
 
UnitGetOwner () const
 
GuardianGetGuardianPet () const
 
MinionGetFirstMinion () const
 
UnitGetCharmer () const
 
UnitGetCharm () const
 
UnitGetCharmerOrOwner () const
 
UnitGetCharmerOrOwnerOrSelf () const
 
PlayerGetCharmerOrOwnerPlayerOrPlayerItself () const
 
void SetMinion (Minion *minion, bool apply)
 
void RemoveAllMinionsByEntry (uint32 entry)
 
void SetCharm (Unit *target, bool apply)
 
void SetCharmedBy (Unit *charmer, CharmType type)
 
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 const & GetSharedVisionList ()
 
void AddPlayerToVision (Player *plr)
 
void RemovePlayerFromVision (Player *plr)
 
bool HasSharedVision () const
 
void RemoveBindSightAuras ()
 
void RemoveCharmAuras ()
 
PetCreateTamedPetFrom (Creature *creatureTarget, uint32 spell_id=0)
 
bool AddAura (Aura *aur)
 
void RemoveAura (AuraMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (uint32 spellId, uint32 effindex, Aura *except=NULL)
 
void RemoveSingleAuraFromStackByDispel (uint32 spellId)
 
void RemoveSingleAuraFromStack (uint32 spellId, uint32 effindex)
 
void RemoveAurasDueToSpell (uint32 spellId, Aura *except=NULL)
 
void RemoveAurasDueToItemSpell (Item *castItem, uint32 spellId)
 
void RemoveAurasByCasterSpell (uint32 spellId, uint64 casterGUID)
 
void SetAurasDurationByCasterSpell (uint32 spellId, uint64 casterGUID, int32 duration)
 
AuraGetAuraByCasterSpell (uint32 spellId, uint64 casterGUID)
 
void RemoveAurasDueToSpellByDispel (uint32 spellId, uint64 casterGUID, Unit *dispeler)
 
void RemoveAurasDueToSpellBySteal (uint32 spellId, uint64 casterGUID, Unit *stealer)
 
void RemoveAurasByType (AuraType auraType, uint64 casterGUID=0, Aura *except=NULL, bool negative=true, bool positive=true)
 
void RemoveAurasDueToSpellByCancel (uint32 spellId)
 
void RemoveAurasAtChanneledTarget (SpellEntry const *spellInfo, Unit *caster)
 
void RemoveNotOwnSingleTargetAuras ()
 
void RemoveSpellsCausingAura (AuraType auraType)
 
void RemoveAuraTypeByCaster (AuraType auraType, uint64 casterGUID)
 
void RemoveRankAurasDueToSpell (uint32 spellId)
 
bool RemoveNoStackAurasDueToAura (Aura *Aur)
 
void RemoveAurasWithInterruptFlags (uint32 flags, uint32 except=0)
 
void RemoveAurasWithAttribute (uint32 flags)
 
void RemoveAurasWithDispelType (DispelType type)
 
void RemoveMovementImpairingAuras ()
 
void RemoveAllAuras ()
 
void RemoveArenaAuras ()
 
void RemoveAllAurasOnDeath ()
 
void DelayAura (uint32 spellId, uint32 effindex, int32 delaytime)
 
float GetResistanceBuffMods (SpellSchools school, bool positive) const
 
void SetResistanceBuffMods (SpellSchools school, bool positive, float val)
 
void ApplyResistanceBuffModsMod (SpellSchools school, bool positive, float val, bool apply)
 
void ApplyResistanceBuffModsPercentMod (SpellSchools school, bool positive, float val, bool apply)
 
void InitStatBuffMods ()
 
void ApplyStatBuffMod (Stats stat, float val, bool apply)
 
void ApplyStatPercentBuffMod (Stats stat, float val, bool apply)
 
void SetCreateStat (Stats stat, float val)
 
void SetCreateHealth (uint32 val)
 
uint32 GetCreateHealth () const
 
void SetCreateMana (uint32 val)
 
uint32 GetCreateMana () const
 
uint32 GetCreatePowers (Powers power) const
 
float GetPosStat (Stats stat) const
 
float GetNegStat (Stats stat) const
 
float GetCreateStat (Stats stat) const
 
void SetCurrentCastedSpell (Spell *pSpell)
 
virtual void ProhibitSpellSchool (SpellSchoolMask, uint32)
 
void InterruptSpell (CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true)
 
void FinishSpell (CurrentSpellTypes spellType, bool ok=true)
 
bool IsNonMeleeSpellCast (bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false) const
 
void InterruptNonMeleeSpells (bool withDelayed, uint32 spellid=0, bool withInstant=true)
 
uint64 GetTarget () const
 
void SetTarget (uint64 guid=0)
 
SpellGetCurrentSpell (CurrentSpellTypes spellType) const
 
SpellGetCurrentSpell (uint32 spellType) const
 
SpellFindCurrentSpellBySpellId (uint32 spell_id) const
 
int32 GetCurrentSpellCastTime (uint32 spell_id) const
 
bool CanMoveDuringChannel () const
 
bool IsInFeralForm () const
 
bool IsInTravelForm () const
 
bool IsInFlightForm () 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=M_PI) const
 
void SetInFront (Unit const *target)
 
void SetInFront (float x, float y)
 
bool isInBackInMap (Unit const *target, float distance, float arc=M_PI) const
 
void SetFacingTo (float ori)
 
void SetFacingToObject (WorldObject *pObject)
 
bool IsVisible () const
 
void SetVisible (bool x)
 
bool isValid () const override
 
void SetPhaseMask (uint32 newPhaseMask, bool update) override
 
void UpdateObjectVisibility (bool forced=true) override
 
bool isInvisibleForAlive () const
 returns true if creature can't be seen by alive units More...
 
AuraListGetSingleCastAuras ()
 
AuraList const & GetSingleCastAuras () const
 
bool CanHaveThreatList () const
 
void AddThreat (Unit *victim, float threat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell=NULL)
 
void AddAssistThreat (Unit *victim, float threatToAdd, SpellEntry const *threatSpell)
 
float ApplyTotalThreatModifier (float threat, 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 ()
 
AuraGetAura (uint32 spellId, uint32 effindex)
 
AuraMapGetAuras ()
 
AuraMap const & GetAuras () const
 
AuraList const & GetAurasByType (AuraType type) const
 
void ApplyAuraProcTriggerDamage (Aura *aura, bool apply)
 
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
 
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
 
AuraGetDummyAura (uint32 spell_id) const
 
uint32 GetInterruptMask () const
 
void AddInterruptMask (uint32 mask)
 
void UpdateInterruptMask ()
 
uint32 GetDisplayId ()
 
void SetDisplayId (uint32 modelId)
 
uint32 GetNativeDisplayId ()
 
void SetNativeDisplayId (uint32 modelId)
 
void setTransForm (uint32 spellid)
 
uint32 getTransForm () const
 
void AddDynObject (DynamicObject *dynObj)
 
void RemoveDynObject (uint32 spellid)
 
void RemoveDynObjectWithGUID (uint64 guid)
 
void RemoveAllDynObjects ()
 
void AddGameObject (GameObject *gameObj)
 
void RemoveGameObject (GameObject *gameObj, bool del)
 
void RemoveGameObject (uint32 spellid, bool del)
 
void RemoveAllGameObjects ()
 
DynamicObjectGetDynObject (uint32 spellId, uint32 effIndex)
 
DynamicObjectGetDynObject (uint32 spellId)
 
void ModifyAuraState (AuraState flag, bool apply)
 
bool HasAuraState (AuraState flag) const
 
void UnsummonAllTotems ()
 
int32 SpellBaseDamageBonus (SpellSchoolMask schoolMask)
 
int32 SpellBaseHealingBonus (SpellSchoolMask schoolMask)
 
int32 SpellBaseDamageBonusForVictim (SpellSchoolMask schoolMask, Unit *victim)
 
int32 SpellBaseHealingBonusForVictim (SpellSchoolMask schoolMask, Unit *victim)
 
uint32 SpellDamageBonus (Unit *victim, SpellEntry const *spellProto, uint32 damage, DamageEffectType damagetype)
 
uint32 SpellHealingBonus (SpellEntry const *spellProto, uint32 healamount, DamageEffectType damagetype, Unit *victim)
 
bool isSpellBlocked (Unit *victim, SpellEntry const *spellProto, WeaponAttackType attackType=BASE_ATTACK)
 
bool isSpellCrit (Unit *victim, SpellEntry const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType=BASE_ATTACK)
 
uint32 SpellCriticalBonus (SpellEntry const *spellProto, uint32 damage, Unit *victim)
 
void SetLastManaUse (uint32 spellCastTime)
 
bool IsUnderLastManaUseEffect () const
 
void SetContestedPvP (Player *attackedPlayer=NULL)
 
void MeleeDamageBonus (Unit *victim, uint32 *damage, WeaponAttackType attType, SpellEntry const *spellProto=NULL)
 
uint32 GetCastingTimeForBonus (SpellEntry const *spellProto, DamageEffectType damagetype, uint32 CastingTime)
 
void ApplySpellImmune (uint32 spellId, uint32 op, uint32 type, bool apply)
 
void ApplySpellDispelImmunity (const SpellEntry *spellProto, DispelType type, bool apply)
 
bool IsImmunedToDamage (SpellSchoolMask meleeSchoolMask, bool useCharges=false)
 
bool IsImmunedToDamage (SpellEntry const *spellInfo) const
 
uint32 CalculateEffectiveMagicResistance (Unit *attacker, SpellSchoolMask schoolMask) const
 
float CalculateMagicResistanceMitigation (Unit *attacker, uint32 resistance, bool binary) const
 
uint32 CalcArmorReducedDamage (Unit *victim, const uint32 damage)
 
void CalcAbsorbResist (Unit *victim, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist, SpellEntry const *spellInfo=NULL, bool binary=false)
 
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)
 
bool isHover () const
 
void _RemoveAllAuraMods ()
 
void _ApplyAllAuraMods ()
 
int32 CalculateSpellDamage (SpellEntry const *spellProto, uint8 effect_index, int32 basePoints, Unit const *target)
 
int32 CalculateSpellDuration (SpellEntry const *spellProto, uint8 effect_index, Unit const *target)
 
float CalculateLevelPenalty (SpellEntry const *spellProto) const
 
void ModSpellCastTime (SpellEntry const *spellProto, int32 &castTime, Spell *spell)
 
void ModSpellDurationTime (SpellEntry const *spellProto, int32 &duration, Spell *spell)
 
void addFollower (FollowerReference *pRef)
 
void removeFollower (FollowerReference *)
 
MotionMasterGetMotionMaster ()
 
bool IsStopped () const
 
void StopMoving ()
 
void AddUnitMovementFlag (uint32 f)
 
void RemoveUnitMovementFlag (uint32 f)
 
bool HasUnitMovementFlag (uint32 f) const
 
uint32 GetUnitMovementFlags () const
 
void SetUnitMovementFlags (uint32 f)
 
void SetControlled (bool apply, UnitState state)
 
void SetFeared (bool apply)
 
void SetConfused (bool apply)
 
void SetStunned (bool apply)
 
void MonsterMoveWithSpeed (float x, float y, float z, float speed, bool generatePath=false, bool forceDestination=false)
 
void SendMonsterMoveWithSpeedToCurrentDestination (float speed)
 
void AddComboPointHolder (uint32 lowguid)
 
void RemoveComboPointHolder (uint32 lowguid)
 
void ClearComboPointHolders ()
 
void SendPetCastFail (uint32 spellid, SpellCastResult msg)
 
void SendPetActionFeedback (uint8 msg)
 
void SendPetTalk (uint32 pettalk)
 
void SendPetSpellCooldown (uint32 spellid, time_t cooltime)
 
void SendPetClearCooldown (uint32 spellid)
 
void SendPetAIReaction (uint64 guid)
 
void propagateSpeedChange ()
 
void ClearAllReactives ()
 
void StartReactiveTimer (ReactiveType reactive)
 
void UpdateReactives (uint32 p_time)
 
void UpdateAuraForGroup (uint8 slot)
 
void AddPetAura (PetAura const *petSpell)
 
void RemovePetAura (PetAura const *petSpell)
 
void SetReducedThreatPercent (uint32 pct, uint64 guid)
 
uint32 GetReducedThreatPercent ()
 
UnitGetMisdirectionTarget ()
 
virtual float GetFollowAngle () const
 
bool IsFlying () const
 
bool IsFalling () const
 
bool IsWalking () const
 
bool IsRooted () const
 
void SetRooted (bool apply)
 
bool IsLevitating () const
 
time_t GetLastDamagedTime () const
 
void SetLastDamagedTime (time_t val)
 
TempSummonToTempSummon ()
 
TempSummon const * ToTempSummon () const
 
- Public Member Functions inherited from WorldObject
 ~WorldObject () override
 
void _Create (uint32 guidlow, HighGuid guidhigh, uint32 phaseMask)
 
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)
 
float GetPositionZTarget (Position &pos, float destx, float desty)
 
Position GetRandomNearPosition (float radius)
 
void GetContactPoint (const WorldObject *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
virtual float GetObjectBoundingRadius () const
 
float GetObjectSize () const
 
void UpdateGroundPositionZ (float x, float y, float &z) const
 
void UpdateAllowedPositionZ (float x, float y, float &z) const
 
void GetRandomPoint (const Position &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
 
void GetRandomPoint (const Position &srcPos, float distance, Position &pos) const
 
float GetDistanceSqr (float x, float y, float z) const
 
bool HasInArc (float arcangle, const Position *pos) const
 
bool HasInArc (const float arcangle, const float x, const float y) const
 
uint32 GetInstanceId () const
 
uint32 GetPhaseMask () const
 
bool InSamePhase (uint32 phasemask) const
 
bool InSamePhase (WorldObject const *obj) const
 
uint32 GetZoneId () const
 
uint32 GetAreaId () const
 
InstanceDataGetInstanceData ()
 
const char * GetName () const
 
void SetName (const std::string &newname)
 
float GetDistance (const WorldObject *obj) const
 
float GetDistance (const Position &pos) const
 
float GetDistance (float x, float y, float z) const
 
float GetDistance2d (const WorldObject *obj) const
 
float GetDistance2d (float x, float y) const
 
float GetDistanceZ (const WorldObject *obj) const
 
bool IsInMap (const WorldObject *obj) const
 
bool IsWithinDist3d (float x, float y, float z, float dist) const
 
bool IsWithinDist3d (const Position *pos, float dist) const
 
bool IsWithinDist2d (float x, float y, float dist) const
 
bool IsWithinDist2d (const Position *pos, float dist) const
 
bool _IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D) 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 (const WorldObject *obj) const
 
Position GetHitSpherePointFor (Position const &dest) const
 
void GetHitSpherePointFor (Position const &dest, float &x, float &y, float &z) 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
 
virtual void SendMessageToSet (WorldPacket *data, bool self)
 
virtual void SendMessageToSetInRange (WorldPacket *data, float dist, bool self)
 
void MonsterSay (const char *text, uint32 language, uint64 TargetGuid)
 
void MonsterYell (const char *text, uint32 language, uint64 TargetGuid)
 
void MonsterTextEmote (const char *text, uint64 TargetGuid, bool IsBossEmote=false)
 
void MonsterWhisper (const char *text, uint64 receiver, bool IsBossWhisper=false)
 
void MonsterSay (int32 textId, uint32 language, uint64 TargetGuid)
 
void MonsterYell (int32 textId, uint32 language, uint64 TargetGuid)
 
void MonsterTextEmote (int32 textId, uint64 TargetGuid, bool IsBossEmote=false)
 
void MonsterWhisper (int32 textId, uint64 receiver, bool IsBossWhisper=false)
 
void MonsterYellToZone (int32 textId, uint32 language, uint64 TargetGuid)
 
void BuildMonsterChat (WorldPacket *data, uint8 msgtype, char const *text, uint32 language, char const *name, uint64 TargetGuid) const
 
void PlayDistanceSound (uint32 sound_id, Player *target=NULL)
 
void PlayDirectSound (uint32 sound_id, Player *target=NULL)
 
void SendObjectDeSpawnAnim (uint64 guid)
 
void SendObjectCustomAnim (uint64 guid, uint32 anim=0)
 
void AddObjectToRemoveList ()
 
virtual bool IsNeverVisible () const
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
float GetSightRange (const WorldObject *target=NULL) const
 
bool CanSeeOrDetect (WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
 
void SendPlaySound (uint32 Sound, bool OnlySelf)
 
virtual void SetMap (Map *map)
 
virtual void ResetMap ()
 
MapGetMap () const
 
MapFindMap () const
 
Map const * GetBaseMap () const
 
void SetZoneScript ()
 
TempSummonSummonCreature (uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0)
 
TempSummonSummonCreature (uint32 id, float x, float y, float z, float ang, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0)
 
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)
 
GameObjectFindNearestGameObject (uint32 entry, float range)
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &gameobjectList, uint32 entry=GRID_SEARCH_ALL_ENTRIES, float maxSearchRange=250.0f) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &creatureList, uint32 entry=GRID_SEARCH_ALL_ENTRIES, float maxSearchRange=250.0f) const
 
void DestroyForNearbyPlayers ()
 
virtual void UpdateObjectVisibilityOnCreate ()
 
void BuildUpdate (UpdateDataMapType &) 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 VisitNearbyWorldObject (const float &radius, NOTIFIER &notifier) const
 
template<class NOTIFIER >
void VisitNearbyObject (float const &radius, NOTIFIER &notifier) const
 
template<class NOTIFIER >
void VisitNearbyGridObject (float const &radius, NOTIFIER &notifier) const
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
const bool & IsInWorld () const
 
const uint64GetGUID () const
 
uint32 GetGUIDLow () const
 
uint32 GetGUIDMid () const
 
uint32 GetGUIDHigh () const
 
PackedGuid const & GetPackGUID () const
 
ObjectGuid const & GetObjectGUID () const
 
std::string GetGuidStr () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
void SetObjectScale (float scale)
 
uint8 GetTypeId () const
 
bool isType (uint16 mask) const
 
virtual void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target) const
 
void SendUpdateToPlayer (Player *player)
 
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player *target) const
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
void BuildMovementUpdateBlock (UpdateData *data, uint32 flags=0) const
 
virtual void DestroyForPlayer (Player *target, bool onDeath=false) const
 
const int32GetInt32Value (uint16 index) const
 
const uint32GetUInt32Value (uint16 index) const
 
const uint64GetUInt64Value (uint16 index) const
 
const float & GetFloatValue (uint16 index) const
 
uint8 GetByteValue (uint16 index, uint8 offset) const
 
ObjectGuid const & GetGuidValue (uint16 index) const
 
uint16 GetUInt16Value (uint16 index, uint8 offset) const
 
void SetInt32Value (uint16 index, int32 value)
 
void SetUInt32Value (uint16 index, uint32 value)
 
void SetUInt64Value (uint16 index, const uint64 &value)
 
void SetFloatValue (uint16 index, float value)
 
void SetByteValue (uint16 index, uint8 offset, uint8 value)
 
void SetUInt16Value (uint16 index, uint8 offset, uint16 value)
 
void SetInt16Value (uint16 index, uint8 offset, int16 value)
 
void SetStatFloatValue (uint16 index, float value)
 
void SetStatInt32Value (uint16 index, int32 value)
 
bool AddUInt64Value (uint16 index, const uint64 &value)
 
bool RemoveUInt64Value (uint16 index, const uint64 &value)
 
void ApplyModUInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModUInt64Value (uint16 index, int32 val, bool apply)
 
void ApplyModPositiveFloatValue (uint16 index, float val, bool apply)
 
void ApplyModSignedFloatValue (uint16 index, float val, bool apply)
 
void ApplyPercentModFloatValue (uint16 index, float val, bool apply)
 
void SetFlag (uint16 index, uint32 newFlag)
 
void RemoveFlag (uint16 index, uint32 oldFlag)
 
void ToggleFlag (uint16 index, uint32 flag)
 
bool HasFlag (uint16 index, uint32 flag) const
 
void SetByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void RemoveByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void ToggleFlag (uint16 index, uint8 offset, uint8 flag)
 
bool HasByteFlag (uint16 index, uint8 offset, uint8 flag) const
 
void ApplyModFlag (uint16 index, uint32 flag, bool apply)
 
void SetFlag64 (uint16 index, uint64 newFlag)
 
void RemoveFlag64 (uint16 index, uint64 oldFlag)
 
void ToggleFlag64 (uint16 index, uint64 flag)
 
bool HasFlag64 (uint16 index, uint64 flag) const
 
void ApplyModFlag64 (uint16 index, uint64 flag, bool apply)
 
void ClearUpdateMask (bool remove)
 
bool LoadValues (const char *data)
 
uint16 GetValuesCount () const
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &) const
 
void ForceValuesUpdateAtIndex (uint32)
 
PlayerToPlayer ()
 
Player const * ToPlayer () const
 
CreatureToCreature ()
 
Creature const * ToCreature () const
 
UnitToUnit ()
 
Unit const * ToUnit () const
 
GameObjectToGameObject ()
 
GameObject const * ToGameObject () const
 
CorpseToCorpse ()
 
Corpse const * ToCorpse () const
 
DynamicObjectToDynObject ()
 
DynamicObject const * ToDynObject () const
 
- Public Member Functions inherited from WorldLocation
 WorldLocation (uint32 _mapid=MAPID_INVALID, float _x=0, float _y=0, float _z=0, float _o=0)
 
 WorldLocation (const WorldLocation &loc)
 
void WorldRelocate (const WorldLocation &loc)
 
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 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 >
bool IsInGrid () const
 
void AddToGrid (GridRefManager< Creature > &m)
 
void RemoveFromGrid ()
 

Public Attributes

Loot loot
 
uint32 m_spells [CREATURE_MAX_SPELLS]
 
CreatureSpellCooldowns m_CreatureSpellCooldowns
 
CreatureSpellCooldowns m_CreatureCategoryCooldowns
 
uint32 m_GlobalCooldown
 
bool hasPlayerDamaged
 
float m_SightDistance
 
float m_CombatDistance
 
bool m_isTempWorldObject
 
- Public Attributes inherited from Unit
uint32 m_extraAttacks
 
bool m_canDualWield
 
IntervalTimer m_CombatTimer
 
ControlList m_Controlled
 
uint64 m_SummonSlot [MAX_SUMMON_SLOT]
 
uint64 m_ObjectSlot [4]
 
uint32 m_ShapeShiftFormSpellId
 
uint32 m_ShapeShiftModelId
 
ShapeshiftForm m_form
 
float m_modMeleeHitChance
 
float m_modRangedHitChance
 
float m_modSpellHitChance
 
int32 m_baseSpellCritChance
 
float m_threatModifier [MAX_SPELL_SCHOOL]
 
float m_modAttackSpeedPct [3]
 
uint32 _oldFactionId
 
EventProcessor m_Events
 
SpellImmuneList m_spellImmune [MAX_SPELL_IMMUNITY]
 
uint32 m_lastSanctuaryTime
 
uint32 m_AuraFlags
 
Movement::MoveSplinemovespline
 
PetAuraSet m_petAuras
 
bool IsAIEnabled
 
bool NeedChangeAI
 
uint64 LastCharmerGUID
 
bool m_ControlledByPlayer
 
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealth
 
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealthDetect
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibility
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibilityDetect
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibility
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibilityDetect
 
uint32 m_groupLootTimer
 
uint64 lootingGroupLeaderGUID
 
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 (uint32 guidlow, uint32 Entry, uint32 team, const CreatureData *data=NULL)
 
bool InitEntry (uint32 entry, uint32 team=ALLIANCE, const CreatureData *data=NULL)
 
void _RealtimeSetCreatureInfo ()
 
void RegenerateMana ()
 
void RegenerateHealth ()
 
bool IsInvisibleDueToDespawn () const override
 
bool CanAlwaysSee (WorldObject const *obj) const override
 
- Protected Member Functions inherited from Unit
 Unit (bool isWorldObject)
 
void _UpdateSpells (uint32 time)
 
void _DeleteAuras ()
 
void _UpdateAutoRepeatSpell ()
 
void DisableSpline ()
 
bool IsAlwaysVisibleFor (WorldObject const *seer) const override
 
bool IsAlwaysDetectableFor (WorldObject const *seer) const override
 
- Protected Member Functions inherited from WorldObject
 WorldObject (bool isWorldObject)
 
void SetLocationMapId (uint32 _mapId)
 
void SetLocationInstanceId (uint32 _instanceId)
 
- Protected Member Functions inherited from Object
 Object ()
 
void _InitValues ()
 
void _Create (uint32 guidlow, uint32 entry, HighGuid guidhigh)
 
void _LoadIntoDataField (const char *data, uint32 startOffset, uint32 count)
 
virtual void _SetUpdateBits (UpdateMask *updateMask, Player *target) const
 
virtual void _SetCreateBits (UpdateMask *updateMask, Player *target) const
 
void _BuildMovementUpdate (ByteBuffer *data, uint8 updateFlags) const
 
void _BuildValuesUpdate (uint8 updatetype, ByteBuffer *data, UpdateMask *updateMask, Player *target) const
 

Static Protected Member Functions

static float _GetHealthMod (int32 Rank)
 
static float _GetDamageMod (int32 Rank)
 

Protected Attributes

VendorItemCounts m_vendorItemCounts
 
uint32 m_lootMoney
 
uint64 m_lootRecipient
 
uint32 m_lootRecipientGroup
 
uint64 _skinner
 
time_t _pickpocketLootRestore
 Timers. More...
 
uint32 m_corpseRemoveTime
 
time_t m_respawnTime
 
uint32 m_respawnDelay
 
uint32 m_corpseDelay
 
float m_respawnradius
 
uint32 m_combatPulseTime
 
uint32 m_combatPulseDelay
 
uint8 m_emoteState
 
ReactStates m_reactState
 
uint32 m_regenTimer
 
MovementGeneratorType m_defaultMovementType
 
Cell m_currentCell
 
uint32 m_DBTableGuid
 
uint32 m_equipmentId
 
bool m_AlreadyCallAssistance
 
bool m_AlreadySearchedAssistance
 
bool m_regenHealth
 
bool m_AI_locked
 
SpellSchoolMask m_meleeDamageSchoolMask
 
uint32 m_originalEntry
 
Position m_homePosition
 
bool DisableReputationGain
 
CreatureData const * m_creatureData
 
- Protected Attributes inherited from Unit
UnitAIi_AI
 
UnitAIi_disabledAI
 
bool m_AutoRepeatFirstCast
 
bool m_initiatingCombat
 
uint32 m_attackTimer [MAX_ATTACK]
 
float m_createStats [MAX_STATS]
 
AttackerSet m_attackers
 
Unitm_attacking
 
DeathState m_deathState
 
AuraMap m_Auras
 
AuraMap::iterator m_AurasUpdateIterator
 
uint32 m_removedAurasCount
 
DynObjectGUIDs m_dynObjGUIDs
 
std::list< GameObject * > m_gameObj
 
bool m_isSorted
 
uint32 m_transform
 
AuraList m_removedAuras
 
AuraList m_modAuras [TOTAL_AURAS]
 
AuraList m_scAuras
 
AuraList m_interruptableAuras
 
AuraList m_ccAuras
 
uint32 m_interruptMask
 
float m_auraModifiersGroup [UNIT_MOD_END][MODIFIER_TYPE_END]
 
float m_weaponDamage [MAX_ATTACK][2]
 
bool m_canModifyStats
 
float m_speed_rate [MAX_MOVE_TYPE]
 
uint32 m_unitTypeMask
 
CharmInfom_charmInfo
 
SharedVisionList m_sharedVision
 
MotionMaster i_motionMaster
 
uint64 miniPetGuid
 
uint32 m_reactiveTimer [MAX_REACTIVE]
 
ThreatManager m_ThreatManager
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
const bool m_isWorldObject
 
ZoneScriptm_zoneScript
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
uint8 m_objectTypeId
 
uint8 m_updateFlag
 
union {
   int32 *   m_int32Values
 
   uint32 *   m_uint32Values
 
   float *   m_floatValues
 
}; 
 
uint32m_uint32Values_mirror
 
uint16 m_valuesCount
 
bool m_objectUpdated
 

Private Attributes

uint32 m_waypointID
 
uint32 m_path_id
 
CreatureGroupm_formation
 
bool TriggerJustRespawned
 
CreatureInfo const * m_creatureInfo
 
CreatureTextRepeatGroup m_textRepeat
 

Additional Inherited Members

- Public Types inherited from Unit
typedef std::set< Unit * > AttackerSet
 
typedef std::set< Unit * > ControlList
 
typedef std::pair< uint32, uint8spellEffectPair
 
typedef std::multimap< spellEffectPair, Aura * > AuraMap
 
typedef std::list< Aura * > AuraList
 
typedef std::list< DiminishingReturnDiminishing
 
typedef std::set< AuraTypeAuraTypeSet
 
typedef std::set< uint32ComboPointHolderSet
 
typedef std::set< PetAura const * > PetAuraSet
 
- Static Public Member Functions inherited from Unit
static ReputationRank GetFactionReactionTo (FactionTemplateEntry const *factionTemplateEntry, Unit const *target)
 
static bool IsDamageReducedByArmor (SpellSchoolMask damageSchoolMask, SpellEntry const *spellInfo=NULL, uint8 effIndex=MAX_SPELL_EFFECTS)
 
static UnitGetUnit (WorldObject &object, uint64 guid)
 
static PlayerGetPlayer (WorldObject &object, uint64 guid)
 
static CreatureGetCreature (WorldObject &object, uint64 guid)
 
- Static Public Member Functions inherited from WorldObject
static bool InSamePhase (WorldObject const *a, WorldObject const *b)
 
- Static Public Member Functions inherited from Position
static float NormalizeOrientation (float o)
 
- Protected Types inherited from Unit
typedef std::list< uint64DynObjectGUIDs
 

Detailed Description

Definition at line 459 of file Creature.h.

Constructor & Destructor Documentation

Creature::Creature ( bool  isWorldObject = false)
explicit

Definition at line 145 of file Creature.cpp.

References CONFIG_SIGHT_MONSTER, CREATURE_MAX_SPELLS, CREATURE_REGEN_INTERVAL, m_CombatDistance, m_CreatureCategoryCooldowns, m_CreatureSpellCooldowns, m_isTempWorldObject, m_regenTimer, m_SightDistance, m_spells, Object::m_valuesCount, sWorld, TriggerJustRespawned, and UNIT_END.

145  : Unit(isWorldObject),
147  _skinner(0),
148  m_GlobalCooldown(0),
155  m_formation(NULL), m_creatureInfo(NULL)
156 {
159 
160  for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
161  m_spells[i] = 0;
162 
163  m_CreatureSpellCooldowns.clear();
165 
167  m_CombatDistance = 0; // MELEE_RANGE
168 
169  TriggerJustRespawned = false;
170  m_isTempWorldObject = false;
171 }
uint32 m_corpseDelay
Definition: Creature.h:827
CreatureData const * m_creatureData
Definition: Creature.h:854
bool m_isTempWorldObject
Definition: Creature.h:803
time_t m_respawnTime
Definition: Creature.h:825
bool m_AlreadyCallAssistance
Definition: Creature.h:842
bool m_AlreadySearchedAssistance
Definition: Creature.h:843
bool hasPlayerDamaged
Definition: Creature.h:784
uint8 m_emoteState
Definition: Creature.h:832
MovementGeneratorType m_defaultMovementType
Definition: Creature.h:837
time_t _pickpocketLootRestore
Timers.
Definition: Creature.h:823
uint32 m_combatPulseDelay
Definition: Creature.h:830
ReactStates m_reactState
Definition: Creature.h:833
float m_respawnradius
Definition: Creature.h:828
uint32 m_lootRecipientGroup
Definition: Creature.h:819
uint32 m_corpseRemoveTime
Definition: Creature.h:824
uint32 m_spells[CREATURE_MAX_SPELLS]
Definition: Creature.h:604
ACE_UINT8 uint8
Definition: Define.h:73
CreatureGroup * m_formation
Definition: Creature.h:864
#define CREATURE_REGEN_INTERVAL
Definition: Creature.h:125
uint32 m_lootMoney
Definition: Creature.h:817
uint32 m_DBTableGuid
Definition: Creature.h:839
uint32 m_GlobalCooldown
Definition: Creature.h:607
CreatureInfo const * m_creatureInfo
Definition: Creature.h:868
bool m_regenHealth
Definition: Creature.h:844
bool m_AI_locked
Definition: Creature.h:845
uint32 m_combatPulseTime
Definition: Creature.h:829
CreatureSpellCooldowns m_CreatureSpellCooldowns
Definition: Creature.h:605
bool DisableReputationGain
Definition: Creature.h:852
bool TriggerJustRespawned
Definition: Creature.h:866
SpellSchoolMask m_meleeDamageSchoolMask
Definition: Creature.h:847
uint64 _skinner
Definition: Creature.h:820
uint32 m_respawnDelay
Definition: Creature.h:826
uint64 m_lootRecipient
Definition: Creature.h:818
#define CREATURE_MAX_SPELLS
Definition: Unit.h:249
float m_SightDistance
Definition: Creature.h:789
uint16 m_valuesCount
Definition: Object.h:438
uint32 m_regenTimer
Definition: Creature.h:836
#define MELEE_RANGE
Definition: Object.h:48
#define sWorld
Definition: World.h:860
uint32 m_equipmentId
Definition: Creature.h:840
CreatureSpellCooldowns m_CreatureCategoryCooldowns
Definition: Creature.h:606
float m_CombatDistance
Definition: Creature.h:789
Unit(bool isWorldObject)
Definition: Unit.cpp:364
Creature::~Creature ( )
override

Definition at line 173 of file Creature.cpp.

References Unit::i_AI, and m_vendorItemCounts.

174 {
175  m_vendorItemCounts.clear();
176 
177  delete i_AI;
178  i_AI = NULL;
179 }
UnitAI * i_AI
Definition: Unit.h:2004
VendorItemCounts m_vendorItemCounts
Definition: Creature.h:810

Member Function Documentation

void Creature::_AddCreatureCategoryCooldown ( uint32  category,
time_t  apply_time 
)

Definition at line 2242 of file Creature.cpp.

References m_CreatureCategoryCooldowns.

Referenced by AddCreatureSpellCooldown(), and Spell::EffectDummy().

2243 {
2244  m_CreatureCategoryCooldowns[category] = end_time;
2245 }
CreatureSpellCooldowns m_CreatureCategoryCooldowns
Definition: Creature.h:606
void Creature::_AddCreatureSpellCooldown ( uint32  spell_id,
time_t  end_time 
)

Definition at line 2237 of file Creature.cpp.

References m_CreatureSpellCooldowns.

Referenced by Pet::_LoadSpellCooldowns(), AddCreatureSpellCooldown(), and Spell::EffectDummy().

2238 {
2239  m_CreatureSpellCooldowns[spell_id] = end_time;
2240 }
CreatureSpellCooldowns m_CreatureSpellCooldowns
Definition: Creature.h:605
float Creature::_GetDamageMod ( int32  Rank)
staticprotected

Definition at line 1235 of file Creature.cpp.

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

float Creature::_GetHealthMod ( int32  Rank)
staticprotected

Definition at line 1211 of file Creature.cpp.

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

Referenced by LoadCreatureFromDB(), and SelectLevel().

bool Creature::_IsTargetAcceptable ( const Unit target) const

Definition at line 2031 of file Creature.cpp.

References ASSERT, Unit::getAttackerForHelper(), Object::HasFlag(), Unit::HasUnitState(), Unit::IsFriendlyTo(), IsGuard(), Unit::IsHostileTo(), Unit::IsInCombatWith(), Unit::isTargetableForAttack(), UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH, and UNIT_STATE_DIED.

Referenced by canStartAttack().

2032 {
2033  ASSERT(target);
2034 
2035  // if the target cannot be attacked, the target is not acceptable
2036  if (IsFriendlyTo(target)
2037  || !target->isTargetableForAttack(false))
2038  return false;
2039 
2040  if (target->HasUnitState(UNIT_STATE_DIED))
2041  {
2042  // guards can detect fake death
2044  return true;
2045  else
2046  return false;
2047  }
2048 
2049  Unit const* targetVictim = target->getAttackerForHelper();
2050 
2051  // if I'm already fighting target, or I'm hostile towards the target, the target is acceptable
2052  if (IsInCombatWith(target) || IsHostileTo(target))
2053  return true;
2054 
2055  // if the target's victim is friendly, and the target is neutral, the target is acceptable
2056  if (targetVictim && IsFriendlyTo(targetVictim))
2057  return true;
2058 
2059  // if the target's victim is not friendly, or the target is friendly, the target is not acceptable
2060  return false;
2061 }
bool IsFriendlyTo(Unit const *unit) const
Definition: Unit.cpp:7339
bool IsGuard() const
Definition: Creature.h:490
bool IsHostileTo(Unit const *unit) const
Definition: Unit.cpp:7334
Unit * getAttackerForHelper() const
Definition: Unit.cpp:7370
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1030
#define ASSERT
Definition: Errors.h:29
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.h:305
bool IsInCombatWith(Unit const *who) const
Definition: Unit.cpp:498
Definition: Unit.h:908
bool isTargetableForAttack(bool checkFakeDeath=true) const
Definition: Unit.cpp:9495
void Creature::_RealtimeSetCreatureInfo ( )
protected
void Creature::AddCreatureSpellCooldown ( uint32  spellid)

Definition at line 2247 of file Creature.cpp.

References _AddCreatureCategoryCooldown(), _AddCreatureSpellCooldown(), SpellEntry::Category, Unit::GetCharmerOrOwner(), Object::GetGUID(), Unit::GetSpellModOwner(), GetSpellRecoveryTime(), IN_MILLISECONDS, m_GlobalCooldown, SMSG_SPELL_COOLDOWN, SPELLMOD_COOLDOWN, sSpellStore, SpellEntry::StartRecoveryTime, and TYPEID_PLAYER.

Referenced by WorldSession::HandlePetActionHelper(), WorldSession::HandlePetCancelAuraOpcode(), WorldSession::HandlePetCastSpellOpcode(), and PetAI::UpdateAI().

2248 {
2249  SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellid);
2250  if (!spellInfo)
2251  return;
2252 
2253  uint32 cooldown = GetSpellRecoveryTime(spellInfo);
2254  if (Player* modOwner = GetSpellModOwner())
2255  modOwner->ApplySpellMod(spellid, SPELLMOD_COOLDOWN, cooldown);
2256 
2257  if (cooldown)
2258  _AddCreatureSpellCooldown(spellid, time(NULL) + cooldown / IN_MILLISECONDS);
2259 
2260  if (spellInfo->Category)
2261  _AddCreatureCategoryCooldown(spellInfo->Category, time(NULL));
2262 
2263  m_GlobalCooldown = spellInfo->StartRecoveryTime;
2264 
2265  if (Unit* owner = GetCharmerOrOwner())
2266  if (owner->GetTypeId() == TYPEID_PLAYER)
2267  {
2268  WorldPacket data(SMSG_SPELL_COOLDOWN, (4 + 8));
2269  data << uint64(GetGUID());
2270  data << uint8(0x0); // flags (0x1, 0x2)
2271  data << uint32(spellid);
2272  data << uint32(cooldown); // in m.secs
2273 
2274  owner->ToPlayer()->GetSession()->SendPacket(&data);
2275  }
2276 }
uint32 Category
Definition: DBCStructure.h:675
void _AddCreatureSpellCooldown(uint32 spell_id, time_t end_time)
Definition: Creature.cpp:2237
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
ACE_UINT8 uint8
Definition: Define.h:73
uint32 m_GlobalCooldown
Definition: Creature.h:607
ACE_UINT64 uint64
Definition: Define.h:70
Unit * GetCharmerOrOwner() const
Definition: Unit.h:1410
Player * GetSpellModOwner() const
Definition: Unit.cpp:11827
void _AddCreatureCategoryCooldown(uint32 category, time_t apply_time)
Definition: Creature.cpp:2242
uint32 StartRecoveryTime
Definition: DBCStructure.h:758
ACE_UINT32 uint32
Definition: Define.h:71
Definition: Unit.h:908
Definition: Player.h:922
uint32 GetSpellRecoveryTime(SpellEntry const *spellInfo)
Definition: SpellMgr.h:151
const uint64 & GetGUID() const
Definition: Object.h:162
void Creature::AddToWorld ( )
overridevirtual

Reimplemented from Object.

Reimplemented in Pet.

Definition at line 181 of file Creature.cpp.

References ObjectAccessor::AddObject(), Unit::AddToWorld(), AIM_Initialize(), Oregon::Singleton< ObjectAccessor, Oregon::ClassLevelLockable< ObjectAccessor, ACE_Thread_Mutex > >::Instance(), Object::IsInWorld(), WorldObject::m_zoneScript, ZoneScript::OnCreatureCreate(), and SearchFormation().

182 {
183  // Register the creature for guid lookup
184  if (!IsInWorld())
185  {
186  if (m_zoneScript)
187  m_zoneScript->OnCreatureCreate(this, true);
188 
191  SearchFormation();
192  AIM_Initialize();
193  }
194 }
void AddObject(T *object)
void AddToWorld() override
Definition: Unit.cpp:11129
bool AIM_Initialize(CreatureAI *ai=NULL)
Definition: Creature.cpp:746
virtual void OnCreatureCreate(Creature *, bool)
Definition: ZoneScript.h:44
const bool & IsInWorld() const
Definition: Object.h:135
ZoneScript * m_zoneScript
Definition: Object.h:934
void SearchFormation()
Definition: Creature.cpp:220
CreatureAI* Creature::AI ( ) const
inline

Definition at line 517 of file Creature.h.

Referenced by Player::AddQuestAndCheckCompletion(), Unit::Attack(), CanAlwaysSee(), CanCreatureAttack(), Unit::CombatStart(), CreatureUnitRelocationWorker(), Unit::DealDamage(), SummonList::DoAction(), Spell::DoAllEffectOnTarget(), Spell::DoSpellHitOnUnit(), SummonList::DoZoneInCombat(), CreatureAI::DoZoneInCombat(), Spell::EffectDummy(), Spell::EffectSummonType(), Spell::EffectTaunt(), AssistDelayEvent::Execute(), HomeMovementGenerator< Creature >::Finalize(), RotateMovementGenerator::Finalize(), TimedFleeingMovementGenerator::Finalize(), EffectMovementGenerator::Finalize(), WorldSession::HandleGossipHelloOpcode(), WorldSession::HandleGossipSelectOptionOpcode(), WorldSession::HandlePetActionHelper(), WorldSession::HandleQuestgiverChooseRewardOpcode(), WorldSession::HandleQuestgiverHelloOpcode(), WorldSession::HandleSpellClick(), TempSummon::InitSummon(), Unit::Kill(), CreatureGroup::MemberAttackStart(), PointMovementGenerator< Creature >::MovementInform(), WaypointMovementGenerator< T >::MovementInform(), FollowMovementGenerator< T >::MovementInform(), Oregon::CallOfHelpCreatureInRangeDo::operator()(), Aura::PeriodicTick(), CreatureEventAI::ProcessAction(), RemoveCorpse(), Respawn(), Unit::SetInCombatState(), Spell::SummonGuardian(), Unit::TauntApply(), Unit::TauntFadeOut(), Aura::TriggerSpell(), TempSummon::UnSummon(), Update(), and InstanceData::UpdateMinionState().

517 { return (CreatureAI*)i_AI; }
UnitAI * i_AI
Definition: Unit.h:2004
bool Creature::AIM_Initialize ( CreatureAI ai = NULL)

Definition at line 746 of file Creature.cpp.

References Unit::i_AI, Unit::i_motionMaster, MotionMaster::Initialize(), UnitAI::InitializeAI(), Unit::IsAIEnabled, m_AI_locked, FactorySelector::selectAI(), and sLog.

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

747 {
748  // make sure nothing can change the AI during AI update
749  if (m_AI_locked)
750  {
751  sLog.outDebug("AIM_Initialize: failed to init, locked.");
752  return false;
753  }
754 
755  UnitAI* oldAI = i_AI;
757  i_AI = ai ? ai : FactorySelector::selectAI(this);
758  delete oldAI;
759  IsAIEnabled = true;
760  i_AI->InitializeAI();
761  return true;
762 }
#define sLog
Log class singleton.
Definition: Log.h:187
bool IsAIEnabled
Definition: Unit.h:1990
UnitAI * i_AI
Definition: Unit.h:2004
virtual void InitializeAI()
Definition: UnitAI.h:56
CreatureAI * selectAI(Creature *creature)
bool m_AI_locked
Definition: Creature.h:845
MotionMaster i_motionMaster
Definition: Unit.h:2055
void Initialize()
Definition: UnitAI.h:41
void Creature::AllLootRemovedFromCorpse ( )

Definition at line 2348 of file Creature.cpp.

References GetCreatureTemplate(), hasLootRecipient(), LootStore::HaveLootFor(), Unit::IsPet(), loot, LOOT_SKINNING, Loot::loot_type, LootTemplates_Skinning, m_corpseDelay, m_corpseRemoveTime, m_respawnDelay, m_respawnTime, RATE_CORPSE_DECAY_LOOTED, Object::SetFlag(), sWorld, UNIT_FIELD_FLAGS, and UNIT_FLAG_SKINNABLE.

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

2349 {
2350  if (loot.loot_type != LOOT_SKINNING && !IsPet() && GetCreatureTemplate()->SkinLootId && hasLootRecipient())
2353 
2354  time_t now = time(NULL);
2355  // Do not reset corpse remove time if corpse is already removed
2356  if (m_corpseRemoveTime <= now)
2357  return;
2358 
2359  float decayRate = sWorld.getRate(RATE_CORPSE_DECAY_LOOTED);
2360 
2361  // corpse skinnable, but without skinning flag, and then skinned, corpse will despawn next update
2362  if (loot.loot_type == LOOT_SKINNING)
2363  m_corpseRemoveTime = now;
2364  else
2365  m_corpseRemoveTime = now + uint32(m_corpseDelay * decayRate);
2366 
2368 }
uint32 m_corpseDelay
Definition: Creature.h:827
time_t m_respawnTime
Definition: Creature.h:825
Loot loot
Definition: Creature.h:587
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:985
uint32 m_corpseRemoveTime
Definition: Creature.h:824
bool HaveLootFor(uint32 loot_id) const
Definition: LootMgr.h:184
bool IsPet() const
Definition: Unit.h:1048
uint32 m_respawnDelay
Definition: Creature.h:826
CreatureInfo const * GetCreatureTemplate() const
Definition: Creature.h:557
LootType loot_type
Definition: LootMgr.h:312
bool hasLootRecipient() const
Definition: Creature.h:595
#define sWorld
Definition: World.h:860
ACE_UINT32 uint32
Definition: Define.h:71
LootStore LootTemplates_Skinning("skinning_loot_template","creature skinning id")
void Creature::CalculateMinMaxDamage ( WeaponAttackType  attType,
bool  normalized,
bool  addTotalPct,
float &  minDamage,
float &  maxDamage 
)
overridevirtual

Implements Unit.

Definition at line 843 of file StatSystem.cpp.

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

844 {
845  float variance = 1.0f;
846  UnitMods unitMod;
847  switch (attType)
848  {
849  case BASE_ATTACK:
850  default:
851  variance = GetCreatureTemplate()->BaseVariance;
852  unitMod = UNIT_MOD_DAMAGE_MAINHAND;
853  break;
854  case OFF_ATTACK:
855  variance = GetCreatureTemplate()->BaseVariance;
856  unitMod = UNIT_MOD_DAMAGE_OFFHAND;
857  break;
858  case RANGED_ATTACK:
859  variance = GetCreatureTemplate()->RangeVariance;
860  unitMod = UNIT_MOD_DAMAGE_RANGED;
861  break;
862  }
863 
864  if (attType == OFF_ATTACK && !haveOffhandWeapon())
865  {
866  minDamage = 0.0f;
867  maxDamage = 0.0f;
868  return;
869  }
870 
871  float weaponMinDamage = GetWeaponDamageRange(attType, MINDAMAGE);
872  float weaponMaxDamage = GetWeaponDamageRange(attType, MAXDAMAGE);
873 
874  if (!CanUseAttackType(attType)) // disarm case
875  {
876  weaponMinDamage = 0.0f;
877  weaponMaxDamage = 0.0f;
878  }
879 
880  float attackPower = GetTotalAttackPowerValue(attType);
881  float attackSpeedMulti = GetAPMultiplier(attType, normalized);
882  float baseValue = GetModifierValue(unitMod, BASE_VALUE) + (attackPower / 14.0f) * variance;
883  float basePct = GetModifierValue(unitMod, BASE_PCT) * attackSpeedMulti;
884  float totalValue = GetModifierValue(unitMod, TOTAL_VALUE);
885  float totalPct = addTotalPct ? GetModifierValue(unitMod, TOTAL_PCT) : 1.0f;
886  float dmgMultiplier = GetCreatureTemplate()->ModDamage; // = ModDamage * _GetDamageMod(rank);
887 
888  minDamage = ((weaponMinDamage + baseValue) * dmgMultiplier * basePct + totalValue) * totalPct;
889  maxDamage = ((weaponMaxDamage + baseValue) * dmgMultiplier * basePct + totalValue) * totalPct;
890 }
float ModDamage
Definition: Creature.h:190
UnitMods
Definition: Unit.h:384
float BaseVariance
Definition: Creature.h:159
float GetAPMultiplier(WeaponAttackType attType, bool normalized)
Definition: Unit.cpp:12264
float GetModifierValue(UnitMods unitMod, UnitModifierType modifierType) const
Definition: Unit.cpp:10769
bool haveOffhandWeapon() const
Definition: Unit.cpp:616
bool CanUseAttackType(uint8 attacktype) const
Definition: Unit.cpp:2764
float GetWeaponDamageRange(WeaponAttackType attType, WeaponDamageRange type) const
Definition: Unit.cpp:10888
CreatureInfo const * GetCreatureTemplate() const
Definition: Creature.h:557
Definition: Unit.h:354
float GetTotalAttackPowerValue(WeaponAttackType attType) const
Definition: Unit.cpp:10870
float RangeVariance
Definition: Creature.h:160
void Creature::CallAssistance ( )

Definition at line 1925 of file Creature.cpp.

References AssistDelayEvent::AddAssistant(), EventProcessor::AddEvent(), EventProcessor::CalculateTime(), Oregon::ComputeCellCoord(), CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY, CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS, Object::GetGUID(), WorldObject::GetMap(), Position::GetPositionX(), Position::GetPositionY(), Unit::GetVictim(), Unit::isCharmed(), Unit::IsPet(), m_AlreadyCallAssistance, Unit::m_Events, SetNoCallAssistance(), Cell::SetNoCreate(), sWorld, and Cell::Visit().

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

1926 {
1927  if (!m_AlreadyCallAssistance && GetVictim() && !IsPet() && !isCharmed())
1928  {
1929  SetNoCallAssistance(true);
1930 
1931  float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS);
1932 
1933  if (radius > 0)
1934  {
1935  std::list<Creature*> assistList;
1936 
1937  {
1939  Cell cell(p);
1940  cell.SetNoCreate();
1941 
1942  Oregon::AnyAssistCreatureInRangeCheck u_check(this, GetVictim(), radius);
1943  Oregon::CreatureListSearcher<Oregon::AnyAssistCreatureInRangeCheck> searcher(this, assistList, u_check);
1944 
1946 
1947  cell.Visit(p, grid_creature_searcher, *GetMap(), *this, radius);
1948  }
1949 
1950  if (!assistList.empty())
1951  {
1952  AssistDelayEvent* e = new AssistDelayEvent(GetVictim()->GetGUID(), *this);
1953  while (!assistList.empty())
1954  {
1955  // Pushing guids because in delay can happen some creature gets despawned => invalid pointer
1956  e->AddAssistant((*assistList.begin())->GetGUID());
1957  assistList.pop_front();
1958  }
1960  }
1961  }
1962  }
1963 }
EventProcessor m_Events
Definition: Unit.h:1636
Map * GetMap() const
Definition: Object.h:841
void SetNoCallAssistance(bool val)
Definition: Creature.h:622
void AddEvent(BasicEvent *Event, uint64 e_time, bool set_addtime=true)
bool m_AlreadyCallAssistance
Definition: Creature.h:842
void AddAssistant(const uint64 &guid)
Definition: Creature.h:879
uint64 CalculateTime(uint64 t_offset)
Unit * GetVictim() const
Definition: Unit.h:1013
float GetPositionY() const
Definition: Position.h:98
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:167
bool IsPet() const
Definition: Unit.h:1048
Definition: Cell.h:46
#define sWorld
Definition: World.h:860
bool isCharmed() const
Definition: Unit.h:1434
float GetPositionX() const
Definition: Position.h:97
const uint64 & GetGUID() const
Definition: Object.h:162
void Creature::CallForHelp ( float  fRadius)

Definition at line 1965 of file Creature.cpp.

References Oregon::ComputeCellCoord(), WorldObject::GetMap(), Position::GetPositionX(), Position::GetPositionY(), Unit::GetVictim(), Unit::isCharmed(), Unit::IsPet(), Cell::SetNoCreate(), and Cell::Visit().

Referenced by CreatureEventAI::ProcessAction().

1966 {
1967  if (radius <= 0.0f || !GetVictim() || IsPet() || isCharmed())
1968  return;
1969 
1971  Cell cell(p);
1972  cell.SetNoCreate();
1973 
1974  Oregon::CallOfHelpCreatureInRangeDo u_do(this, GetVictim(), radius);
1976 
1978 
1979  cell.Visit(p, grid_creature_searcher, *GetMap(), *this, radius);
1980 }
Map * GetMap() const
Definition: Object.h:841
Unit * GetVictim() const
Definition: Unit.h:1013
float GetPositionY() const
Definition: Position.h:98
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:167
bool IsPet() const
Definition: Unit.h:1048
Definition: Cell.h:46
bool isCharmed() const
Definition: Unit.h:1434
float GetPositionX() const
Definition: Position.h:97
bool Creature::CanAlwaysSee ( WorldObject const *  obj) const
overrideprotectedvirtual

Reimplemented from WorldObject.

Definition at line 1491 of file Creature.cpp.

References AI(), and Unit::IsAIEnabled.

1492 {
1493  if (IsAIEnabled && AI()->CanSeeAlways(obj))
1494  return true;
1495 
1496  return false;
1497 }
bool IsAIEnabled
Definition: Unit.h:1990
CreatureAI * AI() const
Definition: Creature.h:517
bool Creature::CanAssistTo ( const Unit u,
const Unit enemy,
bool  checkfaction = true 
) const

Definition at line 1982 of file Creature.cpp.

References Unit::GetCharmerOrOwnerGUID(), Unit::GetFaction(), Object::HasFlag(), HasReactState(), Unit::IsAlive(), IsCivilian(), Unit::IsFriendlyTo(), Unit::IsHostileTo(), Unit::IsInCombat(), IsInEvadeMode(), REACT_AGGRESSIVE, UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC, UNIT_FLAG_NON_ATTACKABLE, and UNIT_FLAG_NOT_SELECTABLE.

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

1983 {
1984  if (IsInEvadeMode())
1985  return false;
1986 
1987  // is it true?
1989  return false;
1990 
1991  // we don't need help from zombies :)
1992  if (!IsAlive())
1993  return false;
1994 
1995  // we don't need help from non-combatant ;)
1996  if (IsCivilian())
1997  return false;
1998 
2000  return false;
2001 
2002  // skip fighting creature
2003  if (IsInCombat())
2004  return false;
2005 
2006  // only free creature
2007  if (GetCharmerOrOwnerGUID())
2008  return false;
2009 
2010  // only from same creature faction
2011  if (checkfaction)
2012  {
2013  if (GetFaction() != u->GetFaction())
2014  return false;
2015  }
2016  else
2017  {
2018  if (!IsFriendlyTo(u))
2019  return false;
2020  }
2021 
2022  // skip non hostile to caster enemy creatures
2023  if (!IsHostileTo(enemy))
2024  return false;
2025 
2026  return true;
2027 }
uint32 GetFaction() const
Definition: Unit.h:1116
bool IsInCombat() const
Definition: Unit.h:1243
bool HasReactState(ReactStates state) const
Definition: Creature.h:497
bool IsInEvadeMode() const
Definition: Creature.cpp:2298
uint64 GetCharmerOrOwnerGUID() const
Definition: Unit.h:1387
bool IsAlive() const
Definition: Unit.h:1336
bool IsFriendlyTo(Unit const *unit) const
Definition: Unit.cpp:7339
bool IsCivilian() const
Definition: Creature.h:488
bool IsHostileTo(Unit const *unit) const
Definition: Unit.cpp:7334
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.h:305
bool Creature::CanCreatureAttack ( Unit const *  victim,
bool  force = true 
) const

Definition at line 2071 of file Creature.cpp.

References AI(), UnitAI::CanAIAttack(), CONFIG_THREAT_RADIUS, GetAttackDistance(), Unit::GetCharmerOrOwner(), GetCreatureTemplate(), Unit::GetLastDamagedTime(), WorldObject::GetMap(), getMSTime(), WorldObject::GetObjectSize(), Object::GetTypeId(), Unit::HasAuraType(), INHABIT_AIR, Unit::IsAIEnabled, Map::IsDungeon(), Unit::isInAccessiblePlaceFor(), Position::IsInDist(), Position::IsInDist2d(), IsInEvadeMode(), WorldObject::IsInMap(), Unit::IsValidAttackTarget(), WorldObject::IsWithinDist(), isWorldBoss(), m_CombatDistance, m_homePosition, SPELL_AURA_MOD_TAUNT, sWorld, Object::ToCreature(), TYPEID_PLAYER, and TYPEID_UNIT.

Referenced by canStartAttack(), and ThreatContainer::selectNextVictim().

2072 {
2073  if (!victim)
2074  return false;
2075 
2076  if (!victim->IsInMap(this))
2077  return false;
2078 
2079  if (!IsValidAttackTarget(victim))
2080  return false;
2081 
2082  if (!victim->isInAccessiblePlaceFor(this))
2083  return false;
2084 
2085  if (IsAIEnabled && !AI()->CanAIAttack(victim))
2086  return false;
2087 
2088  // we cannot attack in evade mode
2089  if (IsInEvadeMode())
2090  return false;
2091 
2092  // or if enemy is in evade mode
2093  if (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsInEvadeMode())
2094  return false;
2095 
2096  if (GetMap()->IsDungeon())
2097  return true;
2098 
2099  if (Unit* u = GetCharmerOrOwner())
2100  {
2101  if (u->GetTypeId() != TYPEID_PLAYER)
2102  {
2103  // don't check distance to home position if recently damaged, this should include taunt auras
2105  return true;
2106  }
2107  }
2108 
2109  // Get the correct threat range from the config.
2110  float dist = std::max<float>(GetAttackDistance(victim), sWorld.getConfig(CONFIG_THREAT_RADIUS) + m_CombatDistance);
2111 
2112  if (Unit* unit = GetCharmerOrOwner())
2113  return victim->IsWithinDist(unit, dist);
2114  else
2115  {
2116  // include sizes for huge npcs
2117  dist += GetObjectSize() + victim->GetObjectSize();
2118 
2119  // to prevent creatures in air ignore attacks because distance is already too high...
2120  if (GetCreatureTemplate()->InhabitType & INHABIT_AIR)
2121  return victim->IsInDist2d(&m_homePosition, dist);
2122  else
2123  return victim->IsInDist(&m_homePosition, dist);
2124  }
2125 }
time_t GetLastDamagedTime() const
Definition: Unit.h:1995
Position m_homePosition
Definition: Creature.h:850
Map * GetMap() const
Definition: Object.h:841
uint32 getMSTime()
Definition: Timer.h:32
bool IsValidAttackTarget(Unit const *target) const
Definition: Unit.cpp:9510
bool IsInEvadeMode() const
Definition: Creature.cpp:2298
bool IsDungeon() const
Definition: Map.h:427
virtual bool CanAIAttack(const Unit *) const
Definition: UnitAI.h:49
bool IsAIEnabled
Definition: Unit.h:1990
CreatureAI * AI() const
Definition: Creature.h:517
float GetAttackDistance(Unit const *pl) const
Definition: Creature.cpp:1537
CreatureInfo const * GetCreatureTemplate() const
Definition: Creature.h:557
Unit * GetCharmerOrOwner() const
Definition: Unit.h:1410
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:832
#define sWorld
Definition: World.h:860
bool isWorldBoss() const
Definition: Creature.cpp:1757
Definition: Unit.h:908
float m_CombatDistance
Definition: Creature.h:789
float GetObjectSize() const
Definition: Object.h:669
bool Creature::CanGeneratePickPocketLoot ( ) const
inline

Definition at line 590 of file Creature.h.

Referenced by Player::SendLoot().

590 { return _pickpocketLootRestore <= time(NULL); }
time_t _pickpocketLootRestore
Timers.
Definition: Creature.h:823
bool Creature::CanInteractWithBattleMaster ( Player player,
bool  msg 
) const

Definition at line 962 of file Creature.cpp.

References BATTLEGROUND_AA, BATTLEGROUND_AB, BATTLEGROUND_AV, BATTLEGROUND_BE, BATTLEGROUND_EY, BATTLEGROUND_NA, BATTLEGROUND_RL, BATTLEGROUND_WS, PlayerMenu::ClearMenus(), Player::GetBGAccessByLevel(), Object::GetEntry(), Object::GetGUID(), Unit::IsBattleMaster(), Player::PlayerTalkClass, PlayerMenu::SendGossipMenu(), and sObjectMgr.

Referenced by Player::PrepareGossipMenu().

963 {
964  if (!IsBattleMaster())
965  return false;
966 
967  uint32 bgTypeId = sObjectMgr.GetBattleMasterBG(GetEntry());
968  if (!msg)
969  return player->GetBGAccessByLevel(bgTypeId);
970 
971  if (!player->GetBGAccessByLevel(bgTypeId))
972  {
973  player->PlayerTalkClass->ClearMenus();
974  switch (bgTypeId)
975  {
976  case BATTLEGROUND_AV: player->PlayerTalkClass->SendGossipMenu(7616, GetGUID()); break;
977  case BATTLEGROUND_WS: player->PlayerTalkClass->SendGossipMenu(7599, GetGUID()); break;
978  case BATTLEGROUND_AB: player->PlayerTalkClass->SendGossipMenu(7642, GetGUID()); break;
979  case BATTLEGROUND_EY:
980  case BATTLEGROUND_NA:
981  case BATTLEGROUND_BE:
982  case BATTLEGROUND_AA:
983  case BATTLEGROUND_RL: player->PlayerTalkClass->SendGossipMenu(10024, GetGUID()); break;
984  default: break;
985  }
986  return false;
987  }
988  return true;
989 }
PlayerMenu * PlayerTalkClass
Definition: Player.h:2182
void ClearMenus()
Definition: GossipDef.cpp:116
bool IsBattleMaster() const
Definition: Unit.h:1220
void SendGossipMenu(uint32 TitleTextId, uint64 npcGUID)
Definition: GossipDef.cpp:137
#define sObjectMgr
Definition: ObjectMgr.h:1285
uint32 GetEntry() const
Definition: Object.h:192
ACE_UINT32 uint32
Definition: Define.h:71
bool GetBGAccessByLevel(uint32 bgTypeId) const
Definition: Player.cpp:19430
const uint64 & GetGUID() const
Definition: Object.h:162
bool Creature::canStartAttack ( Unit const *  u,
bool  force 
) const

Definition at line 1499 of file Creature.cpp.

References _IsTargetAcceptable(), ATTACK_DISTANCE, CanCreatureAttack(), CanFly(), CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS, CREATURE_TYPE_NON_COMBAT_PET, CREATURE_Z_ATTACK_RANGE, GetAttackDistance(), Unit::getAttackerForHelper(), Unit::GetCreatureType(), WorldObject::GetDistanceZ(), Unit::GetOwner(), Object::GetTypeId(), Object::HasFlag(), IsCivilian(), Unit::IsInCombat(), Unit::IsNeutralToAll(), WorldObject::IsWithinDist(), WorldObject::IsWithinDistInMap(), WorldObject::IsWithinLOSInMap(), m_CombatDistance, sWorld, TYPEID_PLAYER, TYPEID_UNIT, UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC, and UNIT_FLAG_IMMUNE_TO_PC.

Referenced by CreatureAI::MoveInLineOfSight(), and Update().

1500 {
1501  if (IsCivilian())
1502  return false;
1503 
1504  // This set of checks is should be done only for creatures
1505  if ((HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC) && who->GetTypeId() != TYPEID_PLAYER) // flag is valid only for non player characters
1506  || (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) && who->GetTypeId() == TYPEID_PLAYER) // immune to PC and target is a player, return false
1507  || (who->GetOwner() && who->GetOwner()->GetTypeId() == TYPEID_PLAYER && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC))) // player pets are immune to pc as well
1508  return false;
1509 
1510  // Do not attack non-combat pets
1511  if (who->GetTypeId() == TYPEID_UNIT && who->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET)
1512  return false;
1513 
1515  return false;
1516 
1517  if (!force)
1518  {
1519  if (!_IsTargetAcceptable(who))
1520  return false;
1521 
1522  if (who->IsInCombat() && IsWithinDist(who, ATTACK_DISTANCE))
1523  if (Unit* victim = who->getAttackerForHelper())
1525  force = true;
1526 
1527  if (!force && (IsNeutralToAll() || !IsWithinDistInMap(who, GetAttackDistance(who) + m_CombatDistance)))
1528  return false;
1529  }
1530 
1531  if (!CanCreatureAttack(who, force))
1532  return false;
1533 
1534  return IsWithinLOSInMap(who);
1535 }
#define ATTACK_DISTANCE
Definition: Object.h:36
#define CREATURE_Z_ATTACK_RANGE
Definition: Creature.h:451
bool CanFly() const
Definition: Creature.h:493
bool IsWithinLOSInMap(const WorldObject *obj) const
Definition: Object.cpp:1229
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition: Object.h:774
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition: Object.h:770
bool _IsTargetAcceptable(const Unit *target) const
Definition: Creature.cpp:2031
bool IsNeutralToAll() const
Definition: Unit.cpp:7357
float GetAttackDistance(Unit const *pl) const
Definition: Creature.cpp:1537
bool IsCivilian() const
Definition: Creature.h:488
bool CanCreatureAttack(Unit const *victim, bool force=true) const
Definition: Creature.cpp:2071
Unit * getAttackerForHelper() const
Definition: Unit.cpp:7370
#define sWorld
Definition: World.h:860
float GetDistanceZ(const WorldObject *obj) const
Definition: Object.cpp:1195
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.h:305
Definition: Unit.h:908
float m_CombatDistance
Definition: Creature.h:789
bool Creature::CanSwim ( ) const
inline

Definition at line 492 of file Creature.h.

References GetCreatureTemplate(), and INHABIT_WATER.

Referenced by PathInfo::BuildPolyPath(), PathInfo::createFilter(), Unit::isInAccessiblePlaceFor(), and UpdateMovementFlags().

492 { return (GetCreatureTemplate()->InhabitType & INHABIT_WATER) != 0 || IsPet(); }
bool IsPet() const
Definition: Unit.h:1048
CreatureInfo const * GetCreatureTemplate() const
Definition: Creature.h:557
bool Creature::CanTrainAndResetTalentsOf ( Player pPlayer) const

Definition at line 991 of file Creature.cpp.

References CreatureInfo::classNum, Unit::getClass(), GetCreatureTemplate(), Unit::getLevel(), CreatureInfo::trainer_type, and TRAINER_TYPE_CLASS.

Referenced by Player::PrepareGossipMenu().

992 {
993  return player->getLevel() >= 10
995  && player->getClass() == GetCreatureTemplate()->classNum;
996 }
uint32 trainer_type
Definition: Creature.h:165
CreatureInfo const * GetCreatureTemplate() const
Definition: Creature.h:557
uint32 classNum
Definition: Creature.h:167
bool Creature::CanWalk ( ) const
inline

Definition at line 491 of file Creature.h.

References GetCreatureTemplate(), and INHABIT_GROUND.

Referenced by PathInfo::createFilter(), and Unit::isInAccessiblePlaceFor().

491 { return (GetCreatureTemplate()->InhabitType & INHABIT_GROUND) != 0; }
CreatureInfo const * GetCreatureTemplate() const
Definition: Creature.h:557
void Creature::ClearTextRepeatGroup ( uint8  textGroup)

Definition at line 2676 of file Creature.cpp.

References m_textRepeat.

Referenced by CreatureTextMgr::SendChat().

2677 {
2678  CreatureTextRepeatGroup::iterator groupItr = m_textRepeat.find(textGroup);
2679  if (groupItr != m_textRepeat.end())
2680  groupItr->second.clear();
2681 }
CreatureTextRepeatGroup m_textRepeat
Definition: Creature.h:870
bool Creature::Create ( uint32  guidlow,
Map map,
uint32  phaseMask,
uint32  Entry,
uint32  team,
float  x,
float  y,
float  z,
float  ang,
const CreatureData data = NULL 
)

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

Todo:
Replace with spell, handle from DB

Definition at line 764 of file Creature.cpp.

References ASSERT, CONFIG_CORPSE_DECAY_ELITE, CONFIG_CORPSE_DECAY_NORMAL, CONFIG_CORPSE_DECAY_RARE, CONFIG_CORPSE_DECAY_RAREELITE, CONFIG_CORPSE_DECAY_WORLDBOSS, CreateFromProto(), CREATURE_ELITE_ELITE, CREATURE_ELITE_RARE, CREATURE_ELITE_RAREELITE, CREATURE_ELITE_WORLDBOSS, CREATURE_TYPE_FLAG_GHOST_VISIBLE, GetCreatureTemplate(), GHOST_VISIBILITY_ALIVE, GHOST_VISIBILITY_GHOST, Position::IsPositionValid(), Unit::IsSpiritGuide(), Unit::IsSpiritHealer(), m_corpseDelay, WorldObject::m_serverSideVisibility, WorldObject::m_serverSideVisibilityDetect, Position::Relocate(), SERVERSIDE_VISIBILITY_GHOST, WorldObject::SetMap(), Unit::SetPhaseMask(), FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue(), sLog, sObjectMgr, sWorld, and CreatureInfo::type_flags.

Referenced by Battleground::AddCreature(), ChatHandler::HandleNpcAddCommand(), ChatHandler::HandleWpModifyCommand(), ChatHandler::HandleWpShowCommand(), LoadCreatureFromDB(), and Map::SummonCreature().

765 {
766  ASSERT(map);
767  SetMap(map);
768  SetPhaseMask(phaseMask, false);
769 
770  CreatureInfo const* cinfo = sObjectMgr.GetCreatureTemplate(entry);
771  if (!cinfo)
772  {
773  sLog.outError("Creature::Create(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, entry);
774  return false;
775  }
776 
779  Relocate(x, y, z, ang);
780 
781  if (!IsPositionValid())
782  {
783  sLog.outError("Creature (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow, entry, x, y);
784  return false;
785  }
786 
787  // Allow players to see those units while dead, do it here (mayby altered by addon auras)
790 
791  if (!CreateFromProto(guidlow, entry, team, data))
792  return false;
793 
794  switch (GetCreatureTemplate()->rank)
795  {
796  case CREATURE_ELITE_RARE:
798  break;
801  break;
804  break;
807  break;
808  default:
810  break;
811  }
812 
814  if (IsSpiritHealer() || IsSpiritGuide())
815  {
818  }
819 
820  return true;
821 }
uint32 m_corpseDelay
Definition: Creature.h:827
bool IsSpiritHealer() const
Definition: Unit.h:1223
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition: Object.h:833
virtual void SetMap(Map *map)
Definition: Object.cpp:1954
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:626
#define sLog
Log class singleton.
Definition: Log.h:187
#define sObjectMgr
Definition: ObjectMgr.h:1285
bool IsSpiritGuide() const
Definition: Unit.h:1224
void Relocate(float x, float y)
Definition: Position.h:65
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition: Unit.cpp:13499
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
Definition: Object.h:834
bool CreateFromProto(uint32 guidlow, uint32 Entry, uint32 team, const CreatureData *data=NULL)
Definition: Creature.cpp:1273
CreatureInfo const * GetCreatureTemplate() const
Definition: Creature.h:557
#define ASSERT
Definition: Errors.h:29
bool IsPositionValid() const
Definition: Position.cpp:40
#define sWorld
Definition: World.h:860
uint32 type_flags
Definition: Creature.h:170
bool Creature::CreateFromProto ( uint32  guidlow,
uint32  Entry,
uint32  team,
const CreatureData data = NULL 
)
protected

Definition at line 1273 of file Creature.cpp.

References Object::_Create(), ZoneScript::GetCreatureEntry(), HIGHGUID_UNIT, WorldObject::m_zoneScript, SetOriginalEntry(), WorldObject::SetZoneScript(), sLog, sObjectMgr, and UpdateEntry().

Referenced by Create().

1274 {
1275  SetZoneScript();
1276  if (m_zoneScript && data)
1277  {
1278  entry = m_zoneScript->GetCreatureEntry(guidlow, data);
1279  if (!entry)
1280  return false;
1281  }
1282 
1283  CreatureInfo const* cinfo = sObjectMgr.GetCreatureTemplate(entry);
1284  if (!cinfo)
1285  {
1286  sLog.outErrorDb("Creature::CreateFromProto(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, entry);
1287  return false;
1288  }
1289 
1290  SetOriginalEntry(entry);
1291 
1292  Object::_Create(guidlow, entry, HIGHGUID_UNIT);
1293 
1294  if (!UpdateEntry(entry, team, data))
1295  return false;
1296 
1297  return true;
1298 }
#define sLog
Log class singleton.
Definition: Log.h:187
#define sObjectMgr
Definition: ObjectMgr.h:1285
void _Create(uint32 guidlow, uint32 entry, HighGuid guidhigh)
Definition: Object.cpp:125
ZoneScript * m_zoneScript
Definition: Object.h:934
void SetOriginalEntry(uint32 entry)
Definition: Creature.h:787
virtual uint32 GetCreatureEntry(uint32, const CreatureData *data)
Definition: ZoneScript.h:35
bool UpdateEntry(uint32 entry, uint32 team=ALLIANCE, const CreatureData *data=NULL)
Definition: Creature.cpp:353
void SetZoneScript()
Definition: Object.cpp:2102
void Creature::DeleteFromDB ( )
virtual

Reimplemented in Pet.

Definition at line 1461 of file Creature.cpp.

References Database::BeginTransaction(), Database::CommitTransaction(), WorldObject::GetInstanceId(), m_DBTableGuid, Database::PExecuteLog(), sLog, sObjectMgr, and WorldDatabase.

Referenced by ChatHandler::HandleNpcDeleteCommand(), ChatHandler::HandleWpModifyCommand(), and ChatHandler::HandleWpShowCommand().

1462 {
1463  if (!m_DBTableGuid)
1464  {
1465  sLog.outDebug("Trying to delete not saved creature!");
1466  return;
1467  }
1468 
1469  sObjectMgr.SaveCreatureRespawnTime(m_DBTableGuid, GetInstanceId(), 0);
1470  sObjectMgr.DeleteCreatureData(m_DBTableGuid);
1471 
1473  WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid = '%u'", m_DBTableGuid);
1474  WorldDatabase.PExecuteLog("DELETE FROM creature_addon WHERE guid = '%u'", m_DBTableGuid);
1475  WorldDatabase.PExecuteLog("DELETE FROM game_event_creature WHERE guid = '%u'", m_DBTableGuid);
1476  WorldDatabase.PExecuteLog("DELETE FROM game_event_model_equip WHERE guid = '%u'", m_DBTableGuid);
1478 }
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
bool BeginTransaction()
Definition: Database.cpp:533
#define sLog
Log class singleton.
Definition: Log.h:187
#define sObjectMgr
Definition: ObjectMgr.h:1285
bool CommitTransaction()
Definition: Database.cpp:551
bool PExecuteLog(const char *format,...) ATTR_PRINTF(2
Definition: Database.cpp:221
uint32 m_DBTableGuid
Definition: Creature.h:839
uint32 GetInstanceId() const
Definition: Object.h:688
void Creature::DespawnOrUnsummon ( uint32  msTimeToDespawn = 0)

Definition at line 1718 of file Creature.cpp.

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

Referenced by SmartAI::UpdateDespawn().

1719 {
1720  if (TempSummon* summon = this->ToTempSummon())
1721  summon->UnSummon(msTimeToDespawn);
1722  else
1723  ForcedDespawn(msTimeToDespawn);
1724 }
void ForcedDespawn(uint32 timeMSToDespawn=0)
Definition: Creature.cpp:1702
TempSummon * ToTempSummon()
Definition: Unit.h:1998
void Creature::DisappearAndDie ( )

Definition at line 212 of file Creature.cpp.

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

Referenced by SummonList::DespawnAll(), and ChatHandler::HandleSpellCrashTestCommand().

213 {
215  if (IsAlive())
217  RemoveCorpse(false);
218 }
void setDeathState(DeathState s) override
Definition: Creature.cpp:1575
bool IsAlive() const
Definition: Unit.h:1336
void RemoveCorpse(bool setSpawnTime=true)
Definition: Creature.cpp:234
void DestroyForNearbyPlayers()
Definition: Object.cpp:2565
void Creature::DoFleeToGetAssistance ( )

Definition at line 712 of file Creature.cpp.

References Oregon::ComputeCellCoord(), CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS, WorldObject::GetMap(), Unit::GetMotionMaster(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Unit::GetVictim(), Unit::HasAuraType(), MOVE_RUN, MotionMaster::MoveSeekAssistance(), Unit::SetControlled(), Cell::SetNoCreate(), SetNoSearchAssistance(), SPELL_AURA_PREVENTS_FLEEING, sWorld, UNIT_STATE_FLEEING, Unit::UpdateSpeed(), and Cell::Visit().

Referenced by CreatureEventAI::ProcessAction().

713 {
714  if (!GetVictim())
715  return;
716 
718  return;
719 
720  float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS);
721  if (radius > 0)
722  {
723  Creature* creature = NULL;
724 
726  Cell cell(p);
727  cell.SetNoCreate();
730 
732 
733  cell.Visit(p, grid_creature_searcher, *GetMap(), *this, radius);
734 
735  SetNoSearchAssistance(true);
736  UpdateSpeed(MOVE_RUN, false);
737 
738  if (!creature)
740  else
741  GetMotionMaster()->MoveSeekAssistance(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ());
742  }
743 
744 }
Map * GetMap() const
Definition: Object.h:841
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition: Unit.cpp:9885
MotionMaster * GetMotionMaster()
Definition: Unit.h:1890
void SetControlled(bool apply, UnitState state)
Definition: Unit.cpp:12872
void MoveSeekAssistance(float x, float y, float z)
Unit * GetVictim() const
Definition: Unit.h:1013
float GetPositionY() const
Definition: Position.h:98
float GetPositionZ() const
Definition: Position.h:99
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:167
Definition: Cell.h:46
Definition: Unit.h:485
void SetNoSearchAssistance(bool val)
Definition: Creature.h:623
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:832
#define sWorld
Definition: World.h:860
float GetPositionX() const
Definition: Position.h:97
void Creature::ForcedDespawn ( uint32  timeMSToDespawn = 0)

Definition at line 1702 of file Creature.cpp.

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

Referenced by DespawnOrUnsummon(), Spell::EffectDummy(), Spell::EffectTameCreature(), FollowerAI::MovementInform(), CreatureEventAI::ProcessAction(), Aura::TriggerSpell(), FollowerAI::UpdateAI(), and npc_escortAI::UpdateAI().

1703 {
1704  if (timeMSToDespawn)
1705  {
1706  ForcedDespawnDelayEvent* pEvent = new ForcedDespawnDelayEvent(*this);
1707 
1708  m_Events.AddEvent(pEvent, m_Events.CalculateTime(timeMSToDespawn));
1709  return;
1710  }
1711 
1712  if (IsAlive())
1714 
1715  RemoveCorpse(false);
1716 }
EventProcessor m_Events
Definition: Unit.h:1636
void AddEvent(BasicEvent *Event, uint64 e_time, bool set_addtime=true)
uint64 CalculateTime(uint64 t_offset)
void setDeathState(DeathState s) override
Definition: Creature.cpp:1575
bool IsAlive() const
Definition: Unit.h:1336
void RemoveCorpse(bool setSpawnTime=true)
Definition: Creature.cpp:234
float Creature::GetAggroRange ( Unit const *  target) const

Definition at line 2684 of file Creature.cpp.

References getLevelForTarget(), Unit::getLevelForTarget(), Unit::GetTotalAuraModifier(), Object::GetTypeId(), Unit::IsPet(), MAX_AGGRO_RADIUS, SPELL_AURA_MOD_DETECT_RANGE, SPELL_AURA_MOD_DETECTED_RANGE, Object::ToCreature(), TYPEID_PLAYER, and TYPEID_UNIT.

2685 {
2686  // Determines the aggro range for creatures (usually pets), used mainly for aggressive pet target selection.
2687  // Based on data from wowwiki due to lack of 3.3.5a data
2688 
2689  if (target && this->IsPet())
2690  {
2691  uint32 targetLevel = 0;
2692 
2693  if (target->GetTypeId() == TYPEID_PLAYER)
2694  targetLevel = target->getLevelForTarget(this);
2695  else if (target->GetTypeId() == TYPEID_UNIT)
2696  targetLevel = target->ToCreature()->getLevelForTarget(this);
2697 
2698  uint32 myLevel = getLevelForTarget(target);
2699  int32 levelDiff = int32(targetLevel) - int32(myLevel);
2700 
2701  // The maximum Aggro Radius is capped at 45 yards (25 level difference)
2702  if (levelDiff < -25)
2703  levelDiff = -25;
2704 
2705  // The base aggro radius for mob of same level
2706  float aggroRadius = 20;
2707 
2708  // Aggro Radius varies with level difference at a rate of roughly 1 yard/level
2709  aggroRadius -= (float)levelDiff;
2710 
2711  // detect range auras
2713 
2714  // detected range auras
2715  aggroRadius += target->GetTotalAuraModifier(SPELL_AURA_MOD_DETECTED_RANGE);
2716 
2717  // Just in case, we don't want pets running all over the map
2718  if (aggroRadius > MAX_AGGRO_RADIUS)
2719  aggroRadius = MAX_AGGRO_RADIUS;
2720 
2721  // Minimum Aggro Radius for a mob seems to be combat range (5 yards)
2722  // hunter pets seem to ignore minimum aggro radius so we'll default it a little higher
2723  if (aggroRadius < 10)
2724  aggroRadius = 10;
2725 
2726  return (aggroRadius);
2727  }
2728 
2729  // Default
2730  return 0.0f;
2731 }
int32 GetTotalAuraModifier(AuraType auratype) const
Definition: Unit.cpp:3669
ACE_INT32 int32
Definition: Define.h:67
bool IsPet() const
Definition: Unit.h:1048
uint8 getLevelForTarget(Unit const *target) const
Definition: Creature.cpp:2370
#define MAX_AGGRO_RADIUS
Definition: Unit.h:254
ACE_UINT32 uint32
Definition: Define.h:71
std::string Creature::GetAIName ( ) const

Definition at line 2383 of file Creature.cpp.

References Object::GetEntry(), and sObjectMgr.

Referenced by ChatHandler::HandleNpcInfoCommand(), SmartScript::IsSmart(), SmartAI::Permissible(), CreatureEventAI::Permissible(), and FactorySelector::selectAI().

2384 {
2385  return sObjectMgr.GetCreatureTemplate(GetEntry())->AIName;
2386 }
#define sObjectMgr
Definition: ObjectMgr.h:1285
uint32 GetEntry() const
Definition: Object.h:192
float Creature::GetAttackDistance ( Unit const *  pl) const

Definition at line 1537 of file Creature.cpp.

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

Referenced by CanCreatureAttack(), WorldObject::CanDetectStealthOf(), canStartAttack(), FollowerAI::MoveInLineOfSight(), and npc_escortAI::MoveInLineOfSight().

1538 {
1539  float aggroRate = sWorld.getRate(RATE_CREATURE_AGGRO);
1540  if (aggroRate == 0)
1541  return 0.0f;
1542 
1543  uint32 playerlevel = player->getLevelForTarget(this);
1544  uint32 creaturelevel = getLevelForTarget(player);
1545 
1546  int32 leveldif = int32(playerlevel) - int32(creaturelevel);
1547 
1548  // "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."
1549  if (leveldif < - 25)
1550  leveldif = -25;
1551 
1552  // "The aggro radius of a mob having the same level as the player is roughly 20 yards"
1553  float RetDistance = 20;
1554 
1555  // "Aggro Radius varies with level difference at a rate of roughly 1 yard/level"
1556  // radius grow if playlevel < creaturelevel
1557  RetDistance -= (float)leveldif;
1558 
1559  if (creaturelevel + 5 <= int32(sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)))
1560  {
1561  // detect range auras
1563 
1564  // detected range auras
1565  RetDistance += player->GetTotalAuraModifier(SPELL_AURA_MOD_DETECTED_RANGE);
1566  }
1567 
1568  // "Minimum Aggro Radius for a mob seems to be combat range (5 yards)"
1569  if (RetDistance < 5)
1570  RetDistance = 5;
1571 
1572  return (RetDistance * aggroRate);
1573 }
int32 GetTotalAuraModifier(AuraType auratype) const
Definition: Unit.cpp:3669
ACE_INT32 int32
Definition: Define.h:67
uint8 getLevelForTarget(Unit const *target) const
Definition: Creature.cpp:2370
#define sWorld
Definition: World.h:860
ACE_UINT32 uint32
Definition: Define.h:71
uint32 Creature::GetCombatPulseDelay ( ) const
inline

Definition at line 682 of file Creature.h.

682 { return m_combatPulseDelay; }
uint32 m_combatPulseDelay
Definition: Creature.h:830
CreatureDataAddon const * Creature::GetCreatureAddon ( ) const

Definition at line 2127 of file Creature.cpp.

References ObjectMgr::GetCreatureAddon(), GetCreatureTemplate(), ObjectMgr::GetCreatureTemplateAddon(), and m_DBTableGuid.

Referenced by ChatHandler::HandleWpUnLoadPathCommand(), LoadCreaturesAddon(), and UpdateEntry().

2128 {
2129  if (m_DBTableGuid)
2130  {
2132  return addon;
2133  }
2134 
2135  // dependent from heroic mode entry
2137 }
static CreatureDataAddon const * GetCreatureAddon(uint32 lowguid)
Definition: ObjectMgr.h:624
static CreatureDataAddon const * GetCreatureTemplateAddon(uint32 entry)
Definition: ObjectMgr.h:629
uint32 m_DBTableGuid
Definition: Creature.h:839
CreatureInfo const * GetCreatureTemplate() const
Definition: Creature.h:557
CreatureData const* Creature::GetCreatureData ( ) const
inline

Definition at line 558 of file Creature.h.

References GetScriptId().

Referenced by setDeathState().

558 { return m_creatureData; }
CreatureData const * m_creatureData
Definition: Creature.h:854
CreatureInfo const* Creature::GetCreatureTemplate ( ) const
inline

Definition at line 557 of file Creature.h.

Referenced by Object::_BuildValuesUpdate(), AllLootRemovedFromCorpse(), FollowerAI::AssistPlayerInCombat(), npc_escortAI::AssistPlayerInCombat(), SmartAI::AssistPlayerInCombat(), CanCreatureAttack(), CanTrainAndResetTalentsOf(), Spell::CheckCast(), Spell::CheckDummyCast(), Create(), Pet::CreateBaseAtCreature(), Spell::EffectSkinning(), Spell::EffectSummonType(), GetCreatureAddon(), Unit::GetCreatureType(), Player::GetDefaultGossipMenuForSource(), Player::GetNPCIfCanInteractWith(), WorldSession::HandleGossipHelloOpcode(), ChatHandler::HandleNpcFactionIdCommand(), ChatHandler::HandleNpcInfoCommand(), WorldSession::HandleQuestgiverHelloOpcode(), Pet::HaveInDiet(), InitEntry(), Totem::InitStats(), Guardian::InitStatsForLevel(), isElite(), Player::isHonorOrXPTarget(), IsImmuneToSpell(), IsImmuneToSpellEffect(), Pet::IsPermanentPetFor(), Unit::isSpellBlocked(), IsTrainerOf(), isWorldBoss(), FollowerAI::JustRespawned(), npc_escortAI::JustRespawned(), SmartAI::JustRespawned(), Unit::Kill(), Pet::LearnPetPassives(), LoadCreatureFromDB(), Pet::LoadPetFromDB(), Unit::MeleeSpellHitResult(), CreatureAI::OnCharmed(), Player::PrepareGossipMenu(), Player::RewardReputation(), Unit::RollMeleeOutcomeAgainst(), SaveToDB(), SelectLevel(), FactorySelector::selectMovementGenerator(), Player::SendLoot(), WorldSession::SendTrainerList(), setDeathState(), OPvPCapturePointEP::SummonFlightMaster(), Aura::TriggerSpell(), UpdateEntry(), GameEventMgr::UpdateEventNPCFlags(), UpdateMovementFlags(), and Unit::UpdateSpeed().

557 { return m_creatureInfo; }
CreatureInfo const * m_creatureInfo
Definition: Creature.h:868
Cell const& Creature::GetCurrentCell ( ) const
inline
uint32 Creature::GetCurrentEquipmentId ( )
inline

Definition at line 548 of file Creature.h.

Referenced by GameEventMgr::ChangeEquipOrModel(), Aura::HandleAuraModDisarm(), and SaveToDB().

548 { return m_equipmentId; }
uint32 m_equipmentId
Definition: Creature.h:840
uint32 Creature::GetCurrentWaypointID ( )
inline

Definition at line 750 of file Creature.h.

751  {
752  return m_waypointID;
753  }
uint32 m_waypointID
Definition: Creature.h:860
MovementGeneratorType Creature::GetDefaultMovementType ( ) const
inline

Definition at line 628 of file Creature.h.

Referenced by SaveToDB(), and FactorySelector::selectMovementGenerator().

629  {
630  return m_defaultMovementType;
631  }
MovementGeneratorType m_defaultMovementType
Definition: Creature.h:837
uint32 Creature::GetEquipmentId ( ) const
inline

Definition at line 482 of file Creature.h.

Referenced by SaveToDB().

482 { return m_equipmentId; }
uint32 m_equipmentId
Definition: Creature.h:840
CreatureGroup* Creature::GetFormation ( )
inline

Definition at line 760 of file Creature.h.

Referenced by WaypointMovementGenerator< T >::Initialize(), Unit::SetInCombatState(), and WaypointMovementGenerator< T >::Update().

761  {
762  return m_formation;
763  }
CreatureGroup * m_formation
Definition: Creature.h:864
uint32 Creature::GetGlobalCooldown ( ) const
inline

Definition at line 736 of file Creature.h.

Referenced by WorldSession::HandlePetActionHelper(), WorldSession::HandlePetCastSpellOpcode(), and PetAI::UpdateAI().

737  {
738  return