OregonCore  revision be9e804-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 HasBreakableByDamageAuraType (AuraType type, uint32 excludeAura=0) const
 
bool HasBreakableByDamageCrowdControlAura (Unit *excludeCasterChannel=NULL) const
 
bool HasStealthAura () const
 
bool HasInvisibilityAura () const
 
bool IsFeared () const
 
bool IsInRoots () const
 
bool IsPolymorphed () const
 
bool isFrozen () const
 
bool isTargetableForAttack (bool checkFakeDeath=true) const
 
bool IsValidAttackTarget (Unit const *target) const
 
bool _IsValidAttackTarget (Unit const *target, 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 UpdateModelData ()
 
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)
 
bool IsVisibilityOverridden () const
 
void SetVisibilityDistanceOverride (VisibilityDistanceType type)
 
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
 
uint64 GetGUID () 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
 
void SetBaseWalkSpeed (float speed) override
 
void SetBaseRunSpeed (float speed) 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
 
float m_baseSpeedWalk
 
float m_baseSpeedRun
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
const bool m_isWorldObject
 
ZoneScriptm_zoneScript
 
float m_visibilityDistanceOverride
 
- 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 467 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:835
CreatureData const * m_creatureData
Definition: Creature.h:862
bool m_isTempWorldObject
Definition: Creature.h:811
time_t m_respawnTime
Definition: Creature.h:833
bool m_AlreadyCallAssistance
Definition: Creature.h:850
bool m_AlreadySearchedAssistance
Definition: Creature.h:851
bool hasPlayerDamaged
Definition: Creature.h:792
uint8 m_emoteState
Definition: Creature.h:840
MovementGeneratorType m_defaultMovementType
Definition: Creature.h:845
time_t _pickpocketLootRestore
Timers.
Definition: Creature.h:831
uint32 m_combatPulseDelay
Definition: Creature.h:838
ReactStates m_reactState
Definition: Creature.h:841
float m_respawnradius
Definition: Creature.h:836
uint32 m_lootRecipientGroup
Definition: Creature.h:827
uint32 m_corpseRemoveTime
Definition: Creature.h:832
uint32 m_spells[CREATURE_MAX_SPELLS]
Definition: Creature.h:612
ACE_UINT8 uint8
Definition: Define.h:73
CreatureGroup * m_formation
Definition: Creature.h:875
#define CREATURE_REGEN_INTERVAL
Definition: Creature.h:125
uint32 m_lootMoney
Definition: Creature.h:825
uint32 m_DBTableGuid
Definition: Creature.h:847
uint32 m_GlobalCooldown
Definition: Creature.h:615
CreatureInfo const * m_creatureInfo
Definition: Creature.h:879
bool m_regenHealth
Definition: Creature.h:852
bool m_AI_locked
Definition: Creature.h:853
uint32 m_combatPulseTime
Definition: Creature.h:837
CreatureSpellCooldowns m_CreatureSpellCooldowns
Definition: Creature.h:613
bool DisableReputationGain
Definition: Creature.h:860
bool TriggerJustRespawned
Definition: Creature.h:877
SpellSchoolMask m_meleeDamageSchoolMask
Definition: Creature.h:855
uint64 _skinner
Definition: Creature.h:828
uint32 m_respawnDelay
Definition: Creature.h:834
uint64 m_lootRecipient
Definition: Creature.h:826
#define CREATURE_MAX_SPELLS
Definition: Unit.h:249
float m_SightDistance
Definition: Creature.h:797
uint16 m_valuesCount
Definition: Object.h:414
uint32 m_regenTimer
Definition: Creature.h:844
#define MELEE_RANGE
Definition: Object.h:53
#define sWorld
Definition: World.h:860
uint32 m_equipmentId
Definition: Creature.h:848
CreatureSpellCooldowns m_CreatureCategoryCooldowns
Definition: Creature.h:614
float m_CombatDistance
Definition: Creature.h:797
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:2007
VendorItemCounts m_vendorItemCounts
Definition: Creature.h:818

Member Function Documentation

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

Definition at line 2241 of file Creature.cpp.

References m_CreatureCategoryCooldowns.

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

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

