OregonCore  revision 3611e8a-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 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
virtual 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)
void Motion_Initialize ()
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 UpdateDamagePhysical (WeaponAttackType attType) override
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 FallGround ()
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)
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 CanDualWield () const
void SetCanDualWield (bool value)
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
uint32 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
uint16 GetMaxSkillValueForLevel (Unit const *target=NULL) 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 GetCombatTimer () const
uint32 GetAuraCount (uint32 spellId) const
bool HasAuraType (AuraType auraType) const
bool HasAuraTypeWithCaster (AuraType auratype, uint64 caster) const
bool HasAuraTypeWithMiscvalue (AuraType auratype, int32 miscvalue) const
bool HasAuraTypeWithFamilyFlags (AuraType auraType, uint32 familyName, uint64 familyFlags) const
bool HasNegativeAuraWithInterruptFlag (uint32 flag)
bool HasAura (uint32 spellId, uint8 effIndex=0) const
bool HasHigherRankOfAura (uint32 spellid, uint8 effIndex) const
bool HasStealthAura () const
bool HasInvisibilityAura () const
bool isFeared () const
bool isInRoots () const
bool IsPolymorphed () const
bool isFrozen () const
bool isTargetableForAttack (bool checkFakeDeath=true) const
bool IsValidAttackTarget (Unit const *target) const
bool _IsValidAttackTarget (Unit const *target, SpellEntry const *bySpell, WorldObject const *obj=NULL) const
bool isAttackableByAOE (float x=0, float y=0, float z=0, bool LosCheck=false) const
bool IsValidAssistTarget (Unit const *target) const
bool _IsValidAssistTarget (Unit const *target, SpellEntry const *bySpell) const
virtual bool IsInWater () const
virtual bool IsUnderWater () const
bool isInAccessiblePlaceFor (Creature const *c) const
virtual uint32 GetHighestLearnedRankOf (uint32 spellid) const
void SendHealSpellLog (Unit *victim, uint32 SpellID, uint32 Damage, bool critical=false)
void SendEnergizeSpellLog (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
void EnergizeBySpell (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
uint32 SpellNonMeleeDamageLog (Unit *victim, uint32 spellID, uint32 damage, bool isTriggeredSpell=false, bool useSpellDamage=true)
void CastSpell (Unit *Victim, uint32 spellId, bool triggered, Item *castItem=NULL, Aura *triggeredByAura=NULL, uint64 originalCaster=0)
void CastSpell (Unit *Victim, SpellEntry const *spellInfo, bool triggered, Item *castItem=NULL, Aura *triggeredByAura=NULL, uint64 originalCaster=0)
void CastCustomSpell (Unit *Victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=NULL, Aura *triggeredByAura=NULL, uint64 originalCaster=0)
void CastCustomSpell (uint32 spellId, SpellValueMod mod, uint32 value, Unit *Victim=NULL, bool triggered=true, Item *castItem=NULL, Aura *triggeredByAura=NULL, uint64 originalCaster=0)
void CastCustomSpell (uint32 spellId, CustomSpellValues const &value, Unit *Victim=NULL, bool triggered=true, Item *castItem=NULL, Aura *triggeredByAura=NULL, uint64 originalCaster=0)
void CastSpell (float x, float y, float z, uint32 spellId, bool triggered, Item *castItem=NULL, Aura *triggeredByAura=NULL, uint64 originalCaster=0)
void CastSpell (GameObject *go, uint32 spellId, bool triggered, Item *castItem=NULL, Aura *triggeredByAura=NULL, uint64 originalCaster=0)
void AddAura (uint32 spellId, Unit *target)
void DeMorph ()
void SendAttackStateUpdate (CalcDamageInfo *damageInfo)
void SendAttackStateUpdate (uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount)
void SendSpellNonMeleeDamageLog (SpellNonMeleeDamage *log)
void SendSpellNonMeleeDamageLog (Unit *target, uint32 SpellID, uint32 Damage, SpellSchoolMask damageSchoolMask, uint32 AbsorbedDamage, uint32 Resist, bool PhysicalDamage, uint32 Blocked, bool CriticalHit=false)
void SendSpellMiss (Unit *target, uint32 spellID, SpellMissInfo missInfo)
void SendSpellDamageImmune (Unit *target, uint32 spellId)
virtual bool SetPosition (float x, float y, float z, float orientation, bool teleport=false)
bool SetPosition (const Position &pos, bool teleport=false)
void NearTeleportTo (float x, float y, float z, float orientation, bool casting=false)
void SendTeleportPacket (Position &pos)
void SendMovementFlagUpdate (bool self=false)
void BuildHeartBeatMsg (WorldPacket *data) const
void BuildMovementPacket (ByteBuffer *data) const
virtual void MoveOutOfRange (Player &)
bool isMoving () const
bool IsAlive () const
bool isDying () const
bool isDead () const
DeathState getDeathState ()
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 ()
float GetTotalAttackPowerValue (WeaponAttackType attType) const
float GetWeaponDamageRange (WeaponAttackType attType, WeaponDamageRange type) const
void SetBaseWeaponDamage (WeaponAttackType attType, WeaponDamageRange damageRange, float value)
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 UpdateObjectVisibility (bool forced=true) override
bool isInvisibleForAlive () const
 returns true if creature can't be seen by alive units More...
AuraListGetSingleCastAuras ()
AuraList const & GetSingleCastAuras () const
bool CanHaveThreatList () const
void AddThreat (Unit *victim, float threat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell=NULL)
void AddAssistThreat (Unit *victim, float threatToAdd, SpellEntry const *threatSpell)
float ApplyTotalThreatModifier (float threat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL)
void DeleteThreatList ()
void TauntApply (Unit *victim)
void TauntFadeOut (Unit *taunter)
ThreatManagergetThreatManager ()
void addHatedBy (HostileReference *pHostileReference)
void removeHatedBy (HostileReference *)
HostileRefManagergetHostileRefManager ()
AuraGetAura (uint32 spellId, uint32 effindex)
AuraMapGetAuras ()
AuraMap const & GetAuras () const
AuraList const & GetAurasByType (AuraType type) const
void ApplyAuraProcTriggerDamage (Aura *aura, bool apply)
int32 GetTotalAuraModifier (AuraType auratype) const
float GetTotalAuraMultiplier (AuraType auratype) const
int32 GetMaxPositiveAuraModifier (AuraType auratype) const
int32 GetMaxNegativeAuraModifier (AuraType auratype) const
int32 GetTotalAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
float GetTotalAuraMultiplierByMiscMask (AuraType auratype, uint32 misc_mask) const
int32 GetMaxPositiveAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
int32 GetMaxNegativeAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
int32 GetTotalAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
float GetTotalAuraMultiplierByMiscValue (AuraType auratype, int32 misc_value) const
int32 GetMaxPositiveAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
int32 GetMaxNegativeAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
AuraGetDummyAura (uint32 spell_id) const
uint32 GetInterruptMask () const
void AddInterruptMask (uint32 mask)
void UpdateInterruptMask ()
uint32 GetDisplayId ()
void SetDisplayId (uint32 modelId)
uint32 GetNativeDisplayId ()
void SetNativeDisplayId (uint32 modelId)
void setTransForm (uint32 spellid)
uint32 getTransForm () const
void AddDynObject (DynamicObject *dynObj)
void RemoveDynObject (uint32 spellid)
void RemoveDynObjectWithGUID (uint64 guid)
void RemoveAllDynObjects ()
void AddGameObject (GameObject *gameObj)
void RemoveGameObject (GameObject *gameObj, bool del)
void RemoveGameObject (uint32 spellid, bool del)
void RemoveAllGameObjects ()
DynamicObjectGetDynObject (uint32 spellId, uint32 effIndex)
DynamicObjectGetDynObject (uint32 spellId)
uint32 CalculateDamage (WeaponAttackType attType, bool normalized)
float GetAPMultiplier (WeaponAttackType attType, bool normalized)
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)
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 GetZoneId () const
uint32 GetAreaId () const
InstanceDataGetInstanceData ()
const char * GetName () const
void SetName (const std::string &newname)
float GetDistance (const WorldObject *obj) const
float GetDistance (const Position &pos) const
float GetDistance (float x, float y, float z) const
float GetDistance2d (const WorldObject *obj) const
float GetDistance2d (float x, float y) const
float GetDistanceZ (const WorldObject *obj) const
bool IsInMap (const WorldObject *obj) const
bool IsWithinDist3d (float x, float y, float z, float dist) const
bool IsWithinDist3d (const Position *pos, float dist) const
bool IsWithinDist2d (float x, float y, float dist) const
bool IsWithinDist2d (const Position *pos, float dist) const
bool _IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D) const
bool IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D=true) const
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true) const
bool IsWithinLOS (float x, float y, float z) const
bool IsWithinLOSInMap (const WorldObject *obj) const
Position GetHitSpherePointFor (Position const &dest) const
void GetHitSpherePointFor (Position const &dest, float &x, float &y, float &z) const
bool GetDistanceOrder (WorldObject const *obj1, WorldObject const *obj2, bool is3D=true) const
bool IsInRange (WorldObject const *obj, float minRange, float maxRange, bool is3D=true) const
bool IsInRange2d (float x, float y, float minRange, float maxRange) const
bool IsInRange3d (float x, float y, float z, float minRange, float maxRange) const
virtual void SendMessageToSet (WorldPacket *data, bool self)
virtual void SendMessageToSetInRange (WorldPacket *data, float dist, bool self)
void MonsterSay (const char *text, uint32 language, uint64 TargetGuid)
void MonsterYell (const char *text, uint32 language, uint64 TargetGuid)
void MonsterTextEmote (const char *text, uint64 TargetGuid, bool IsBossEmote=false)
void MonsterWhisper (const char *text, uint64 receiver, bool IsBossWhisper=false)
void MonsterSay (int32 textId, uint32 language, uint64 TargetGuid)
void MonsterYell (int32 textId, uint32 language, uint64 TargetGuid)
void MonsterTextEmote (int32 textId, uint64 TargetGuid, bool IsBossEmote=false)
void MonsterWhisper (int32 textId, uint64 receiver, bool IsBossWhisper=false)
void MonsterYellToZone (int32 textId, uint32 language, uint64 TargetGuid)
void BuildMonsterChat (WorldPacket *data, uint8 msgtype, char const *text, uint32 language, char const *name, uint64 TargetGuid) const
void PlayDistanceSound (uint32 sound_id, Player *target=NULL)
void PlayDirectSound (uint32 sound_id, Player *target=NULL)
void SendObjectDeSpawnAnim (uint64 guid)
void SendObjectCustomAnim (uint64 guid, uint32 anim=0)
void AddObjectToRemoveList ()
virtual bool IsNeverVisible () const
float GetGridActivationRange () const
float GetVisibilityRange () const
float GetSightRange (const WorldObject *target=NULL) const
bool CanSeeOrDetect (WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
void SendPlaySound (uint32 Sound, bool OnlySelf)
virtual void SetMap (Map *map)
virtual void ResetMap ()
MapGetMap () const
MapFindMap () const
Map const * GetBaseMap () const
void SetZoneScript ()
TempSummonSummonCreature (uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0)
TempSummonSummonCreature (uint32 id, float x, float y, float z, float ang, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0)
GameObjectSummonGameObject (uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
CreatureSummonTrigger (float x, float y, float z, float ang, uint32 dur, CreatureAI *(*GetAI)(Creature *)=NULL)
void SummonCreatureGroup (uint8 group, std::list< TempSummon * > *list=NULL)
CreatureFindNearestCreature (uint32 entry, float range, bool alive=true)
GameObjectFindNearestGameObject (uint32 entry, float range)
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &gameobjectList, uint32 entry=GRID_SEARCH_ALL_ENTRIES, float maxSearchRange=250.0f) const
void GetCreatureListWithEntryInGrid (std::list< Creature * > &creatureList, uint32 entry=GRID_SEARCH_ALL_ENTRIES, float maxSearchRange=250.0f) const
void DestroyForNearbyPlayers ()
virtual void UpdateObjectVisibilityOnCreate ()
void BuildUpdate (UpdateDataMapType &) override
void AddToNotify (uint16 f)
bool isNeedNotify (uint16 f) const
uint16 GetNotifyFlags () const
bool NotifyExecuted (uint16 f) const
void SetNotified (uint16 f)
void ResetAllNotifies ()
bool isActiveObject () const
void setActive (bool isActiveObject)
void SetWorldObject (bool apply)
bool IsPermanentWorldObject () const
bool IsWorldObject () const
template<class NOTIFIER >
void VisitNearbyWorldObject (const float &radius, NOTIFIER &notifier) const
template<class NOTIFIER >
void VisitNearbyObject (float const &radius, NOTIFIER &notifier) const
template<class NOTIFIER >
void VisitNearbyGridObject (float const &radius, NOTIFIER &notifier) const
- Public Member Functions inherited from Object
virtual ~Object ()
const bool & IsInWorld () const
const uint64GetGUID () const
uint32 GetGUIDLow () const
uint32 GetGUIDMid () const
uint32 GetGUIDHigh () const
PackedGuid const & GetPackGUID () const
ObjectGuid const & GetObjectGUID () const
std::string GetGuidStr () const
uint32 GetEntry () const
void SetEntry (uint32 entry)
float GetObjectScale () const
void SetObjectScale (float scale)
uint8 GetTypeId () const
bool isType (uint16 mask) const
virtual void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target) const
void SendUpdateToPlayer (Player *player)
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player *target) const
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
void BuildMovementUpdateBlock (UpdateData *data, uint32 flags=0) const
virtual void DestroyForPlayer (Player *target, bool onDeath=false) const
const int32GetInt32Value (uint16 index) const
const uint32GetUInt32Value (uint16 index) const
const uint64GetUInt64Value (uint16 index) const
const float & GetFloatValue (uint16 index) const
uint8 GetByteValue (uint16 index, uint8 offset) const
ObjectGuid const & GetGuidValue (uint16 index) const
uint16 GetUInt16Value (uint16 index, uint8 offset) const
void SetInt32Value (uint16 index, int32 value)
void SetUInt32Value (uint16 index, uint32 value)
void SetUInt64Value (uint16 index, const uint64 &value)
void SetFloatValue (uint16 index, float value)
void SetByteValue (uint16 index, uint8 offset, uint8 value)
void SetUInt16Value (uint16 index, uint8 offset, uint16 value)
void SetInt16Value (uint16 index, uint8 offset, int16 value)
void SetStatFloatValue (uint16 index, float value)
void SetStatInt32Value (uint16 index, int32 value)
bool AddUInt64Value (uint16 index, const uint64 &value)
bool RemoveUInt64Value (uint16 index, const uint64 &value)
void ApplyModUInt32Value (uint16 index, int32 val, bool apply)
void ApplyModInt32Value (uint16 index, int32 val, bool apply)
void ApplyModUInt64Value (uint16 index, int32 val, bool apply)
void ApplyModPositiveFloatValue (uint16 index, float val, bool apply)
void ApplyModSignedFloatValue (uint16 index, float val, bool apply)
void ApplyPercentModFloatValue (uint16 index, float val, bool apply)
void SetFlag (uint16 index, uint32 newFlag)
void RemoveFlag (uint16 index, uint32 oldFlag)
void ToggleFlag (uint16 index, uint32 flag)
bool HasFlag (uint16 index, uint32 flag) const
void SetByteFlag (uint16 index, uint8 offset, uint8 newFlag)
void RemoveByteFlag (uint16 index, uint8 offset, uint8 newFlag)
void ToggleFlag (uint16 index, uint8 offset, uint8 flag)
bool HasByteFlag (uint16 index, uint8 offset, uint8 flag) const
void ApplyModFlag (uint16 index, uint32 flag, bool apply)
void SetFlag64 (uint16 index, uint64 newFlag)
void RemoveFlag64 (uint16 index, uint64 oldFlag)
void ToggleFlag64 (uint16 index, uint64 flag)
bool HasFlag64 (uint16 index, uint64 flag) const
void ApplyModFlag64 (uint16 index, uint64 flag, bool apply)
void ClearUpdateMask (bool remove)
bool LoadValues (const char *data)
uint16 GetValuesCount () const
void BuildFieldsUpdate (Player *, UpdateDataMapType &) const
void ForceValuesUpdateAtIndex (uint32)
PlayerToPlayer ()
Player const * ToPlayer () const
CreatureToCreature ()
Creature const * ToCreature () const
UnitToUnit ()
Unit const * ToUnit () const
GameObjectToGameObject ()
GameObject const * ToGameObject () const
CorpseToCorpse ()
Corpse const * ToCorpse () const
DynamicObjectToDynObject ()
DynamicObject const * ToDynObject () const
- Public Member Functions inherited from WorldLocation
 WorldLocation (uint32 _mapid=MAPID_INVALID, float _x=0, float _y=0, float _z=0, float _o=0)
 WorldLocation (const WorldLocation &loc)
void WorldRelocate (const WorldLocation &loc)
uint32 GetMapId () const
- Public Member Functions inherited from Position
 Position (float x=0, float y=0, float z=0, float o=0)
 Position (Position const &loc)
bool operator== (Position const &a)
bool operator!= (Position const &a)
void Relocate (float x, float y)
void Relocate (float x, float y, float z)
void Relocate (float x, float y, float z, float orientation)
void Relocate (Position const &pos)
void Relocate (Position const *pos)
void RelocateOffset (Position const &offset)
void SetOrientation (float orientation)
float GetPositionX () const
float GetPositionY () const
float GetPositionZ () const
float GetOrientation () const
void GetPosition (float &x, float &y) const
void GetPosition (float &x, float &y, float &z) const
void GetPosition (float &x, float &y, float &z, float &o) const
Position GetPosition () const
Position::PositionXYStreamer PositionXYStream ()
Position::PositionXYZStreamer PositionXYZStream ()
Position::PositionXYZOStreamer PositionXYZOStream ()
bool IsPositionValid () const
float GetExactDist2dSq (float x, float y) const
float GetExactDist2d (const float x, const float y) const
float GetExactDist2dSq (Position const *pos) const
float GetExactDist2d (Position const *pos) const
float GetExactDistSq (float x, float y, float z) const
float GetExactDist (float x, float y, float z) const
float GetExactDistSq (Position const *pos) const
float GetExactDist (Position const *pos) const
void GetPositionOffsetTo (Position const &endPos, Position &retOffset) const
Position GetPositionWithOffset (Position const &offset) const
float GetAngle (Position const *pos) const
float GetAngle (float x, float y) const
float GetRelativeAngle (Position const *pos) const
float GetRelativeAngle (float x, float y) const
void GetSinCos (float x, float y, float &vsin, float &vcos) const
bool IsInDist2d (float x, float y, float dist) const
bool IsInDist2d (Position const *pos, float dist) const
bool IsInDist (float x, float y, float z, float dist) const
bool IsInDist (Position const *pos, float dist) const
bool IsWithinBox (const Position &center, float xradius, float yradius, float zradius) const
bool HasInArc (float arcangle, Position const *pos, float border=2.0f) const
bool HasInLine (Position const *pos, float width) const
std::string ToString () const
- Public Member Functions inherited from GridObject< Creature >
bool IsInGrid () const
void AddToGrid (GridRefManager< Creature > &m)
void RemoveFromGrid ()