Definition at line 2236 of file Creature.cpp.

References m_CreatureSpellCooldowns.

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

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

Definition at line 1230 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 1206 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 2026 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().

2027 {
2028  ASSERT(target);
2029 
2030  // if the target cannot be attacked, the target is not acceptable
2031  if (IsFriendlyTo(target)
2032  || !target->isTargetableForAttack(false))
2033  return false;
2034 
2035  if (target->HasUnitState(UNIT_STATE_DIED))
2036  {
2037  // guards can detect fake death
2039  return true;
2040  else
2041  return false;
2042  }
2043 
2044  Unit const* targetVictim = target->getAttackerForHelper();
2045 
2046  // if I'm already fighting target, or I'm hostile towards the target, the target is acceptable
2047  if (IsInCombatWith(target) || IsHostileTo(target))
2048  return true;
2049 
2050  // if the target's victim is friendly, and the target is neutral, the target is acceptable
2051  if (targetVictim && IsFriendlyTo(targetVictim))
2052  return true;
2053 
2054  // if the target's victim is not friendly, or the target is friendly, the target is not acceptable
2055  return false;
2056 }
bool IsFriendlyTo(Unit const *unit) const
Definition: Unit.cpp:7374
bool IsGuard() const
Definition: Creature.h:498
bool IsHostileTo(Unit const *unit) const
Definition: Unit.cpp:7369
Unit * getAttackerForHelper() const
Definition: Unit.cpp:7405
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:281
bool IsInCombatWith(Unit const *who) const
Definition: Unit.cpp:501
Definition: Unit.h:908
bool isTargetableForAttack(bool checkFakeDeath=true) const
Definition: Unit.cpp:9530
void Creature::_RealtimeSetCreatureInfo ( )
protected
void Creature::AddCreatureSpellCooldown ( uint32  spellid)

Definition at line 2246 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().

2247 {
2248  SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellid);
2249  if (!spellInfo)
2250  return;
2251 
2252  uint32 cooldown = GetSpellRecoveryTime(spellInfo);
2253  if (Player* modOwner = GetSpellModOwner())
2254  modOwner->ApplySpellMod(spellid, SPELLMOD_COOLDOWN, cooldown);
2255 
2256  if (cooldown)
2257  _AddCreatureSpellCooldown(spellid, time(NULL) + cooldown / IN_MILLISECONDS);
2258 
2259  if (spellInfo->Category)
2260  _AddCreatureCategoryCooldown(spellInfo->Category, time(NULL));
2261 
2262  m_GlobalCooldown = spellInfo->StartRecoveryTime;
2263 
2264  if (Unit* owner = GetCharmerOrOwner())
2265  if (owner->GetTypeId() == TYPEID_PLAYER)
2266  {
2267  WorldPacket data(SMSG_SPELL_COOLDOWN, (4 + 8));
2268  data << uint64(GetGUID());
2269  data << uint8(0x0); // flags (0x1, 0x2)
2270  data << uint32(spellid);
2271  data << uint32(cooldown); // in m.secs
2272 
2273  owner->ToPlayer()->GetSession()->SendPacket(&data);
2274  }
2275 }
uint32 Category
Definition: DBCStructure.h:675
void _AddCreatureSpellCooldown(uint32 spell_id, time_t end_time)
Definition: Creature.cpp:2236
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
uint64 GetGUID() const
Definition: Object.h:177
ACE_UINT8 uint8
Definition: Define.h:73
uint32 m_GlobalCooldown
Definition: Creature.h:615
ACE_UINT64 uint64
Definition: Define.h:70
Unit * GetCharmerOrOwner() const
Definition: Unit.h:1410
Player * GetSpellModOwner() const
Definition: Unit.cpp:11862
void _AddCreatureCategoryCooldown(uint32 category, time_t apply_time)
Definition: Creature.cpp:2241
uint32 StartRecoveryTime
Definition: DBCStructure.h:758
ACE_UINT32 uint32
Definition: Define.h:71
Definition: Unit.h:908
Definition: Player.h:923
uint32 GetSpellRecoveryTime(SpellEntry const *spellInfo)
Definition: SpellMgr.h:151
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:11164
bool AIM_Initialize(CreatureAI *ai=NULL)
Definition: Creature.cpp:741
virtual void OnCreatureCreate(Creature *, bool)
Definition: ZoneScript.h:44
const bool & IsInWorld() const
Definition: Object.h:150
ZoneScript * m_zoneScript
Definition: Object.h:897
void SearchFormation()
Definition: Creature.cpp:220
CreatureAI* Creature::AI ( ) const
inline