Public Attributes

Loot loot
uint32 m_spells [CREATURE_MAX_SPELLS]
CreatureSpellCooldowns m_CreatureSpellCooldowns
CreatureSpellCooldowns m_CreatureCategoryCooldowns
uint32 m_GlobalCooldown
bool hasPlayerDamaged
float m_SightDistance
float m_CombatDistance
bool m_isTempWorldObject
- Public Attributes inherited from Unit
uint32 m_extraAttacks
bool m_canDualWield
ControlList m_Controlled
uint32 m_addDmgOnce
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
PetAuraSet m_petAuras
bool IsAIEnabled
bool NeedChangeAI
uint64 LastCharmerGUID
bool m_ControlledByPlayer
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealth
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealthDetect
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibility
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibilityDetect
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibility
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibilityDetect
uint32 m_groupLootTimer
uint64 lootingGroupLeaderGUID
MovementInfo m_movementInfo
- Public Attributes inherited from WorldLocation
uint32 m_mapId
- Public Attributes inherited from Position
float m_positionX
float m_positionY
float m_positionZ

Protected Member Functions

bool CreateFromProto (uint32 guidlow, uint32 Entry, uint32 team, const CreatureData *data=NULL)
bool InitEntry (uint32 entry, uint32 team=ALLIANCE, const CreatureData *data=NULL)
void _RealtimeSetCreatureInfo ()
void RegenerateMana ()
void RegenerateHealth ()
bool IsInvisibleDueToDespawn () const override
bool CanAlwaysSee (WorldObject const *obj) const override
- Protected Member Functions inherited from Unit
 Unit (bool isWorldObject)
void _UpdateSpells (uint32 time)
void _DeleteAuras ()
void _UpdateAutoRepeatSpell ()
void DisableSpline ()
bool IsAlwaysVisibleFor (WorldObject const *seer) const override
bool IsAlwaysDetectableFor (WorldObject const *seer) const override
- Protected Member Functions inherited from WorldObject
 WorldObject (bool isWorldObject)
void SetLocationMapId (uint32 _mapId)
void SetLocationInstanceId (uint32 _instanceId)
- Protected Member Functions inherited from Object
 Object ()
void _InitValues ()
void _Create (uint32 guidlow, uint32 entry, HighGuid guidhigh)
void _LoadIntoDataField (const char *data, uint32 startOffset, uint32 count)
virtual void _SetUpdateBits (UpdateMask *updateMask, Player *target) const
virtual void _SetCreateBits (UpdateMask *updateMask, Player *target) const
void _BuildMovementUpdate (ByteBuffer *data, uint8 updateFlags) const
void _BuildValuesUpdate (uint8 updatetype, ByteBuffer *data, UpdateMask *updateMask, Player *target) const

Static Protected Member Functions

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

Protected Attributes

VendorItemCounts m_vendorItemCounts
uint32 m_lootMoney
uint64 m_lootRecipient
uint32 m_lootRecipientGroup
uint64 _skinner
time_t _pickpocketLootRestore
 Timers. More...
uint32 m_corpseRemoveTime
time_t m_respawnTime
uint32 m_respawnDelay
uint32 m_corpseDelay
float m_respawnradius
uint32 m_combatPulseTime
uint32 m_combatPulseDelay
uint8 m_emoteState
ReactStates m_reactState
uint32 m_regenTimer
MovementGeneratorType m_defaultMovementType
Cell m_currentCell
uint32 m_DBTableGuid
uint32 m_equipmentId
bool m_AlreadyCallAssistance
bool m_AlreadySearchedAssistance
bool m_regenHealth
bool m_AI_locked
SpellSchoolMask m_meleeDamageSchoolMask
uint32 m_originalEntry
Position m_homePosition
bool DisableReputationGain
CreatureData const * m_creatureData
- Protected Attributes inherited from Unit
bool m_AutoRepeatFirstCast
bool m_initiatingCombat
uint32 m_attackTimer [MAX_ATTACK]
float m_createStats [MAX_STATS]
AttackerSet m_attackers
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
SharedVisionList m_sharedVision
MotionMaster i_motionMaster
uint64 miniPetGuid
uint32 m_reactiveTimer [MAX_REACTIVE]
ThreatManager m_ThreatManager
- Protected Attributes inherited from WorldObject
std::string m_name
bool m_isActive
const bool m_isWorldObject
- Protected Attributes inherited from Object
uint16 m_objectType
uint8 m_objectTypeId
uint8 m_updateFlag
union {
   int32 *   m_int32Values
   uint32 *   m_uint32Values
   float *   m_floatValues
uint16 m_valuesCount
bool m_objectUpdated

Private Attributes

uint32 m_waypointID
uint32 m_path_id
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 Position
static float NormalizeOrientation (float o)
- Protected Types inherited from Unit
typedef std::list< uint64DynObjectGUIDs

Detailed Description

Definition at line 459 of file Creature.h.

Constructor & Destructor Documentation

Creature::Creature ( bool  isWorldObject = false)

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 {
160  for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
161  m_spells[i] = 0;
163  m_CreatureSpellCooldowns.clear();
167  m_CombatDistance = 0; // MELEE_RANGE
169  TriggerJustRespawned = false;
170  m_isTempWorldObject = false;
171 }
uint32 m_corpseDelay
Definition: Creature.h:902
CreatureData const * m_creatureData
Definition: Creature.h:929
bool m_isTempWorldObject
Definition: Creature.h:878
time_t m_respawnTime
Definition: Creature.h:900
bool m_AlreadyCallAssistance
Definition: Creature.h:917
bool m_AlreadySearchedAssistance
Definition: Creature.h:918
bool hasPlayerDamaged
Definition: Creature.h:859
uint8 m_emoteState
Definition: Creature.h:907
MovementGeneratorType m_defaultMovementType
Definition: Creature.h:912
time_t _pickpocketLootRestore
Definition: Creature.h:898
uint32 m_combatPulseDelay
Definition: Creature.h:905
ReactStates m_reactState
Definition: Creature.h:908
float m_respawnradius
Definition: Creature.h:903
uint32 m_lootRecipientGroup
Definition: Creature.h:894
uint32 m_corpseRemoveTime
Definition: Creature.h:899
uint32 m_spells[CREATURE_MAX_SPELLS]
Definition: Creature.h:679
ACE_UINT8 uint8
Definition: Define.h:73
CreatureGroup * m_formation
Definition: Creature.h:939
Definition: Creature.h:125
uint32 m_lootMoney
Definition: Creature.h:892
uint32 m_DBTableGuid
Definition: Creature.h:914
uint32 m_GlobalCooldown
Definition: Creature.h:682
CreatureInfo const * m_creatureInfo
Definition: Creature.h:943
bool m_regenHealth
Definition: Creature.h:919
bool m_AI_locked
Definition: Creature.h:920
uint32 m_combatPulseTime
Definition: Creature.h:904
CreatureSpellCooldowns m_CreatureSpellCooldowns
Definition: Creature.h:680
bool DisableReputationGain
Definition: Creature.h:927
bool TriggerJustRespawned
Definition: Creature.h:941
SpellSchoolMask m_meleeDamageSchoolMask
Definition: Creature.h:922
uint64 _skinner
Definition: Creature.h:895
uint32 m_respawnDelay
Definition: Creature.h:901
uint64 m_lootRecipient
Definition: Creature.h:893
Definition: Unit.h:249
float m_SightDistance
Definition: Creature.h:864
uint16 m_valuesCount
Definition: Object.h:432
uint32 m_regenTimer
Definition: Creature.h:911
Definition: Object.h:48
#define sWorld
Definition: World.h:860
uint32 m_equipmentId
Definition: Creature.h:915
CreatureSpellCooldowns m_CreatureCategoryCooldowns
Definition: Creature.h:681
float m_CombatDistance
Definition: Creature.h:864
Unit(bool isWorldObject)
Definition: Unit.cpp:364
Creature::~Creature ( )

Definition at line 173 of file Creature.cpp.

References Unit::i_AI, and m_vendorItemCounts.

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

Member Function Documentation

void Creature::_AddCreatureCategoryCooldown ( uint32  category,
time_t  apply_time 

Definition at line 2228 of file Creature.cpp.

References m_CreatureCategoryCooldowns.

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

2229 {
2230  m_CreatureCategoryCooldowns[category] = end_time;
2231 }
CreatureSpellCooldowns m_CreatureCategoryCooldowns
Definition: Creature.h:681
void Creature::_AddCreatureSpellCooldown ( uint32  spell_id,
time_t  end_time 

Definition at line 2223 of file Creature.cpp.

References m_CreatureSpellCooldowns.

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

2224 {
2225  m_CreatureSpellCooldowns[spell_id] = end_time;
2226 }
CreatureSpellCooldowns m_CreatureSpellCooldowns
Definition: Creature.h:680
float Creature::_GetDamageMod ( int32  Rank)

Definition at line 1224 of file Creature.cpp.


Referenced by SelectLevel().

float Creature::_GetHealthMod ( int32  Rank)

Definition at line 1200 of file Creature.cpp.


Referenced by LoadCreatureFromDB(), and SelectLevel().

bool Creature::_IsTargetAcceptable ( const Unit target) const

Definition at line 2012 of file Creature.cpp.

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

Referenced by canStartAttack().

2013 {
2014  ASSERT(target);
2016  // if the target cannot be attacked, the target is not acceptable
2017  if (IsFriendlyTo(target)
2018  || !target->isTargetableForAttack(false))
2019  return false;
2021  if (target->HasUnitState(UNIT_STATE_DIED))
2022  {
2023  // guards can detect fake death
2025  return true;
2026  else
2027  return false;
2028  }
2030  Unit const* targetVictim = target->getAttackerForHelper();
2032  // if I'm already fighting target, or I'm hostile towards the target, the target is acceptable
2033  if (GetVictim() == target || IsHostileTo(target))
2034  return true;
2036  // a player is targeting me, but I'm not hostile towards it, and not currently attacking it, the target is not acceptable
2037  // (players may set their victim from a distance, and doesn't mean we should attack)
2038  if (target->GetTypeId() == TYPEID_PLAYER && targetVictim == this)
2039  return false;
2041  // if the target's victim is friendly, and the target is neutral, the target is acceptable
2042  if (targetVictim && IsFriendlyTo(targetVictim))
2043  return true;
2045  // if the target's victim is not friendly, or the target is friendly, the target is not acceptable
2046  return false;
2047 }
uint8 GetTypeId() const
Definition: Object.h:204
Unit * GetVictim() const
Definition: Unit.h:985
bool IsFriendlyTo(Unit const *unit) const
Definition: Unit.cpp:7284
bool IsGuard() const
Definition: Creature.h:511
bool IsHostileTo(Unit const *unit) const
Definition: Unit.cpp:7279
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1002
#define ASSERT
Definition: Errors.h:33
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.h:299
Definition: Unit.h:884
bool isTargetableForAttack(bool checkFakeDeath=true) const
Definition: Unit.cpp:9418
Unit * getAttackerForHelper() const
Definition: Unit.h:966
void Creature::_RealtimeSetCreatureInfo ( )
void Creature::AddCreatureSpellCooldown ( uint32  spellid)

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

2234 {
2235  SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellid);
2236  if (!spellInfo)
2237  return;
2239  uint32 cooldown = GetSpellRecoveryTime(spellInfo);
2240  if (Player* modOwner = GetSpellModOwner())
2241  modOwner->ApplySpellMod(spellid, SPELLMOD_COOLDOWN, cooldown);
2243  if (cooldown)
2244  _AddCreatureSpellCooldown(spellid, time(NULL) + cooldown / IN_MILLISECONDS);
2246  if (spellInfo->Category)
2247  _AddCreatureCategoryCooldown(spellInfo->Category, time(NULL));
2249  m_GlobalCooldown = spellInfo->StartRecoveryTime;
2251  if (Unit* owner = GetCharmerOrOwner())
2252  if (owner->GetTypeId() == TYPEID_PLAYER)
2253  {
2254  WorldPacket data(SMSG_SPELL_COOLDOWN, (4 + 8));
2255  data << uint64(GetGUID());
2256  data << uint8(0x0); // flags (0x1, 0x2)
2257  data << uint32(spellid);
2258  data << uint32(cooldown); // in m.secs
2260  owner->ToPlayer()->GetSession()->SendPacket(&data);
2261  }
2262 }
uint32 Category
Definition: DBCStructure.h:675
void _AddCreatureSpellCooldown(uint32 spell_id, time_t end_time)
Definition: Creature.cpp:2223
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
ACE_UINT8 uint8
Definition: Define.h:73
uint32 m_GlobalCooldown
Definition: Creature.h:682
ACE_UINT64 uint64
Definition: Define.h:70
Unit * GetCharmerOrOwner() const
Definition: Unit.h:1519
Player * GetSpellModOwner() const
Definition: Unit.cpp:11748
void _AddCreatureCategoryCooldown(uint32 category, time_t apply_time)
Definition: Creature.cpp:2228
uint32 StartRecoveryTime
Definition: DBCStructure.h:758
ACE_UINT32 uint32
Definition: Define.h:71
Definition: Unit.h:884
Definition: Player.h:922
uint32 GetSpellRecoveryTime(SpellEntry const *spellInfo)
Definition: SpellMgr.h:151
const uint64 & GetGUID() const
Definition: Object.h:156
void Creature::AddToWorld ( )

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);
191  SearchFormation();
192  AIM_Initialize();
193  }
194 }
void AddObject(T *object)
void AddToWorld() override
Definition: Unit.cpp:11050
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:129
ZoneScript * m_zoneScript
Definition: Object.h:922
void SearchFormation()
Definition: Creature.cpp:220
CreatureAI* Creature::AI ( ) const