Definition at line 525 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().

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

Definition at line 741 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().

742 {
743  // make sure nothing can change the AI during AI update
744  if (m_AI_locked)
745  {
746  sLog.outDebug("AIM_Initialize: failed to init, locked.");
747  return false;
748  }
749 
750  UnitAI* oldAI = i_AI;
752  i_AI = ai ? ai : FactorySelector::selectAI(this);
753  delete oldAI;
754  IsAIEnabled = true;
755  i_AI->InitializeAI();
756  return true;
757 }
#define sLog
Log class singleton.
Definition: Log.h:187
bool IsAIEnabled
Definition: Unit.h:1993
UnitAI * i_AI
Definition: Unit.h:2007
virtual void InitializeAI()
Definition: UnitAI.h:56
CreatureAI * selectAI(Creature *creature)
bool m_AI_locked
Definition: Creature.h:853
MotionMaster i_motionMaster
Definition: Unit.h:2058
void Initialize()
Definition: UnitAI.h:41
void Creature::AllLootRemovedFromCorpse ( )

Definition at line 2347 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().

2348 {
2349  if (loot.loot_type != LOOT_SKINNING && !IsPet() && GetCreatureTemplate()->SkinLootId && hasLootRecipient())
2352 
2353  time_t now = time(NULL);
2354  // Do not reset corpse remove time if corpse is already removed
2355  if (m_corpseRemoveTime <= now)
2356  return;
2357 
2358  float decayRate = sWorld.getRate(RATE_CORPSE_DECAY_LOOTED);
2359 
2360  // corpse skinnable, but without skinning flag, and then skinned, corpse will despawn next update
2361  if (loot.loot_type == LOOT_SKINNING)
2362  m_corpseRemoveTime = now;
2363  else
2364  m_corpseRemoveTime = now + uint32(m_corpseDelay * decayRate);
2365 
2367 }
uint32 m_corpseDelay
Definition: Creature.h:835
time_t m_respawnTime
Definition: Creature.h:833
Loot loot
Definition: Creature.h:595
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:983
uint32 m_corpseRemoveTime
Definition: Creature.h:832
bool HaveLootFor(uint32 loot_id) const
Definition: LootMgr.h:184
bool IsPet() const
Definition: Unit.h:1048
uint32 m_respawnDelay
Definition: Creature.h:834
CreatureInfo const * GetCreatureTemplate() const
Definition: Creature.h:565
LootType loot_type
Definition: LootMgr.h:312
bool hasLootRecipient() const
Definition: Creature.h:603
#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:12319
float GetModifierValue(UnitMods unitMod, UnitModifierType modifierType) const
Definition: Unit.cpp:10804
bool haveOffhandWeapon() const
Definition: Unit.cpp:628
bool CanUseAttackType(uint8 attacktype) const
Definition: Unit.cpp:2795
float GetWeaponDamageRange(WeaponAttackType attType, WeaponDamageRange type) const
Definition: Unit.cpp:10923
CreatureInfo const * GetCreatureTemplate() const
Definition: Creature.h:565
Definition: Unit.h:354
float GetTotalAttackPowerValue(WeaponAttackType attType) const
Definition: Unit.cpp:10905
float RangeVariance
Definition: Creature.h:160
void Creature::CallAssistance ( )

Definition at line 1920 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().