Definition at line 548 of file Creature.h.

Referenced by 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::HandleQuestgiverAcceptQuestOpcode(), 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().

549  {
550  return (CreatureAI*)i_AI;
551  }
UnitAI * i_AI
Definition: Unit.h:2115
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  }
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:2101
UnitAI * i_AI
Definition: Unit.h:2115
virtual void InitializeAI()
Definition: UnitAI.h:55
CreatureAI * selectAI(Creature *creature)
bool m_AI_locked
Definition: Creature.h:920
MotionMaster i_motionMaster
Definition: Unit.h:2166
void Initialize()
Definition: UnitAI.h:40
void Creature::AllLootRemovedFromCorpse ( )

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

2335 {
2336  if (loot.loot_type != LOOT_SKINNING && !IsPet() && GetCreatureTemplate()->SkinLootId && hasLootRecipient())
2340  time_t now = time(NULL);
2341  // Do not reset corpse remove time if corpse is already removed
2342  if (m_corpseRemoveTime <= now)
2343  return;
2345  float decayRate = sWorld.getRate(RATE_CORPSE_DECAY_LOOTED);
2347  // corpse skinnable, but without skinning flag, and then skinned, corpse will despawn next update
2348  if (loot.loot_type == LOOT_SKINNING)
2349  m_corpseRemoveTime = now;
2350  else
2351  m_corpseRemoveTime = now + uint32(m_corpseDelay * decayRate);
2354 }
uint32 m_corpseDelay
Definition: Creature.h:902
time_t m_respawnTime
Definition: Creature.h:900
Loot loot
Definition: Creature.h:662
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:985
uint32 m_corpseRemoveTime
Definition: Creature.h:899
bool HaveLootFor(uint32 loot_id) const
Definition: LootMgr.h:184
bool IsPet() const
Definition: Unit.h:1020
uint32 m_respawnDelay
Definition: Creature.h:901
CreatureInfo const * GetCreatureTemplate() const
Definition: Creature.h:598
LootType loot_type
Definition: LootMgr.h:312
bool hasLootRecipient() const
Definition: Creature.h:670
#define sWorld
Definition: World.h:860
ACE_UINT32 uint32
Definition: Define.h:71
LootStore LootTemplates_Skinning("skinning_loot_template","creature skinning id")
void Creature::CallAssistance ( )

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

1907 {
1908  if (!m_AlreadyCallAssistance && GetVictim() && !IsPet() && !isCharmed())
1909  {
1910  SetNoCallAssistance(true);
1912  float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS);
1914  if (radius > 0)
1915  {
1916  std::list<Creature*> assistList;
1918  {
1920  Cell cell(p);
1921  cell.SetNoCreate();
1923  Oregon::AnyAssistCreatureInRangeCheck u_check(this, GetVictim(), radius);
1928  cell.Visit(p, grid_creature_searcher, *GetMap(), *this, radius);
1929  }
1931  if (!assistList.empty())
1932  {
1933  AssistDelayEvent* e = new AssistDelayEvent(GetVictim()->GetGUID(), *this);
1934  while (!assistList.empty())
1935  {
1936  // Pushing guids because in delay can happen some creature gets despawned => invalid pointer
1937  e->AddAssistant((*assistList.begin())->GetGUID());
1938  assistList.pop_front();
1939  }
1941  }
1942  }
1943  }
1944 }
EventProcessor m_Events
Definition: Unit.h:1746
Map * GetMap() const
Definition: Object.h:829
void SetNoCallAssistance(bool val)
Definition: Creature.h:697
void AddEvent(BasicEvent *Event, uint64 e_time, bool set_addtime=true)
bool m_AlreadyCallAssistance
Definition: Creature.h:917
void AddAssistant(const uint64 &guid)
Definition: Creature.h:954
uint64 CalculateTime(uint64 t_offset)
Unit * GetVictim() const
Definition: Unit.h:985
float GetPositionY() const
Definition: Position.h:98
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:167
bool IsPet() const
Definition: Unit.h:1020
Definition: Cell.h:46
#define sWorld
Definition: World.h:860
bool isCharmed() const
Definition: Unit.h:1543
float GetPositionX() const
Definition: Position.h:97
const uint64 & GetGUID() const
Definition: Object.h:156
void Creature::CallForHelp ( float  fRadius)

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

1947 {
1948  if (radius <= 0.0f || !GetVictim() || IsPet() || isCharmed())
1949  return;
1952  Cell cell(p);
1953  cell.SetNoCreate();
1955  Oregon::CallOfHelpCreatureInRangeDo u_do(this, GetVictim(), radius);
1960  cell.Visit(p, grid_creature_searcher, *GetMap(), *this, radius);
1961 }
Map * GetMap() const
Definition: Object.h:829
Unit * GetVictim() const
Definition: Unit.h:985
float GetPositionY() const
Definition: Position.h:98
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:167
bool IsPet() const
Definition: Unit.h:1020
Definition: Cell.h:46
bool isCharmed() const
Definition: Unit.h:1543
float GetPositionX() const
Definition: Position.h:97
bool Creature::CanAlwaysSee ( WorldObject const *  obj) const

Reimplemented from WorldObject.

Definition at line 1474 of file Creature.cpp.

References AI(), and Unit::IsAIEnabled.

1475 {
1476  if (IsAIEnabled && AI()->CanSeeAlways(obj))
1477  return true;
1479  return false;
1480 }
bool IsAIEnabled
Definition: Unit.h:2101
CreatureAI * AI() const
Definition: Creature.h:548
bool Creature::CanAssistTo ( const Unit u,
const Unit enemy,
bool  checkfaction = true 
) const

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

1964 {
1965  if (IsInEvadeMode())
1966  return false;
1968  // is it true?
1970  return false;
1972  // we don't need help from zombies :)
1973  if (!IsAlive())
1974  return false;
1976  // we don't need help from non-combatant ;)
1977  if (isCivilian())
1978  return false;
1981  return false;
1983  // skip fighting creature
1984  if (IsInCombat())
1985  return false;
1987  // only free creature
1988  if (GetCharmerOrOwnerGUID())
1989  return false;
1991  // only from same creature faction
1992  if (checkfaction)
1993  {
1994  if (getFaction() != u->getFaction())
1995  return false;
1996  }
1997  else
1998  {
1999  if (!IsFriendlyTo(u))
2000  return false;
2001  }
2003  // skip non hostile to caster enemy creatures
2004  if (!IsHostileTo(enemy))
2005  return false;
2007  return true;
2008 }
uint32 getFaction() const
Definition: Unit.h:1111
bool IsInCombat() const
Definition: Unit.h:1318
bool HasReactState(ReactStates state) const
Definition: Creature.h:527
bool IsInEvadeMode() const
Definition: Creature.cpp:2284
uint64 GetCharmerOrOwnerGUID() const
Definition: Unit.h:1496
bool isCivilian() const
Definition: Creature.h:503
bool IsAlive() const
Definition: Unit.h:1433
bool IsFriendlyTo(Unit const *unit) const
Definition: Unit.cpp:7284
bool IsHostileTo(Unit const *unit) const
Definition: Unit.cpp:7279
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.h:299
bool Creature::CanCreatureAttack ( Unit const *  victim,
bool  force = true 
) const

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

2058 {
2059  if (!victim)
2060  return false;
2062  if (!victim->IsInMap(this))
2063  return false;
2065  if (!IsValidAttackTarget(victim))
2066  return false;
2068  if (!victim->isInAccessiblePlaceFor(this))
2069  return false;
2071  if (IsAIEnabled && !AI()->CanAIAttack(victim))
2072  return false;
2074  // we cannot attack in evade mode
2075  if (IsInEvadeMode())
2076  return false;
2078  // or if enemy is in evade mode
2079  if (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsInEvadeMode())
2080  return false;
2082  if (Unit* u = GetCharmerOrOwner())
2083  {
2084  if (u->GetTypeId() == TYPEID_PLAYER)
2085  {
2086  if (GetMap()->IsDungeon())
2087  return true;
2089  // don't check distance to home position if recently damaged, this should include taunt auras
2091  return true;
2092  }
2093  }
2095  // Get the correct threat range from the config.
2096  float dist = std::max<float>(GetAttackDistance(victim), sWorld.getConfig(CONFIG_THREAT_RADIUS) + m_CombatDistance);
2098  if (Unit* unit = GetCharmerOrOwner())
2099  return victim->IsWithinDist(unit, dist);
2100  else
2101  {
2102  // include sizes for huge npcs
2103  dist += GetObjectSize() + victim->GetObjectSize();
2105  // to prevent creatures in air ignore attacks because distance is already too high...
2106  if (GetCreatureTemplate()->InhabitType & INHABIT_AIR)
2107  return victim->IsInDist2d(&m_homePosition, dist);
2108  else
2109  return victim->IsInDist(&m_homePosition, dist);
2110  }
2111 }
time_t GetLastDamagedTime() const
Definition: Unit.h:2106
Position m_homePosition
Definition: Creature.h:925
Map * GetMap() const
Definition: Object.h:829
uint32 getMSTime()
Definition: Timer.h:32
bool IsValidAttackTarget(Unit const *target) const
Definition: Unit.cpp:9433
bool IsInEvadeMode() const
Definition: Creature.cpp:2284
bool IsDungeon() const
Definition: Map.h:427
virtual bool CanAIAttack(const Unit *) const
Definition: UnitAI.h:48
bool IsAIEnabled
Definition: Unit.h:2101
CreatureAI * AI() const
Definition: Creature.h:548
float GetAttackDistance(Unit const *pl) const
Definition: Creature.cpp:1520
CreatureInfo const * GetCreatureTemplate() const
Definition: Creature.h:598
Unit * GetCharmerOrOwner() const
Definition: Unit.h:1519
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:783
#define sWorld
Definition: World.h:860
bool isWorldBoss() const
Definition: Creature.cpp:1736
Definition: Unit.h:884
float m_CombatDistance
Definition: Creature.h:864
float GetObjectSize() const
Definition: Object.h:663
bool Creature::CanGeneratePickPocketLoot ( ) const

Definition at line 665 of file Creature.h.

Referenced by Player::SendLoot().

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

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

957 {
958  if (!isBattleMaster())
959  return false;
961  uint32 bgTypeId = sObjectMgr.GetBattleMasterBG(GetEntry());
962  if (!msg)
963  return player->GetBGAccessByLevel(bgTypeId);
965  if (!player->GetBGAccessByLevel(bgTypeId))
966  {
967  player->PlayerTalkClass->ClearMenus();
968  switch (bgTypeId)
969  {
970  case BATTLEGROUND_AV: player->PlayerTalkClass->SendGossipMenu(7616, GetGUID()); break;
971  case BATTLEGROUND_WS: player->PlayerTalkClass->SendGossipMenu(7599, GetGUID()); break;
972  case BATTLEGROUND_AB: player->PlayerTalkClass->SendGossipMenu(7642, GetGUID()); break;
977  case BATTLEGROUND_RL: player->PlayerTalkClass->SendGossipMenu(10024, GetGUID()); break;
978  default: break;
979  }
980  return false;
981  }
982  return true;
983 }
PlayerMenu * PlayerTalkClass
Definition: Player.h:2194
void ClearMenus()
Definition: GossipDef.cpp:116
void SendGossipMenu(uint32 TitleTextId, uint64 npcGUID)
Definition: GossipDef.cpp:137
#define sObjectMgr
Definition: ObjectMgr.h:1285
bool isBattleMaster() const
Definition: Unit.h:1256
uint32 GetEntry() const
Definition: Object.h:186
ACE_UINT32 uint32
Definition: Define.h:71
bool GetBGAccessByLevel(uint32 bgTypeId) const
Definition: Player.cpp:19403
const uint64 & GetGUID() const
Definition: Object.h:156
bool Creature::canStartAttack ( Unit const *  u,
bool  force 
) const

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

1483 {
1484  if (isCivilian())
1485  return false;
1487  // This set of checks is should be done only for creatures
1488  if ((HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC) && who->GetTypeId() != TYPEID_PLAYER) // flag is valid only for non player characters
1489  || (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) && who->GetTypeId() == TYPEID_PLAYER) // immune to PC and target is a player, return false
1490  || (who->GetOwner() && who->GetOwner()->GetTypeId() == TYPEID_PLAYER && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC))) // player pets are immune to pc as well
1491  return false;
1493  // Do not attack non-combat pets
1494  if (who->GetTypeId() == TYPEID_UNIT && who->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET)
1495  return false;
1498  return false;
1500  if (!force)
1501  {
1502  if (!_IsTargetAcceptable(who))
1503  return false;
1505  if (who->IsInCombat() && IsWithinDist(who, ATTACK_DISTANCE))
1506  if (Unit* victim = who->getAttackerForHelper())
1508  force = true;
1510  if (!force && (IsNeutralToAll() || !IsWithinDistInMap(who, GetAttackDistance(who) + m_CombatDistance)))
1511  return false;
1512  }
1514  if (!CanCreatureAttack(who, force))
1515  return false;
1517  return IsWithinLOSInMap(who);
1518 }
Definition: Object.h:36
Definition: Creature.h:451
bool IsWithinLOSInMap(const WorldObject *obj) const
Definition: Object.cpp:1226
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition: Object.h:762
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition: Object.h:758
bool canFly() const
Definition: Creature.h:520
bool _IsTargetAcceptable(const Unit *target) const
Definition: Creature.cpp:2012
bool isCivilian() const
Definition: Creature.h:503
bool IsNeutralToAll() const
Definition: Unit.cpp:7302
float GetAttackDistance(Unit const *pl) const
Definition: Creature.cpp:1520
bool CanCreatureAttack(Unit const *victim, bool force=true) const
Definition: Creature.cpp:2057
#define sWorld
Definition: World.h:860
float GetDistanceZ(const WorldObject *obj) const
Definition: Object.cpp:1192
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.h:299
Definition: Unit.h:884
float m_CombatDistance
Definition: Creature.h:864
Unit * getAttackerForHelper() const
Definition: Unit.h:966
virtual bool Creature::canSwim ( ) const

Reimplemented in Pet.

Definition at line 516 of file Creature.h.

References GetCreatureTemplate(), INHABIT_WATER, and CreatureInfo::InhabitType.

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