1921 {
1922  if (!m_AlreadyCallAssistance && GetVictim() && !IsPet() && !isCharmed())
1923  {
1924  SetNoCallAssistance(true);
1925 
1926  float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS);
1927 
1928  if (radius > 0)
1929  {
1930  std::list<Creature*> assistList;
1931 
1932  {
1934  Cell cell(p);
1935  cell.SetNoCreate();
1936 
1937  Oregon::AnyAssistCreatureInRangeCheck u_check(this, GetVictim(), radius);
1938  Oregon::CreatureListSearcher<Oregon::AnyAssistCreatureInRangeCheck> searcher(this, assistList, u_check);
1939 
1941 
1942  cell.Visit(p, grid_creature_searcher, *GetMap(), *this, radius);
1943  }
1944 
1945  if (!assistList.empty())
1946  {
1947  AssistDelayEvent* e = new AssistDelayEvent(GetVictim()->GetGUID(), *this);
1948  while (!assistList.empty())
1949  {
1950  // Pushing guids because in delay can happen some creature gets despawned => invalid pointer
1951  e->AddAssistant((*assistList.begin())->GetGUID());
1952  assistList.pop_front();
1953  }
1955  }
1956  }
1957  }
1958 }
EventProcessor m_Events
Definition: Unit.h:1636
Map * GetMap() const
Definition: Object.h:817
void SetNoCallAssistance(bool val)
Definition: Creature.h:630
void AddEvent(BasicEvent *Event, uint64 e_time, bool set_addtime=true)
bool m_AlreadyCallAssistance
Definition: Creature.h:850
void AddAssistant(const uint64 &guid)
Definition: Creature.h:890
uint64 CalculateTime(uint64 t_offset)
uint64 GetGUID() const
Definition: Object.h:177
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
void Creature::CallForHelp ( float  fRadius)

Definition at line 1960 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().

1961 {
1962  if (radius <= 0.0f || !GetVictim() || IsPet() || isCharmed())
1963  return;
1964 
1966  Cell cell(p);
1967  cell.SetNoCreate();
1968 
1969  Oregon::CallOfHelpCreatureInRangeDo u_do(this, GetVictim(), radius);
1971 
1973 
1974  cell.Visit(p, grid_creature_searcher, *GetMap(), *this, radius);
1975 }
Map * GetMap() const
Definition: Object.h:817
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 1486 of file Creature.cpp.

References AI(), and Unit::IsAIEnabled.

1487 {
1488  if (IsAIEnabled && AI()->CanSeeAlways(obj))
1489  return true;
1490 
1491  return false;
1492 }
bool IsAIEnabled
Definition: Unit.h:1993
CreatureAI * AI() const
Definition: Creature.h:525
bool Creature::CanAssistTo ( const Unit u,
const Unit enemy,
bool  checkfaction = true 
) const

Definition at line 1977 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()().

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

Definition at line 2066 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().

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

Definition at line 598 of file Creature.h.

Referenced by Player::SendLoot().

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

Definition at line 957 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().

958 {
959  if (!IsBattleMaster())
960  return false;
961 
962  uint32 bgTypeId = sObjectMgr.GetBattleMasterBG(GetEntry());
963  if (!msg)
964  return player->GetBGAccessByLevel(bgTypeId);
965 
966  if (!player->GetBGAccessByLevel(bgTypeId))
967  {
968  player->PlayerTalkClass->ClearMenus();
969  switch (bgTypeId)
970  {
971  case BATTLEGROUND_AV: player->PlayerTalkClass->SendGossipMenu(7616, GetGUID()); break;
972  case BATTLEGROUND_WS: player->PlayerTalkClass->SendGossipMenu(7599, GetGUID()); break;
973  case BATTLEGROUND_AB: player->PlayerTalkClass->SendGossipMenu(7642, GetGUID()); break;
974  case BATTLEGROUND_EY:
975  case BATTLEGROUND_NA:
976  case BATTLEGROUND_BE:
977  case BATTLEGROUND_AA:
978  case BATTLEGROUND_RL: player->PlayerTalkClass->SendGossipMenu(10024, GetGUID()); break;
979  default: break;
980  }
981  return false;
982  }
983  return true;
984 }
PlayerMenu * PlayerTalkClass
Definition: Player.h:2182
void ClearMenus()
Definition: GossipDef.cpp:118
bool IsBattleMaster() const
Definition: Unit.h:1220
void SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const
Definition: GossipDef.cpp:124
#define sObjectMgr
Definition: ObjectMgr.h:1317
uint64 GetGUID() const
Definition: Object.h:177
uint32 GetEntry() const
Definition: Object.h:186
ACE_UINT32 uint32
Definition: Define.h:71
bool GetBGAccessByLevel(uint32 bgTypeId) const
Definition: Player.cpp:19432
bool Creature::canStartAttack ( Unit const *  u,
bool  force 
) const