517  {
519  }
bool isCharmedOwnedByPlayerOrPlayer() const
Definition: Unit.h:1506
CreatureInfo const * GetCreatureTemplate() const
Definition: Creature.h:598
uint32 InhabitType
Definition: Creature.h:190
bool Creature::CanTrainAndResetTalentsOf ( Player pPlayer) const

Definition at line 985 of file Creature.cpp.

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

Referenced by Player::PrepareGossipMenu().

986 {
987  return player->getLevel() >= 10
989  && player->getClass() == GetCreatureTemplate()->classNum;
990 }
uint32 trainer_type
Definition: Creature.h:166
CreatureInfo const * GetCreatureTemplate() const
Definition: Creature.h:598
uint32 classNum
Definition: Creature.h:168
bool Creature::canWalk ( ) const

Definition at line 512 of file Creature.h.

References GetCreatureTemplate(), INHABIT_GROUND, and CreatureInfo::InhabitType.

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

513  {
515  }
CreatureInfo const * GetCreatureTemplate() const
Definition: Creature.h:598
uint32 InhabitType
Definition: Creature.h:190
void Creature::ClearTextRepeatGroup ( uint8  textGroup)

Definition at line 2662 of file Creature.cpp.

References m_textRepeat.

Referenced by CreatureTextMgr::SendChat().

2663 {
2664  CreatureTextRepeatGroup::iterator groupItr = m_textRepeat.find(textGroup);
2665  if (groupItr != m_textRepeat.end())
2666  groupItr->second.clear();
2667 }
CreatureTextRepeatGroup m_textRepeat
Definition: Creature.h:945
bool Creature::Create ( uint32  guidlow,
Map map,
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

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(), 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);
764  CreatureInfo const* cinfo = sObjectMgr.GetCreatureTemplate(entry);
765  if (!cinfo)
766  {
767  sLog.outError("Creature::Create(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, entry);
768  return false;
769  }
773  Relocate(x, y, z, ang);
775  if (!IsPositionValid())
776  {
777  sLog.outError("Creature (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow, entry, x, y);
778  return false;
779  }
781  // Allow players to see those units while dead, do it here (mayby altered by addon auras)
785  if (!CreateFromProto(guidlow, entry, team, data))
786  return false;
788  switch (GetCreatureTemplate()->rank)
789  {
792  break;
795  break;
798  break;
801  break;
802  default:
804  break;
805  }
808  if (isSpiritHealer() || isSpiritGuide())
809  {
812  }
814  return true;
815 }
uint32 m_corpseDelay
Definition: Creature.h:902
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition: Object.h:821
virtual void SetMap(Map *map)
Definition: Object.cpp:1951
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:620
#define sLog
Log class singleton.
Definition: Log.h:187
bool isSpiritGuide() const
Definition: Unit.h:1272
#define sObjectMgr
Definition: ObjectMgr.h:1285
void Relocate(float x, float y)
Definition: Position.h:65
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
Definition: Object.h:822
bool CreateFromProto(uint32 guidlow, uint32 Entry, uint32 team, const CreatureData *data=NULL)
Definition: Creature.cpp:1262
CreatureInfo const * GetCreatureTemplate() const
Definition: Creature.h:598
#define ASSERT
Definition: Errors.h:33
bool IsPositionValid() const
Definition: Position.cpp:40
#define sWorld
Definition: World.h:860
uint32 type_flags
Definition: Creature.h:174
bool isSpiritHealer() const
Definition: Unit.h:1268
bool Creature::CreateFromProto ( uint32  guidlow,
uint32  Entry,
uint32  team,
const CreatureData data = NULL 

Definition at line 1262 of file Creature.cpp.

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

Referenced by Create().

1263 {
1264  SetZoneScript();
1265  if (m_zoneScript && data)
1266  {
1267  entry = m_zoneScript->GetCreatureEntry(guidlow, data);
1268  if (!entry)
1269  return false;
1270  }
1272  CreatureInfo const* cinfo = sObjectMgr.GetCreatureTemplate(entry);
1273  if (!cinfo)
1274  {
1275  sLog.outErrorDb("Creature::CreateFromProto(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, entry);
1276  return false;
1277  }
1279  SetOriginalEntry(entry);
1281  Object::_Create(guidlow, entry, HIGHGUID_UNIT);
1283  if (!UpdateEntry(entry, team, data))
1284  return false;
1286  return true;
1287 }
#define sLog
Log class singleton.
Definition: Log.h:187
#define sObjectMgr
Definition: ObjectMgr.h:1285
void _Create(uint32 guidlow, uint32 entry, HighGuid guidhigh)
Definition: Object.cpp:125
ZoneScript * m_zoneScript
Definition: Object.h:922
void SetOriginalEntry(uint32 entry)
Definition: Creature.h:862
virtual uint32 GetCreatureEntry(uint32, const CreatureData *data)
Definition: ZoneScript.h:35
bool UpdateEntry(uint32 entry, uint32 team=ALLIANCE, const CreatureData *data=NULL)
Definition: Creature.cpp:353
void SetZoneScript()
Definition: Object.cpp:2099
void Creature::DeleteFromDB ( )

Reimplemented in Pet.

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

1445 {
1446  if (!m_DBTableGuid)
1447  {
1448  sLog.outDebug("Trying to delete not saved creature!");
1449  return;
1450  }
1452  sObjectMgr.SaveCreatureRespawnTime(m_DBTableGuid, GetInstanceId(), 0);
1453  sObjectMgr.DeleteCreatureData(m_DBTableGuid);
1456  WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid = '%u'", m_DBTableGuid);
1457  WorldDatabase.PExecuteLog("DELETE FROM creature_addon WHERE guid = '%u'", m_DBTableGuid);
1458  WorldDatabase.PExecuteLog("DELETE FROM game_event_creature WHERE guid = '%u'", m_DBTableGuid);
1459  WorldDatabase.PExecuteLog("DELETE FROM game_event_model_equip WHERE guid = '%u'", m_DBTableGuid);
1461 }
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
bool BeginTransaction()
Definition: Database.cpp:533
#define sLog
Log class singleton.
Definition: Log.h:187
#define sObjectMgr
Definition: ObjectMgr.h:1285
bool CommitTransaction()
Definition: Database.cpp:551
bool PExecuteLog(const char *format,...) ATTR_PRINTF(2
Definition: Database.cpp:221
uint32 m_DBTableGuid
Definition: Creature.h:914
uint32 GetInstanceId() const
Definition: Object.h:682
void Creature::DespawnOrUnsummon ( uint32  msTimeToDespawn = 0)

Definition at line 1697 of file Creature.cpp.

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

Referenced by SmartAI::UpdateDespawn().

1698 {
1699  if (TempSummon* summon = this->ToTempSummon())
1700  summon->UnSummon(msTimeToDespawn);
1701  else
1702  ForcedDespawn(msTimeToDespawn);
1703 }
void ForcedDespawn(uint32 timeMSToDespawn=0)
Definition: Creature.cpp:1681
TempSummon * ToTempSummon()
Definition: Unit.h:2109
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:1558
bool IsAlive() const
Definition: Unit.h:1433
void RemoveCorpse(bool setSpawnTime=true)
Definition: Creature.cpp:234
void DestroyForNearbyPlayers()
Definition: Object.cpp:2554
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;
713  return;
715  float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS);
716  if (radius > 0)
717  {
718  Creature* creature = NULL;
721  Cell cell(p);
722  cell.SetNoCreate();
728  cell.Visit(p, grid_creature_searcher, *GetMap(), *this, radius);
730  SetNoSearchAssistance(true);
731  UpdateSpeed(MOVE_RUN, false);
733  if (!creature)
735  else
736  GetMotionMaster()->MoveSeekAssistance(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ());
737  }
739 }
Map * GetMap() const
Definition: Object.h:829
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition: Unit.cpp:9806
MotionMaster * GetMotionMaster()
Definition: Unit.h:2001
void SetControlled(bool apply, UnitState state)
Definition: Unit.cpp:12792
void MoveSeekAssistance(float x, float y, float z)
Unit * GetVictim() const
Definition: Unit.h:985
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:461
void SetNoSearchAssistance(bool val)
Definition: Creature.h:698
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:783
#define sWorld
Definition: World.h:860
float GetPositionX() const
Definition: Position.h:97
bool Creature::FallGround ( )
void Creature::ForcedDespawn ( uint32  timeMSToDespawn = 0)

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

1682 {
1683  if (timeMSToDespawn)
1684  {
1685  ForcedDespawnDelayEvent* pEvent = new ForcedDespawnDelayEvent(*this);
1687  m_Events.AddEvent(pEvent, m_Events.CalculateTime(timeMSToDespawn));
1688  return;
1689  }
1691  if (IsAlive())
1694  RemoveCorpse(false);
1695 }
EventProcessor m_Events
Definition: Unit.h:1746
void AddEvent(BasicEvent *Event, uint64 e_time, bool set_addtime=true)
uint64 CalculateTime(uint64 t_offset)
void setDeathState(DeathState s) override
Definition: Creature.cpp:1558
bool IsAlive() const
Definition: Unit.h:1433
void RemoveCorpse(bool setSpawnTime=true)
Definition: Creature.cpp:234
float Creature::GetAggroRange ( Unit const *  target) const

Definition at line 2670 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.

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

Definition at line 2369 of file Creature.cpp.

References Object::GetEntry(), and sObjectMgr.

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

2370 {
2371  return sObjectMgr.GetCreatureTemplate(GetEntry())->AIName;
2372 }
#define sObjectMgr
Definition: ObjectMgr.h:1285
uint32 GetEntry() const
Definition: Object.h:186
float Creature::GetAttackDistance ( Unit const *  pl) const

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

1521 {
1522  float aggroRate = sWorld.getRate(RATE_CREATURE_AGGRO);
1523  if (aggroRate == 0)
1524  return 0.0f;
1526  uint32 playerlevel = player->getLevelForTarget(this);
1527  uint32 creaturelevel = getLevelForTarget(player);
1529  int32 leveldif = int32(playerlevel) - int32(creaturelevel);
1531  // "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."
1532  if (leveldif < - 25)
1533  leveldif = -25;
1535  // "The aggro radius of a mob having the same level as the player is roughly 20 yards"
1536  float RetDistance = 20;
1538  // "Aggro Radius varies with level difference at a rate of roughly 1 yard/level"
1539  // radius grow if playlevel < creaturelevel
1540  RetDistance -= (float)leveldif;
1542  if (creaturelevel + 5 <= int32(sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)))
1543  {
1544  // detect range auras
1547  // detected range auras
1548  RetDistance += player->GetTotalAuraModifier(SPELL_AURA_MOD_DETECTED_RANGE);
1549  }
1551  // "Minimum Aggro Radius for a mob seems to be combat range (5 yards)"
1552  if (RetDistance < 5)
1553  RetDistance = 5;
1555  return (RetDistance * aggroRate);
1556 }
int32 GetTotalAuraModifier(AuraType auratype) const
Definition: Unit.cpp:3615
ACE_INT32 int32
Definition: Define.h:67
uint8 getLevelForTarget(Unit const *target) const
Definition: Creature.cpp:2356
#define sWorld
Definition: World.h:860
ACE_UINT32 uint32
Definition: Define.h:71
uint32 Creature::GetCombatPulseDelay ( ) const

Definition at line 757 of file Creature.h.

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

Definition at line 2113 of file Creature.cpp.

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

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

2114 {
2115  if (m_DBTableGuid)
2116  {
2118  return addon;
2119  }
2121  // dependent from heroic mode entry
2123 }
static CreatureDataAddon const * GetCreatureAddon(uint32 lowguid)
Definition: ObjectMgr.h:623
static CreatureDataAddon const * GetCreatureTemplateAddon(uint32 entry)
Definition: ObjectMgr.h:628
uint32 m_DBTableGuid
Definition: Creature.h:914
CreatureInfo const * GetCreatureTemplate() const
Definition: Creature.h:598
CreatureData const* Creature::GetCreatureData ( ) const

Definition at line 602 of file Creature.h.

References GetScriptId().

603  {
604  return m_creatureData;
605  }
CreatureData const * m_creatureData
Definition: Creature.h:929
CreatureInfo const* Creature::GetCreatureTemplate ( ) const

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

599  {
600  return m_creatureInfo;
601  }
CreatureInfo const * m_creatureInfo
Definition: Creature.h:943
Cell const& Creature::GetCurrentCell ( ) const
uint32 Creature::GetCurrentEquipmentId ( )

Definition at line 586 of file Creature.h.

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

587  {
588  return m_equipmentId;
589  }
uint32 m_equipmentId
Definition: Creature.h:915
uint32 Creature::GetCurrentWaypointID ( )

Definition at line 825 of file Creature.h.

826  {
827  return m_waypointID;
828  }
uint32 m_waypointID
Definition: Creature.h:935
MovementGeneratorType Creature::GetDefaultMovementType ( ) const

Definition at line 703 of file Creature.h.

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

704  {
705  return m_defaultMovementType;
706  }
MovementGeneratorType m_defaultMovementType
Definition: Creature.h:912
uint32 Creature::GetEquipmentId ( ) const

Definition at line 488 of file Creature.h.

Referenced by SaveToDB().

489  {
490  return m_equipmentId;
491  }
uint32 m_equipmentId
Definition: Creature.h:915
CreatureGroup* Creature::GetFormation ( )

Definition at line 835 of file Creature.h.

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

836  {
837  return m_formation;
838  }
CreatureGroup * m_formation
Definition: Creature.h:939
uint32 Creature::GetGlobalCooldown ( ) const

Definition at line 811 of file Creature.h.

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

812  {
813  return m_GlobalCooldown;
814  }
uint32 m_GlobalCooldown
Definition: Creature.h:682
void Creature::GetHomePosition ( float &  x,
float &  y,
float &  z,
float &  ori 
Position Creature::GetHomePosition ( )

Definition at line 806 of file Creature.h.

807  {
808  return m_homePosition;
809  }
Position m_homePosition
Definition: Creature.h:925
uint8 Creature::getLevelForTarget ( Unit const *  target) const

Definition at line 2356 of file Creature.cpp.

References CONFIG_WORLD_BOSS_LEVEL_DIFF, Unit::getLevel(), Unit::getLevelForTarget(), isWorldBoss(), sWorld, and Object::ToUnit().

Referenced by GetAggroRange(), and GetAttackDistance().

2357 {
2358  if (!isWorldBoss() || !target->ToUnit())
2359  return Unit::getLevelForTarget(target);
2361  uint16 level = target->ToUnit()->getLevel() + sWorld.getConfig(CONFIG_WORLD_BOSS_LEVEL_DIFF);
2362  if (level < 1)
2363  return 1;
2364  if (level > 255)
2365  return 255;
2366  return uint8(level);
2367 }
uint8 getLevelForTarget(WorldObject const *) const override
Definition: Unit.h:1034
ACE_UINT8 uint8
Definition: Define.h:73
#define sWorld
Definition: World.h:860
ACE_UINT16 uint16
Definition: Define.h:72
bool isWorldBoss() const
Definition: Creature.cpp:1736
time_t Creature::GetLinkedCreatureRespawnTime ( ) const

Definition at line 2492 of file Creature.cpp.

References MapManager::FindMap(), Map::GetInstanceId(), WorldObject::GetMap(), WorldLocation::GetMapId(), Oregon::Singleton< MapManager, Oregon::ClassLevelLockable< MapManager, ACE_Thread_Mutex > >::Instance(), m_DBTableGuid, and sObjectMgr.

Referenced by Update().

2493 {
2494  if (!m_DBTableGuid) // only hard-spawned creatures from DB can have a linked master
2495  return 0;
2497  if (uint32 targetGuid = sObjectMgr.GetLinkedRespawnGuid(