Definition at line 1494 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().

1495 {
1496  if (IsCivilian())
1497  return false;
1498 
1499  // This set of checks is should be done only for creatures
1500  if ((HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC) && who->GetTypeId() != TYPEID_PLAYER) // flag is valid only for non player characters
1501  || (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) && who->GetTypeId() == TYPEID_PLAYER) // immune to PC and target is a player, return false
1502  || (who->GetOwner() && who->GetOwner()->GetTypeId() == TYPEID_PLAYER && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC))) // player pets are immune to pc as well
1503  return false;
1504 
1505  // Do not attack non-combat pets
1506  if (who->GetTypeId() == TYPEID_UNIT && who->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET)
1507  return false;
1508 
1510  return false;
1511 
1512  if (!force)
1513  {
1514  if (!_IsTargetAcceptable(who))
1515  return false;
1516 
1517  if (who->IsInCombat() && IsWithinDist(who, ATTACK_DISTANCE))
1518  if (Unit* victim = who->getAttackerForHelper())
1520  force = true;
1521 
1522  if (!force && (IsNeutralToAll() || !IsWithinDistInMap(who, GetAttackDistance(who) + m_CombatDistance)))
1523  return false;
1524  }
1525 
1526  if (!CanCreatureAttack(who, force))
1527  return false;
1528 
1529  return IsWithinLOSInMap(who);
1530 }
#define ATTACK_DISTANCE
Definition: Object.h:36
#define CREATURE_Z_ATTACK_RANGE
Definition: Creature.h:459
bool CanFly() const
Definition: Creature.h:501
bool IsWithinLOSInMap(const WorldObject *obj) const
Definition: Object.cpp:1252
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition: Object.h:750
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition: Object.h:746
bool _IsTargetAcceptable(const Unit *target) const
Definition: Creature.cpp:2026
bool IsNeutralToAll() const
Definition: Unit.cpp:7392
float GetAttackDistance(Unit const *pl) const
Definition: Creature.cpp:1532
bool IsCivilian() const
Definition: Creature.h:496
bool CanCreatureAttack(Unit const *victim, bool force=true) const
Definition: Creature.cpp:2066
Unit * getAttackerForHelper() const
Definition: Unit.cpp:7405
#define sWorld
Definition: World.h:860
float GetDistanceZ(const WorldObject *obj) const
Definition: Object.cpp:1218
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.h:281
Definition: Unit.h:908
float m_CombatDistance
Definition: Creature.h:797
bool Creature::CanSwim ( ) const
inline

Definition at line 500 of file Creature.h.

References GetCreatureTemplate(), and INHABIT_WATER.

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

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

Definition at line 986 of file Creature.cpp.

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

Referenced by Player::PrepareGossipMenu().

987 {
988  return player->getLevel() >= 10
990  && player->getClass() == GetCreatureTemplate()->classNum;
991 }
uint32 trainer_type
Definition: Creature.h:165
CreatureInfo const * GetCreatureTemplate() const
Definition: Creature.h:565
uint32 classNum
Definition: Creature.h:167
bool Creature::CanWalk ( ) const
inline

Definition at line 499 of file Creature.h.

References GetCreatureTemplate(), and INHABIT_GROUND.

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

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

Definition at line 2675 of file Creature.cpp.

References m_textRepeat.

Referenced by CreatureTextMgr::SendChat().

2676 {
2677  CreatureTextRepeatGroup::iterator groupItr = m_textRepeat.find(textGroup);
2678  if (groupItr != m_textRepeat.end())
2679  groupItr->second.clear();
2680 }
CreatureTextRepeatGroup m_textRepeat
Definition: Creature.h:881
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 759 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().

760 {
761  ASSERT(map);
762  SetMap(map);
763  SetPhaseMask(phaseMask, false);
764 
765  CreatureInfo const* cinfo = sObjectMgr.GetCreatureTemplate(entry);
766  if (!cinfo)
767  {
768  sLog.outError("Creature::Create(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, entry);
769  return false;
770  }
771 
774  Relocate(x, y, z, ang);
775 
776  if (!IsPositionValid())
777  {
778  sLog.outError("Creature (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow, entry, x, y);
779  return false;
780  }
781 
782  // Allow players to see those units while dead, do it here (mayby altered by addon auras)
785 
786  if (!CreateFromProto(guidlow, entry, team, data))
787  return false;
788 
789  switch (GetCreatureTemplate()->rank)
790  {
791  case CREATURE_ELITE_RARE:
793  break;
796  break;
799  break;
802  break;
803  default:
805  break;
806  }
807 
809  if (IsSpiritHealer() || IsSpiritGuide())
810  {
813  }
814 
815  return true;
816 }
uint32 m_corpseDelay
Definition: Creature.h:835
bool IsSpiritHealer() const
Definition: Unit.h:1223
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition: Object.h:809
virtual void SetMap(Map *map)
Definition: Object.cpp:1981
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:602
#define sLog
Log class singleton.
Definition: Log.h:187
#define sObjectMgr
Definition: ObjectMgr.h:1317
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:13554
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
Definition: Object.h:810
bool CreateFromProto(uint32 guidlow, uint32 Entry, uint32 team, const CreatureData *data=NULL)
Definition: Creature.cpp:1268
CreatureInfo const * GetCreatureTemplate() const
Definition: Creature.h:565
#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 1268 of file Creature.cpp.

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

Referenced by Create().

1269 {
1270  SetZoneScript();
1271  if (m_zoneScript && data)
1272  {
1273  entry = m_zoneScript->GetCreatureEntry(guidlow, data);
1274  if (!entry)
1275  return false;
1276  }
1277 
1278  CreatureInfo const* cinfo = sObjectMgr.GetCreatureTemplate(entry);
1279  if (!cinfo)
1280  {
1281  sLog.outErrorDb("Creature::CreateFromProto(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, entry);
1282  return false;
1283  }
1284 
1285  SetOriginalEntry(entry);
1286 
1287  Object::_Create(guidlow, entry, HIGHGUID_UNIT);
1288 
1289  if (!UpdateEntry(entry, team, data))
1290  return false;
1291 
1292  return true;
1293 }
#define sLog
Log class singleton.
Definition: Log.h:187
#define sObjectMgr
Definition: ObjectMgr.h:1317
void _Create(uint32 guidlow, uint32 entry, HighGuid guidhigh)
Definition: Object.cpp:125
ZoneScript * m_zoneScript
Definition: Object.h:897
void SetOriginalEntry(uint32 entry)
Definition: Creature.h:795
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:348
void SetZoneScript()
Definition: Object.cpp:2129
void Creature::DeleteFromDB ( )
virtual

Reimplemented in Pet.

Definition at line 1456 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().

1457 {
1458  if (!m_DBTableGuid)
1459  {
1460  sLog.outDebug("Trying to delete not saved creature!");
1461  return;
1462  }
1463 
1464  sObjectMgr.SaveCreatureRespawnTime(m_DBTableGuid, GetInstanceId(), 0);
1465  sObjectMgr.DeleteCreatureData(m_DBTableGuid);
1466 
1468  WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid = '%u'", m_DBTableGuid);
1469  WorldDatabase.PExecuteLog("DELETE FROM creature_addon WHERE guid = '%u'", m_DBTableGuid);
1470  WorldDatabase.PExecuteLog("DELETE FROM game_event_creature WHERE guid = '%u'", m_DBTableGuid);
1471  WorldDatabase.PExecuteLog("DELETE FROM game_event_model_equip WHERE guid = '%u'", m_DBTableGuid);
1473 }
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:1317
bool CommitTransaction()
Definition: Database.cpp:551
bool PExecuteLog(const char *format,...) ATTR_PRINTF(2
Definition: Database.cpp:221
uint32 m_DBTableGuid
Definition: Creature.h:847
uint32 GetInstanceId() const
Definition: Object.h:664
void Creature::DespawnOrUnsummon ( uint32  msTimeToDespawn = 0)

Definition at line 1713 of file Creature.cpp.

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

Referenced by SmartAI::UpdateDespawn().

1714 {
1715  if (TempSummon* summon = this->ToTempSummon())
1716  summon->UnSummon(msTimeToDespawn);
1717  else
1718  ForcedDespawn(msTimeToDespawn);
1719 }
void ForcedDespawn(uint32 timeMSToDespawn=0)
Definition: Creature.cpp:1697
TempSummon * ToTempSummon()
Definition: Unit.h:2001
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:1570
bool IsAlive() const
Definition: Unit.h:1336
void RemoveCorpse(bool setSpawnTime=true)
Definition: Creature.cpp:234
void DestroyForNearbyPlayers()
Definition: Object.cpp:2616
void Creature::DoFleeToGetAssistance ( )

Definition at line 707 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().

708 {
709  if (!GetVictim())
710  return;
711 
713  return;
714 
715  float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS);
716  if (radius > 0)
717  {
718  Creature* creature = NULL;
719 
721  Cell cell(p);
722  cell.SetNoCreate();
725 
727 
728  cell.Visit(p, grid_creature_searcher, *GetMap(), *this, radius);
729 
730  SetNoSearchAssistance(true);
731  UpdateSpeed(MOVE_RUN, false);
732 
733  if (!creature)
735  else
736  GetMotionMaster()->MoveSeekAssistance(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ());
737  }
738 
739 }
Map * GetMap() const
Definition: Object.h:817
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition: Unit.cpp:9920
MotionMaster * GetMotionMaster()
Definition: Unit.h:1893
void SetControlled(bool apply, UnitState state)
Definition: Unit.cpp:12927
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:631
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:869
#define sWorld
Definition: World.h:860
float GetPositionX() const
Definition: Position.h:97
void Creature::ForcedDespawn ( uint32  timeMSToDespawn = 0)

Definition at line 1697 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().

1698 {
1699  if (timeMSToDespawn)
1700  {
1701  ForcedDespawnDelayEvent* pEvent = new ForcedDespawnDelayEvent(*this);
1702 
1703  m_Events.AddEvent(pEvent, m_Events.CalculateTime(timeMSToDespawn));
1704  return;
1705  }
1706 
1707  if (IsAlive())
1709 
1710  RemoveCorpse(false);
1711 }
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:1570
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 2683 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.

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

Definition at line 2382 of file Creature.cpp.

References Object::GetEntry(), and sObjectMgr.

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

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

Definition at line 1532 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().

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

Definition at line 690 of file Creature.h.

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

Definition at line 2122 of file Creature.cpp.

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

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

2123 {
2124  if (m_DBTableGuid)
2125  {
2127  return addon;
2128  }
2129 
2130  // dependent from heroic mode entry
2132 }
static CreatureDataAddon const * GetCreatureAddon(uint32 lowguid)
Definition: ObjectMgr.h:638
static CreatureDataAddon const * GetCreatureTemplateAddon(uint32 entry)
Definition: ObjectMgr.h:643
uint32 m_DBTableGuid
Definition: Creature.h:847
CreatureInfo const * GetCreatureTemplate() const
Definition: Creature.h:565
CreatureData const* Creature::GetCreatureData ( ) const
inline

Definition at line 566 of file Creature.h.

References GetScriptId().

Referenced by setDeathState().

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

Definition at line 565 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().

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

Definition at line 556 of file Creature.h.

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

556 { return m_equipmentId; }
uint32 m_equipmentId
Definition: Creature.h:848
uint32 Creature::GetCurrentWaypointID ( )
inline

Definition at line 758 of file Creature.h.

759  {
760  return m_waypointID;
761  }
uint32 m_waypointID
Definition: Creature.h:871
MovementGeneratorType Creature::GetDefaultMovementType ( ) const
inline

Definition at line 636 of file Creature.h.

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

637  {
638  return m_defaultMovementType;
639  }
MovementGeneratorType m_defaultMovementType
Definition: Creature.h:845
<