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

#include <Pet.h>

Public Member Functions

 Pet (Player *owner, PetType type=MAX_PET_TYPE)
 
virtual ~Pet ()
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void SetDisplayId (uint32 modelId) override
 
PetType getPetType () const
 
void setPetType (PetType type)
 
bool isControlled () const
 
bool isTemporarySummoned () const
 
bool IsPermanentPetFor (Player *owner) const
 
bool Create (ObjectGuid::LowType guidlow, Map *map, uint32 Entry)
 
bool CreateBaseAtCreature (Creature *creature)
 
bool CreateBaseAtCreatureInfo (CreatureTemplate const *cinfo, Unit *owner)
 
bool CreateBaseAtTamed (CreatureTemplate const *cinfo, Map *map)
 
bool LoadPetFromDB (Player *owner, uint32 petentry=0, uint32 petnumber=0, bool current=false)
 
bool IsLoading () const override
 
void SavePetToDB (PetSaveMode mode)
 
void Remove (PetSaveMode mode, bool returnreagent=false)
 
void setDeathState (DeathState s) override
 
void Update (uint32 diff) override
 
uint8 GetPetAutoSpellSize () const override
 
uint32 GetPetAutoSpellOnPos (uint8 pos) const override
 
void GivePetXP (uint32 xp)
 
void GivePetLevel (uint8 level)
 
void SynchronizeLevelWithOwner ()
 
bool HaveInDiet (ItemTemplate const *item) const
 
uint32 GetCurrentFoodBenefitLevel (uint32 itemlevel) const
 
void SetDuration (int32 dur)
 
int32 GetDuration () const
 
void ToggleAutocast (SpellInfo const *spellInfo, bool apply)
 
bool HasSpell (uint32 spell) const override
 
void LearnPetPassives ()
 
void CastPetAuras (bool current)
 
void CastPetAura (PetAura const *aura)
 
bool IsPetAura (Aura const *aura)
 
void _LoadSpellCooldowns ()
 
void _LoadAuras (uint32 timediff)
 
void _SaveAuras (SQLTransaction &trans)
 
void _LoadSpells ()
 
void _SaveSpells (SQLTransaction &trans)
 
bool addSpell (uint32 spellId, ActiveStates active=ACT_DECIDE, PetSpellState state=PETSPELL_NEW, PetSpellType type=PETSPELL_NORMAL)
 
bool learnSpell (uint32 spell_id)
 
void learnSpellHighRank (uint32 spellid)
 
void InitLevelupSpellsForLevel ()
 
bool unlearnSpell (uint32 spell_id, bool learn_prev, bool clear_ab=true)
 
bool removeSpell (uint32 spell_id, bool learn_prev, bool clear_ab=true)
 
void CleanupActionBar ()
 
void InitPetCreateSpells ()
 
bool resetTalents ()
 
void InitTalentForLevel ()
 
uint8 GetMaxTalentPointsForLevel (uint8 level) const
 
uint8 GetFreeTalentPoints () const
 
void SetFreeTalentPoints (uint8 points)
 
uint32 GetGroupUpdateFlag () const
 
void SetGroupUpdateFlag (uint32 flag)
 
void ResetGroupUpdateFlag ()
 
DeclinedName constGetDeclinedNames () const
 
PlayerGetOwner () const
 
- Public Member Functions inherited from Guardian
 Guardian (SummonPropertiesEntry const *properties, Unit *owner, bool isWorldObject)
 
void InitStats (uint32 duration) override
 
bool InitStatsForLevel (uint8 level)
 
void InitSummon () override
 
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
 
int32 GetBonusDamage () const
 
void SetBonusDamage (int32 damage)
 
- Public Member Functions inherited from Minion
 Minion (SummonPropertiesEntry const *properties, Unit *owner, bool isWorldObject)
 
UnitGetOwner () const
 
float GetFollowAngle () const override
 
void SetFollowAngle (float angle)
 
bool IsPetGhoul () const
 
bool IsSpiritWolf () const
 
bool IsGuardianPet () const
 
- Public Member Functions inherited from TempSummon
 TempSummon (SummonPropertiesEntry const *properties, Unit *owner, bool isWorldObject)
 
virtual ~TempSummon ()
 
virtual void UnSummon (uint32 msTime=0)
 
void SetTempSummonType (TempSummonType type)
 
UnitGetSummoner () const
 
CreatureGetSummonerCreatureBase () const
 
ObjectGuid GetSummonerGUID () const
 
TempSummonType constGetSummonType ()
 
uint32 GetTimer () const
 
- Public Member Functions inherited from Creature
 Creature (bool isWorldObject=false)
 
virtual ~Creature ()
 
void SetObjectScale (float scale) override
 
void DisappearAndDie ()
 
bool Create (ObjectGuid::LowType guidlow, Map *map, uint32 phaseMask, uint32 entry, float x, float y, float z, float ang, CreatureData const *data=nullptr, uint32 vehId=0)
 
bool LoadCreaturesAddon ()
 
void SelectLevel ()
 
void LoadEquipment (int8 id=1, bool force=false)
 
ObjectGuid::LowType GetSpawnId () const
 
void GetRespawnPosition (float &x, float &y, float &z, float *ori=nullptr, float *dist=nullptr) const
 
void SetCorpseDelay (uint32 delay)
 
uint32 GetCorpseDelay () const
 
bool IsRacialLeader () const
 
bool IsCivilian () const
 
bool IsTrigger () const
 
bool IsGuard () const
 
bool CanWalk () const
 
bool CanSwim () const
 
bool CanFly () const override
 
void SetReactState (ReactStates st)
 
ReactStates GetReactState () const
 
bool HasReactState (ReactStates state) const
 
void InitializeReactState ()
 
bool isCanInteractWithBattleMaster (Player *player, bool msg) const
 
bool isCanTrainingAndResetTalentsOf (Player *player) const
 
bool CanCreatureAttack (Unit const *victim, bool force=true) const
 
bool IsImmunedToSpell (SpellInfo const *spellInfo) const override
 
bool IsImmunedToSpellEffect (SpellInfo const *spellInfo, uint32 index) const override
 
bool isElite () const
 
bool isWorldBoss () const
 
bool IsDungeonBoss () const
 
uint8 getLevelForTarget (WorldObject const *target) const override
 
bool IsInEvadeMode () const
 
bool AIM_Initialize (CreatureAI *ai=NULL)
 
void Motion_Initialize ()
 
CreatureAIAI () const
 
SpellSchoolMask GetMeleeDamageSchoolMask () const override
 
void SetMeleeDamageSchool (SpellSchools school)
 
bool UpdateEntry (uint32 entry, CreatureData const *data=nullptr)
 
void UpdateMovementFlags ()
 
void CalculateMinMaxDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage) override
 
void SetCanDualWield (bool value) override
 
int8 GetOriginalEquipmentId () const
 
uint8 GetCurrentEquipmentId () const
 
void SetCurrentEquipmentId (uint8 id)
 
float GetSpellDamageMod (int32 Rank) const
 
VendorItemData constGetVendorItems () const
 
uint32 GetVendorItemCurrentCount (VendorItem const *vItem)
 
uint32 UpdateVendorItemCurrentCount (VendorItem const *vItem, uint32 used_count)
 
TrainerSpellData constGetTrainerSpells () const
 
CreatureTemplate constGetCreatureTemplate () const
 
CreatureData constGetCreatureData () const
 
CreatureAddon constGetCreatureAddon () const
 
std::string GetAIName () const
 
std::string GetScriptName () const
 
uint32 GetScriptId () const
 
std::string constGetNameForLocaleIdx (LocaleConstant locale_idx) const override
 
bool LoadFromDB (ObjectGuid::LowType spawnId, Map *map)
 
bool LoadCreatureFromDB (ObjectGuid::LowType spawnId, Map *map, bool addToMap=true, bool allowDuplicate=false)
 
void SaveToDB ()
 
void StartPickPocketRefillTimer ()
 
void ResetPickPocketRefillTimer ()
 
bool CanGeneratePickPocketLoot () const
 
void SetSkinner (ObjectGuid guid)
 
ObjectGuid GetSkinner () const
 
PlayerGetLootRecipient () const
 
GroupGetLootRecipientGroup () const
 
bool hasLootRecipient () const
 
bool isTappedBy (Player const *player) const
 
void SetLootRecipient (Unit *unit)
 
void AllLootRemovedFromCorpse ()
 
uint16 GetLootMode () const
 
bool HasLootMode (uint16 lootMode)
 
void SetLootMode (uint16 lootMode)
 
void AddLootMode (uint16 lootMode)
 
void RemoveLootMode (uint16 lootMode)
 
void ResetLootMode ()
 
SpellInfo constreachWithSpellAttack (Unit *victim)
 
SpellInfo constreachWithSpellCure (Unit *victim)
 
bool CanStartAttack (Unit const *u, bool force) const
 
float GetAttackDistance (Unit const *player) const
 
float GetAggroRange (Unit const *target) const
 
void SendAIReaction (AiReaction reactionType)
 
UnitSelectNearestTarget (float dist=0, bool playerOnly=false) const
 
UnitSelectNearestTargetInAttackDistance (float dist=0) const
 
PlayerSelectNearestPlayer (float distance=0) const
 
UnitSelectNearestHostileUnitInAggroRange (bool useLOS=false) const
 
void DoFleeToGetAssistance ()
 
void CallForHelp (float fRadius)
 
void CallAssistance ()
 
void SetNoCallAssistance (bool val)
 
void SetNoSearchAssistance (bool val)
 
bool HasSearchedAssistance () const
 
bool CanAssistTo (const Unit *u, const Unit *enemy, bool checkfaction=true) const
 
bool _IsTargetAcceptable (const Unit *target) const
 
MovementGeneratorType GetDefaultMovementType () const
 
void SetDefaultMovementType (MovementGeneratorType mgt)
 
void RemoveCorpse (bool setSpawnTime=true)
 
void DespawnOrUnsummon (uint32 msTimeToDespawn=0)
 
time_t constGetRespawnTime () const
 
time_t GetRespawnTimeEx () const
 
void SetRespawnTime (uint32 respawn)
 
void Respawn (bool force=false)
 
void SaveRespawnTime () override
 
uint32 GetRespawnDelay () const
 
void SetRespawnDelay (uint32 delay)
 
float GetRespawnRadius () const
 
void SetRespawnRadius (float dist)
 
void DoImmediateBoundaryCheck ()
 
uint32 GetCombatPulseDelay () const
 
void SetCombatPulseDelay (uint32 delay)
 
void SendZoneUnderAttackMessage (Player *attacker)
 Send a message to LocalDefense channel for players opposition team in the zone. More...
 
void SetInCombatWithZone ()
 
bool hasQuest (uint32 quest_id) const override
 
bool hasInvolvedQuest (uint32 quest_id) const override
 
bool isRegeneratingHealth ()
 
void setRegeneratingHealth (bool regenHealth)
 
void SetPosition (float x, float y, float z, float o)
 
void SetPosition (const Position &pos)
 
void SetHomePosition (float x, float y, float z, float o)
 
void SetHomePosition (const Position &pos)
 
void GetHomePosition (float &x, float &y, float &z, float &ori) const
 
Position constGetHomePosition () const
 
void SetTransportHomePosition (float x, float y, float z, float o)
 
void SetTransportHomePosition (const Position &pos)
 
void GetTransportHomePosition (float &x, float &y, float &z, float &ori) const
 
Position constGetTransportHomePosition () const
 
uint32 GetWaypointPath () const
 
void LoadPath (uint32 pathid)
 
uint32 GetCurrentWaypointID () const
 
void UpdateWaypointID (uint32 wpID)
 
void SearchFormation ()
 
CreatureGroupGetFormation ()
 
void SetFormation (CreatureGroup *formation)
 
UnitSelectVictim ()
 
void SetDisableReputationGain (bool disable)
 
bool IsReputationGainDisabled () const
 
bool IsDamageEnoughForLootingAndReward () const
 
void LowerPlayerDamageReq (uint32 unDamage)
 
void ResetPlayerDamageReq ()
 
uint32 GetOriginalEntry () const
 
void SetOriginalEntry (uint32 entry)
 
void SetTarget (ObjectGuid const &guid) override
 
bool FocusTarget (Spell const *focusSpell, WorldObject const *target)
 
bool IsFocusing (Spell const *focusSpell=nullptr, bool withDelay=false)
 
void ReleaseFocus (Spell const *focusSpell=nullptr, bool withDelay=true)
 
CreatureTextRepeatIds GetTextRepeatGroup (uint8 textGroup)
 
void SetTextRepeatId (uint8 textGroup, uint8 id)
 
void ClearTextRepeatGroup (uint8 textGroup)
 
- Public Member Functions inherited from Unit
virtual ~Unit ()
 
UnitAIGetAI ()
 
void SetAI (UnitAI *newAI)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void CleanupBeforeRemoveFromMap (bool finalCleanup)
 
void CleanupsBeforeDelete (bool finalCleanup=true) override
 
void SendCombatLogMessage (WorldPackets::CombatLog::CombatLogServerPacket *combatLog) const
 
DiminishingLevels GetDiminishing (DiminishingGroup group)
 
void IncrDiminishing (DiminishingGroup group)
 
float ApplyDiminishingToDuration (DiminishingGroup group, int32 &duration, Unit *caster, DiminishingLevels Level, int32 limitduration)
 
void ApplyDiminishingAura (DiminishingGroup group, bool apply)
 
void ClearDiminishings ()
 
float GetSpellMaxRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
float GetSpellMinRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
void setAttackTimer (WeaponAttackType type, uint32 time)
 
void resetAttackTimer (WeaponAttackType type=BASE_ATTACK)
 
uint32 getAttackTimer (WeaponAttackType type) const
 
bool isAttackReady (WeaponAttackType type=BASE_ATTACK) const
 
bool haveOffhandWeapon () const
 
bool CanDualWield () const
 
float GetCombatReach () const
 
float GetMeleeReach () const
 
bool IsWithinCombatRange (const Unit *obj, float dist2compare) const
 
bool IsWithinMeleeRange (const Unit *obj, float dist=MELEE_RANGE) const
 
void GetRandomContactPoint (const Unit *target, float &x, float &y, float &z, float distance2dMin, float distance2dMax) const
 
void _addAttacker (Unit *pAttacker)
 
void _removeAttacker (Unit *pAttacker)
 
UnitgetAttackerForHelper () const
 
bool Attack (Unit *victim, bool meleeAttack)
 
void MustReacquireTarget ()
 
void CastStop (uint32 except_spellid=0)
 
bool AttackStop ()
 
void RemoveAllAttackers ()
 
AttackerSet constgetAttackers () const
 
bool isAttackingPlayer () const
 
UnitGetVictim () const
 
UnitEnsureVictim () const
 
void CombatStop (bool includingCast=false)
 
void CombatStopWithPets (bool includingCast=false)
 
void StopAttackFaction (uint32 faction_id)
 
UnitSelectNearbyTarget (Unit *exclude=NULL, float dist=NOMINAL_MELEE_RANGE) const
 
void SendMeleeAttackStop (Unit *victim=NULL)
 
void SendMeleeAttackStart (Unit *victim)
 
void AddUnitState (uint32 f)
 
bool HasUnitState (const uint32 f) const
 
void ClearUnitState (uint32 f)
 
bool CanFreeMove () const
 
uint32 HasUnitTypeMask (uint32 mask) const
 
void AddUnitTypeMask (uint32 mask)
 
bool IsSummon () const
 
bool IsGuardian () const
 
bool IsPet () const
 
bool IsHunterPet () const
 
bool IsTotem () const
 
bool IsVehicle () const
 
uint8 getLevel () const
 
uint8 getLevelForTarget (WorldObject const *) const override
 
void SetLevel (uint8 lvl)
 
uint8 getRace () const
 
uint32 getRaceMask () const
 
uint8 getClass () const
 
uint32 getClassMask () const
 
uint8 getGender () const
 
float GetStat (Stats stat) const
 
void SetStat (Stats stat, int32 val)
 
uint32 GetArmor () const
 
void SetArmor (int32 val)
 
uint32 GetResistance (SpellSchools school) const
 
uint32 GetResistance (SpellSchoolMask mask) const
 
void SetResistance (SpellSchools school, int32 val)
 
uint32 GetHealth () const
 
uint32 GetMaxHealth () const
 
bool IsFullHealth () const
 
bool HealthBelowPct (int32 pct) const
 
bool HealthBelowPctDamaged (int32 pct, uint32 damage) const
 
bool HealthAbovePct (int32 pct) const
 
bool HealthAbovePctHealed (int32 pct, uint32 heal) const
 
float GetHealthPct () const
 
uint32 CountPctFromMaxHealth (int32 pct) const
 
uint32 CountPctFromCurHealth (int32 pct) const
 
void SetHealth (uint32 val)
 
void SetMaxHealth (uint32 val)
 
void SetFullHealth ()
 
int32 ModifyHealth (int32 val)
 
int32 GetHealthGain (int32 dVal)
 
Powers getPowerType () const
 
void setPowerType (Powers power)
 
int32 GetPower (Powers power) const
 
int32 GetMinPower (Powers power) const
 
int32 GetMaxPower (Powers power) const
 
float GetPowerPct (Powers power) const
 
int32 CountPctFromMaxPower (Powers power, int32 pct) const
 
void SetPower (Powers power, int32 val)
 
void SetMaxPower (Powers power, int32 val)
 
int32 ModifyPower (Powers power, int32 val)
 
int32 ModifyPowerPct (Powers power, float pct, bool apply=true)
 
uint32 GetAttackTime (WeaponAttackType att) const
 
void SetAttackTime (WeaponAttackType att, uint32 val)
 
void ApplyAttackTimePercentMod (WeaponAttackType att, float val, bool apply)
 
void ApplyCastTimePercentMod (float val, bool apply)
 
SheathState GetSheath () const
 
virtual void SetSheath (SheathState sheathed)
 
uint32 getFaction () const
 
void setFaction (uint32 faction)
 
FactionTemplateEntry constGetFactionTemplateEntry () const
 
ReputationRank GetReactionTo (Unit const *target) const
 
bool IsHostileTo (Unit const *unit) const
 
bool IsHostileToPlayers () const
 
bool IsFriendlyTo (Unit const *unit) const
 
bool IsNeutralToAll () const
 
bool IsInPartyWith (Unit const *unit) const
 
bool IsInRaidWith (Unit const *unit) const
 
void GetPartyMembers (std::list< Unit * > &units)
 
bool IsContestedGuard () const
 
bool IsPvP () const
 
bool IsFFAPvP () const
 
virtual void SetPvP (bool state)
 
uint32 GetCreatureType () const
 
uint32 GetCreatureTypeMask () const
 
UnitStandStateType GetStandState () const
 
bool IsSitState () const
 
bool IsStandState () const
 
void SetStandState (UnitStandStateType state, uint32 animKitID=0)
 
void SetStandFlags (uint8 flags)
 
void RemoveStandFlags (uint8 flags)
 
bool IsMounted () const
 
uint32 GetMountID () const
 
void Mount (uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
 
void Dismount ()
 
MountCapabilityEntry constGetMountCapability (uint32 mountType) const
 
void SendDurabilityLoss (Player *receiver, uint32 percent)
 
void PlayOneShotAnimKitId (uint16 animKitId)
 
void SetAIAnimKitId (uint16 animKitId)
 
uint16 GetAIAnimKitId () const override
 
void SetMovementAnimKitId (uint16 animKitId)
 
uint16 GetMovementAnimKitId () const override
 
void SetMeleeAnimKitId (uint16 animKitId)
 
uint16 GetMeleeAnimKitId () const override
 
uint16 GetMaxSkillValueForLevel (Unit const *target=NULL) const
 
void DealDamageMods (Unit *victim, uint32 &damage, uint32 *absorb)
 
uint32 DealDamage (Unit *victim, uint32 damage, CleanDamage const *cleanDamage=NULL, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=NULL, bool durabilityLoss=true)
 
void Kill (Unit *victim, bool durabilityLoss=true)
 
void KillSelf (bool durabilityLoss=true)
 
int32 DealHeal (Unit *victim, uint32 addhealth)
 
void ProcDamageAndSpell (Unit *victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType=BASE_ATTACK, SpellInfo const *procSpell=NULL, SpellInfo const *procAura=NULL)
 
void ProcDamageAndSpellFor (bool isVictim, Unit *target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const *procSpell, uint32 damage, SpellInfo const *procAura=NULL)
 
void GetProcAurasTriggeredOnEvent (AuraApplicationList &aurasTriggeringProc, AuraApplicationList *procAuras, ProcEventInfo eventInfo)
 
void TriggerAurasProcOnEvent (CalcDamageInfo &damageInfo)
 
void TriggerAurasProcOnEvent (AuraApplicationList *myProcAuras, AuraApplicationList *targetProcAuras, Unit *actionTarget, uint32 typeMaskActor, uint32 typeMaskActionTarget, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell *spell, DamageInfo *damageInfo, HealInfo *healInfo)
 
void TriggerAurasProcOnEvent (ProcEventInfo &eventInfo, AuraApplicationList &procAuras)
 
void HandleEmoteCommand (uint32 anim_id)
 
void AttackerStateUpdate (Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false)
 
void CalculateMeleeDamage (Unit *victim, uint32 damage, CalcDamageInfo *damageInfo, WeaponAttackType attackType=BASE_ATTACK)
 
void DealMeleeDamage (CalcDamageInfo *damageInfo, bool durabilityLoss)
 
void HandleProcExtraAttackFor (Unit *victim)
 
void CalculateSpellDamageTaken (SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=BASE_ATTACK, bool crit=false)
 
void DealSpellDamage (SpellNonMeleeDamage const *damageInfo, bool durabilityLoss)
 
uint32 GetDamageReduction (uint32 damage) const
 
void ApplyResilience (Unit const *victim, int32 *damage) const
 
float MeleeSpellMissChance (Unit const *victim, WeaponAttackType attType, uint32 spellId) const
 
SpellMissInfo MeleeSpellHitResult (Unit *victim, SpellInfo const *spellInfo)
 
SpellMissInfo MagicSpellHitResult (Unit *victim, SpellInfo const *spellInfo)
 
SpellMissInfo SpellHitResult (Unit *victim, SpellInfo const *spellInfo, bool canReflect=false)
 
float GetUnitDodgeChanceAgainst (Unit const *attacker) const
 
float GetUnitParryChanceAgainst (Unit const *attacker) const
 
float GetUnitBlockChanceAgainst (Unit const *attacker) const
 
float GetUnitMissChance (WeaponAttackType attType) const
 
float GetUnitCriticalChance (WeaponAttackType attackType, const Unit *victim) const
 
int32 GetMechanicResistChance (SpellInfo const *spellInfo) const
 
bool CanUseAttackType (uint8 attacktype) const
 
virtual uint32 GetBlockPercent () const
 
float GetWeaponProcChance () const
 
float GetPPMProcChance (uint32 WeaponSpeed, float PPM, const SpellInfo *spellProto) const
 
MeleeHitOutcome RollMeleeOutcomeAgainst (Unit const *victim, WeaponAttackType attType) const
 
bool IsVendor () const
 
bool IsTrainer () const
 
bool IsQuestGiver () const
 
bool IsGossip () const
 
bool IsTaxi () const
 
bool IsGuildMaster () const
 
bool IsBattleMaster () const
 
bool IsBanker () const
 
bool IsInnkeeper () const
 
bool IsSpiritHealer () const
 
bool IsSpiritGuide () const
 
bool IsTabardDesigner () const
 
bool IsAuctioner () const
 
bool IsArmorer () const
 
bool IsServiceProvider () const
 
bool IsSpiritService () const
 
bool IsCritter () const
 
bool IsInFlight () const
 
bool IsInCombat () const
 
bool IsInCombatWith (Unit const *who) const
 
void CombatStart (Unit *target, bool initialAggro=true)
 
void SetInCombatState (bool PvP, Unit *enemy=NULL)
 
void SetInCombatWith (Unit *enemy)
 
void ClearInCombat ()
 
uint32 GetCombatTimer () const
 
bool HasAuraTypeWithFamilyFlags (AuraType auraType, uint32 familyName, uint32 familyFlags) const
 
bool HasBreakableByDamageAuraType (AuraType type, uint32 excludeAura=0) const
 
bool HasBreakableByDamageCrowdControlAura (Unit *excludeCasterChannel=NULL) const
 
bool HasStealthAura () const
 
bool HasInvisibilityAura () const
 
bool isFeared () const
 
bool isInRoots () const
 
bool IsPolymorphed () const
 
bool isFrozen () const
 
bool isTargetableForAttack (bool checkFakeDeath=true) const
 
bool IsValidAttackTarget (Unit const *target) const
 
bool _IsValidAttackTarget (Unit const *target, SpellInfo const *bySpell, WorldObject const *obj=NULL) const
 
bool IsValidAssistTarget (Unit const *target) const
 
bool _IsValidAssistTarget (Unit const *target, SpellInfo const *bySpell) const
 
virtual bool IsInWater () const
 
virtual bool IsUnderWater () const
 
virtual void UpdateUnderwaterState (Map *m, float x, float y, float z)
 
bool isInAccessiblePlaceFor (Creature const *c) const
 
void SendHealSpellLog (Unit *victim, uint32 spellID, uint32 health, uint32 overHeal, uint32 absorbed, bool crit=false)
 
int32 HealBySpell (Unit *victim, SpellInfo const *spellInfo, uint32 addHealth, bool critical=false)
 
void SendEnergizeSpellLog (Unit *victim, uint32 spellID, int32 damage, Powers powertype)
 
void EnergizeBySpell (Unit *victim, uint32 SpellID, int32 Damage, Powers powertype)
 
void CastSpell (SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void CastSpell (Unit *victim, uint32 spellId, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void CastSpell (Unit *victim, uint32 spellId, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void CastSpell (Unit *victim, SpellInfo const *spellInfo, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void CastSpell (Unit *victim, SpellInfo const *spellInfo, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void CastSpell (float x, float y, float z, uint32 spellId, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void CastSpell (GameObject *go, uint32 spellId, bool triggered, Item *castItem=NULL, AuraEffect *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void CastCustomSpell (Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void CastCustomSpell (uint32 spellId, SpellValueMod mod, int32 value, Unit *victim, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void CastCustomSpell (uint32 spellId, SpellValueMod mod, int32 value, Unit *victim=NULL, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void CastCustomSpell (uint32 spellId, CustomSpellValues const &value, Unit *victim=NULL, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
 
AuraAddAura (uint32 spellId, Unit *target)
 
AuraAddAura (SpellInfo const *spellInfo, uint32 effMask, Unit *target)
 
void SetAuraStack (uint32 spellId, Unit *target, uint32 stack)
 
void SendPlaySpellVisualKit (uint32 id, uint32 type)
 
void DeMorph ()
 
void SendAttackStateUpdate (CalcDamageInfo *damageInfo)
 
void SendAttackStateUpdate (uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount)
 
void SendSpellNonMeleeDamageLog (SpellNonMeleeDamage const *log)
 
void SendPeriodicAuraLog (SpellPeriodicAuraLogInfo *pInfo)
 
void SendSpellMiss (Unit *target, uint32 spellID, SpellMissInfo missInfo)
 
void SendSpellDamageResist (Unit *target, uint32 spellId)
 
void SendSpellDamageImmune (Unit *target, uint32 spellId, bool isPeriodic)
 
void NearTeleportTo (float x, float y, float z, float orientation, bool casting=false)
 
void SendTeleportPacket (Position &pos)
 
virtual bool UpdatePosition (float x, float y, float z, float ang, bool teleport=false)
 
virtual bool UpdatePosition (const Position &pos, bool teleport=false)
 
void UpdateOrientation (float orientation)
 Only server-side orientation update, does not broadcast to client. More...
 
void UpdateHeight (float newZ)
 Only server-side height update, does not broadcast to client. More...
 
void SendMoveKnockBack (Player *player, float speedXY, float speedZ, float vcos, float vsin)
 
void KnockbackFrom (float x, float y, float speedXY, float speedZ)
 
void JumpTo (float speedXY, float speedZ, bool forward=true)
 
void JumpTo (WorldObject *obj, float speedZ, bool withOrientation=false)
 
void MonsterMoveWithSpeed (float x, float y, float z, float speed, bool generatePath=false, bool forceDestination=false)
 
void SendSetPlayHoverAnim (bool enable)
 
bool IsLevitating () const
 
bool IsWalking () const
 
bool IsHovering () const
 
bool SetWalk (bool enable)
 
bool SetDisableGravity (bool disable, bool packetOnly=false)
 
bool SetFall (bool enable)
 
bool SetSwim (bool enable)
 
bool SetCanFly (bool enable)
 
bool SetWaterWalking (bool enable, bool packetOnly=false)
 
bool SetFeatherFall (bool enable, bool packetOnly=false)
 
bool SetHover (bool enable, bool packetOnly=false)
 
bool SetCollision (bool disable)
 
void SendSetVehicleRecId (uint32 vehicleId)
 
void SetInFront (WorldObject const *target)
 
void SetFacingTo (float ori)
 
void SetFacingToObject (WorldObject const *object)
 
void SendChangeCurrentVictimOpcode (HostileReference *pHostileReference)
 
void SendClearThreatListOpcode ()
 
void SendRemoveFromThreatListOpcode (HostileReference *pHostileReference)
 
void SendThreatListUpdate ()
 
void SendClearTarget ()
 
bool IsAlive () const
 
bool isDying () const
 
bool isDead () const
 
DeathState getDeathState () const
 
ObjectGuid GetOwnerGUID () const
 
void SetOwnerGUID (ObjectGuid owner)
 
ObjectGuid GetCreatorGUID () const
 
void SetCreatorGUID (ObjectGuid creator)
 
ObjectGuid GetMinionGUID () const
 
void SetMinionGUID (ObjectGuid guid)
 
ObjectGuid GetCharmerGUID () const
 
void SetCharmerGUID (ObjectGuid owner)
 
ObjectGuid GetCharmGUID () const
 
void SetPetGUID (ObjectGuid guid)
 
ObjectGuid GetPetGUID () const
 
void SetCritterGUID (ObjectGuid guid)
 
ObjectGuid GetCritterGUID () const
 
bool IsControlledByPlayer () const
 
ObjectGuid GetCharmerOrOwnerGUID () const
 
ObjectGuid GetCharmerOrOwnerOrOwnGUID () const
 
bool IsCharmedOwnedByPlayerOrPlayer () const
 
PlayerGetSpellModOwner () const
 
UnitGetOwner () const
 
GuardianGetGuardianPet () const
 
MinionGetFirstMinion () const
 
UnitGetCharmer () const
 
UnitGetCharm () const
 
UnitGetCharmerOrOwner () const
 
UnitGetCharmerOrOwnerOrSelf () const
 
PlayerGetCharmerOrOwnerPlayerOrPlayerItself () const
 
PlayerGetAffectingPlayer () const
 
void SetMinion (Minion *minion, bool apply)
 
void GetAllMinionsByEntry (std::list< TempSummon * > &Minions, uint32 entry)
 
void RemoveAllMinionsByEntry (uint32 entry)
 
void SetCharm (Unit *target, bool apply)
 
UnitGetNextRandomRaidMemberOrPet (float radius)
 
bool SetCharmedBy (Unit *charmer, CharmType type, AuraApplication const *aurApp=NULL)
 
void RemoveCharmedBy (Unit *charmer)
 
void RestoreFaction ()
 
UnitGetFirstControlled () const
 
void RemoveAllControlled ()
 
bool IsCharmed () const
 
bool isPossessed () const
 
bool isPossessedByPlayer () const
 
bool isPossessing () const
 
bool isPossessing (Unit *u) const
 
CharmInfoGetCharmInfo ()
 
CharmInfoInitCharmInfo ()
 
void DeleteCharmInfo ()
 
void UpdateCharmAI ()
 
SharedVisionList constGetSharedVisionList ()
 
void AddPlayerToVision (Player *player)
 
void RemovePlayerFromVision (Player *player)
 
bool HasSharedVision () const
 
void RemoveBindSightAuras ()
 
void RemoveCharmAuras ()
 
PetCreateTamedPetFrom (Creature *creatureTarget, uint32 spell_id=0)
 
PetCreateTamedPetFrom (uint32 creatureEntry, uint32 spell_id=0)
 
bool InitTamedPet (Pet *pet, uint8 level, uint32 spell_id)
 
Aura_TryStackingOrRefreshingExistingAura (SpellInfo const *newAura, uint32 effMask, Unit *caster, int32 *baseAmount=NULL, Item *castItem=NULL, ObjectGuid casterGUID=ObjectGuid::Empty, int32 castItemLevel=-1)
 
void _AddAura (UnitAura *aura, Unit *caster)
 
AuraApplication_CreateAuraApplication (Aura *aura, uint32 effMask)
 
void _ApplyAuraEffect (Aura *aura, uint8 effIndex)
 
void _ApplyAura (AuraApplication *aurApp, uint32 effMask)
 
void _UnapplyAura (AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
 
void _UnapplyAura (AuraApplication *aurApp, AuraRemoveMode removeMode)
 
void _RemoveNoStackAuraApplicationsDueToAura (Aura *aura)
 
void _RemoveNoStackAurasDueToAura (Aura *aura)
 
bool _IsNoStackAuraDueToAura (Aura *appliedAura, Aura *existingAura) const
 
void _RegisterAuraEffect (AuraEffect *aurEff, bool apply)
 
AuraMapGetOwnedAuras ()
 
AuraMap constGetOwnedAuras () const
 
void RemoveOwnedAura (AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAura (Aura *aura, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
AuraGetOwnedAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, Aura *except=NULL) const
 
AuraApplicationMapGetAppliedAuras ()
 
AuraApplicationMap constGetAppliedAuras () const
 
void RemoveAura (AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (AuraApplication *aurApp, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (Aura *aur, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAppliedAuras (std::function< bool(AuraApplication const *)> const &check)
 
void RemoveOwnedAuras (std::function< bool(Aura const *)> const &check)
 
void RemoveAppliedAuras (uint32 spellId, std::function< bool(AuraApplication const *)> const &check)
 
void RemoveOwnedAuras (uint32 spellId, std::function< bool(Aura const *)> const &check)
 
void RemoveAurasByType (AuraType auraType, std::function< bool(AuraApplication const *)> const &check)
 
void RemoveAurasDueToSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAuraFromStack (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAurasDueToSpellByDispel (uint32 spellId, uint32 dispellerSpellId, ObjectGuid casterGUID, Unit *dispeller, uint8 chargesRemoved=1)
 
void RemoveAurasDueToSpellBySteal (uint32 spellId, ObjectGuid casterGUID, Unit *stealer)
 
void RemoveAurasDueToItemSpell (uint32 spellId, ObjectGuid castItemGuid)
 
void RemoveAurasByType (AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=NULL, bool negative=true, bool positive=true)
 
void RemoveNotOwnSingleTargetAuras (uint32 newPhase=0x0, bool phaseid=false)
 
void RemoveAurasWithInterruptFlags (uint32 flag, uint32 except=0)
 
void RemoveAurasWithAttribute (uint32 flags)
 
void RemoveAurasWithFamily (SpellFamilyNames family, flag128 const &familyFlag, ObjectGuid casterGUID)
 
void RemoveAurasWithMechanic (uint32 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
 
void RemoveMovementImpairingAuras ()
 
void RemoveAreaAurasDueToLeaveWorld ()
 
void RemoveAllAuras ()
 
void RemoveArenaAuras ()
 
void RemoveAllAurasOnDeath ()
 
void RemoveAllAurasRequiringDeadTarget ()
 
void RemoveAllAurasExceptType (AuraType type)
 
void RemoveAllAurasExceptType (AuraType type1, AuraType type2)
 
void DelayOwnedAuras (uint32 spellId, ObjectGuid caster, int32 delaytime)
 
void _RemoveAllAuraStatMods ()
 
void _ApplyAllAuraStatMods ()
 
AuraEffectList constGetAuraEffectsByType (AuraType type) const
 
AuraListGetSingleCastAuras ()
 
AuraList constGetSingleCastAuras () const
 
AuraEffectGetAuraEffect (uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffectOfRankedSpell (uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffect (AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
 
AuraEffectGetAuraEffect (AuraType type, SpellFamilyNames family, flag128 const &familyFlag, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetDummyAuraEffect (SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
 
AuraApplicationGetAuraApplication (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraApplication *except=NULL) const
 
AuraGetAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
 
AuraApplicationGetAuraApplicationOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraApplication *except=NULL) const
 
AuraGetAuraOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
 
void GetDispellableAuraList (Unit *caster, uint32 dispelMask, DispelChargesList &dispelList)
 
bool HasAuraEffect (uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
 
uint32 GetAuraCount (uint32 spellId) const
 
bool HasAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
 
bool HasAuraType (AuraType auraType) const
 
bool HasAuraTypeWithCaster (AuraType auratype, ObjectGuid caster) const
 
bool HasAuraTypeWithMiscvalue (AuraType auratype, int32 miscvalue) const
 
bool HasAuraTypeWithAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
bool HasAuraTypeWithValue (AuraType auratype, int32 value) const
 
bool HasNegativeAuraWithInterruptFlag (uint32 flag, ObjectGuid guid=ObjectGuid::Empty) const
 
bool HasNegativeAuraWithAttribute (uint32 flag, ObjectGuid guid=ObjectGuid::Empty) const
 
bool HasAuraWithMechanic (uint32 mechanicMask) const
 
AuraEffectIsScriptOverriden (SpellInfo const *spell, int32 script) const
 
uint32 GetDiseasesByCaster (ObjectGuid casterGUID, bool remove=false)
 
uint32 GetDoTsByCaster (ObjectGuid casterGUID) const
 
int32 GetTotalAuraModifier (AuraType auratype) const
 
float GetTotalAuraMultiplier (AuraType auratype) const
 
int32 GetMaxPositiveAuraModifier (AuraType auratype) const
 
int32 GetMaxNegativeAuraModifier (AuraType auratype) const
 
int32 GetTotalAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
float GetTotalAuraMultiplierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
int32 GetMaxPositiveAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask, const AuraEffect *except=NULL) const
 
int32 GetMaxNegativeAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
int32 GetTotalAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
float GetTotalAuraMultiplierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetMaxPositiveAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetMaxNegativeAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetTotalAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
float GetTotalAuraMultiplierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
int32 GetMaxPositiveAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
int32 GetMaxNegativeAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
float GetResistanceBuffMods (SpellSchools school, bool positive) const
 
void SetResistanceBuffMods (SpellSchools school, bool positive, float val)
 
void ApplyResistanceBuffModsMod (SpellSchools school, bool positive, float val, bool apply)
 
void ApplyResistanceBuffModsPercentMod (SpellSchools school, bool positive, float val, bool apply)
 
void InitStatBuffMods ()
 
void ApplyStatBuffMod (Stats stat, float val, bool apply)
 
void ApplyStatPercentBuffMod (Stats stat, float val, bool apply)
 
void SetCreateStat (Stats stat, float val)
 
void SetCreateHealth (uint32 val)
 
uint32 GetCreateHealth () const
 
void SetCreateMana (uint32 val)
 
uint32 GetCreateMana () const
 
uint32 GetPowerIndex (uint32 powerType) const
 
int32 GetCreatePowers (Powers power) const
 
float GetPosStat (Stats stat) const
 
float GetNegStat (Stats stat) const
 
float GetCreateStat (Stats stat) const
 
ObjectGuid GetChannelObjectGuid () const
 
void SetChannelObjectGuid (ObjectGuid guid)
 
void SetCurrentCastSpell (Spell *pSpell)
 
void InterruptSpell (CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true)
 
void FinishSpell (CurrentSpellTypes spellType, bool ok=true)
 
bool IsNonMeleeSpellCast (bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
 
void InterruptNonMeleeSpells (bool withDelayed, uint32 spellid=0, bool withInstant=true)
 
SpellGetCurrentSpell (CurrentSpellTypes spellType) const
 
SpellGetCurrentSpell (uint32 spellType) const
 
SpellFindCurrentSpellBySpellId (uint32 spell_id) const
 
int32 GetCurrentSpellCastTime (uint32 spell_id) const
 
virtual SpellInfo constGetCastSpellInfo (SpellInfo const *spellInfo) const
 
SpellHistoryGetSpellHistory ()
 
SpellHistory constGetSpellHistory () const
 
ShapeshiftForm GetShapeshiftForm () const
 
void SetShapeshiftForm (ShapeshiftForm form)
 
bool IsInFeralForm () const
 
bool IsInDisallowedMountForm () const
 
bool HandleStatModifier (UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
 
void SetModifierValue (UnitMods unitMod, UnitModifierType modifierType, float value)
 
float GetModifierValue (UnitMods unitMod, UnitModifierType modifierType) const
 
float GetTotalStatValue (Stats stat) const
 
float GetTotalAuraModValue (UnitMods unitMod) const
 
SpellSchools GetSpellSchoolByAuraGroup (UnitMods unitMod) const
 
Stats GetStatByAuraGroup (UnitMods unitMod) const
 
Powers GetPowerTypeByAuraGroup (UnitMods unitMod) const
 
bool CanModifyStats () const
 
void SetCanModifyStats (bool modifyStats)
 
virtual void UpdateAllResistances ()
 
float GetTotalAttackPowerValue (WeaponAttackType attType) const
 
float GetWeaponDamageRange (WeaponAttackType attType, WeaponDamageRange type) const
 
void SetBaseWeaponDamage (WeaponAttackType attType, WeaponDamageRange damageRange, float value)
 
uint32 CalculateDamage (WeaponAttackType attType, bool normalized, bool addTotalPct)
 
float GetAPMultiplier (WeaponAttackType attType, bool normalized)
 
bool isInFrontInMap (Unit const *target, float distance, float arc=float(M_PI)) const
 
bool isInBackInMap (Unit const *target, float distance, float arc=float(M_PI)) const
 
bool IsVisible () const
 
void SetVisible (bool x)
 
bool SetInPhase (uint32 id, bool update, bool apply) override
 
void UpdateObjectVisibility (bool forced=true) override
 
bool CanHaveThreatList (bool skipAliveCheck=false) const
 
void AddThreat (Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=NULL)
 
float ApplyTotalThreatModifier (float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
void DeleteThreatList ()
 
void TauntApply (Unit *victim)
 
void TauntFadeOut (Unit *taunter)
 
ThreatManagergetThreatManager ()
 
void addHatedBy (HostileReference *pHostileReference)
 
void removeHatedBy (HostileReference *)
 
HostileRefManagergetHostileRefManager ()
 
VisibleAuraMap constGetVisibleAuras ()
 
AuraApplicationGetVisibleAura (uint8 slot) const
 
void SetVisibleAura (uint8 slot, AuraApplication *aur)
 
void RemoveVisibleAura (uint8 slot)
 
uint32 GetInterruptMask () const
 
void AddInterruptMask (uint32 mask)
 
void UpdateInterruptMask ()
 
uint32 GetDisplayId () const
 
uint32 GetNativeDisplayId () const
 
void RestoreDisplayId ()
 
void SetNativeDisplayId (uint32 modelId)
 
void setTransForm (uint32 spellid)
 
uint32 getTransForm () const
 
void _RegisterDynObject (DynamicObject *dynObj)
 
void _UnregisterDynObject (DynamicObject *dynObj)
 
DynamicObjectGetDynObject (uint32 spellId)
 
void RemoveDynObject (uint32 spellId)
 
void RemoveAllDynObjects ()
 
GameObjectGetGameObject (uint32 spellId) const
 
void AddGameObject (GameObject *gameObj)
 
void RemoveGameObject (GameObject *gameObj, bool del)
 
void RemoveGameObject (uint32 spellid, bool del)
 
void RemoveAllGameObjects ()
 
void ModifyAuraState (AuraStateType flag, bool apply)
 
uint32 BuildAuraStateUpdateForTarget (Unit *target) const
 
bool HasAuraState (AuraStateType flag, SpellInfo const *spellProto=NULL, Unit const *Caster=NULL) const
 
void UnsummonAllTotems ()
 
bool IsMagnet () const
 
UnitGetMagicHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo)
 
UnitGetMeleeHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo=NULL)
 
int32 SpellBaseDamageBonusDone (SpellSchoolMask schoolMask) const
 
int32 SpellBaseDamageBonusTaken (SpellSchoolMask schoolMask) const
 
uint32 SpellDamageBonusDone (Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, SpellEffectInfo const *effect, uint32 stack=1) const
 
float SpellDamagePctDone (Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype) const
 
uint32 SpellDamageBonusTaken (Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, SpellEffectInfo const *effect, uint32 stack=1) const
 
int32 SpellBaseHealingBonusDone (SpellSchoolMask schoolMask) const
 
int32 SpellBaseHealingBonusTaken (SpellSchoolMask schoolMask) const
 
uint32 SpellHealingBonusDone (Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, SpellEffectInfo const *effect, uint32 stack=1) const
 
float SpellHealingPctDone (Unit *victim, SpellInfo const *spellProto) const
 
uint32 SpellHealingBonusTaken (Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, SpellEffectInfo const *effect, uint32 stack=1) const
 
uint32 MeleeDamageBonusDone (Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const *spellProto=NULL)
 
uint32 MeleeDamageBonusTaken (Unit *attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const *spellProto=NULL)
 
bool isSpellBlocked (Unit *victim, SpellInfo const *spellProto, WeaponAttackType attackType=BASE_ATTACK)
 
bool isBlockCritical ()
 
bool IsSpellCrit (Unit *victim, SpellInfo const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType=BASE_ATTACK) const
 
float GetUnitSpellCriticalChance (Unit *victim, SpellInfo const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType=BASE_ATTACK) const
 
uint32 SpellCriticalDamageBonus (SpellInfo const *spellProto, uint32 damage, Unit *victim)
 
uint32 SpellCriticalHealingBonus (SpellInfo const *spellProto, uint32 damage, Unit *victim)
 
void SetContestedPvP (Player *attackedPlayer=NULL)
 
uint32 GetCastingTimeForBonus (SpellInfo const *spellProto, DamageEffectType damagetype, uint32 CastingTime) const
 
float CalculateDefaultCoefficient (SpellInfo const *spellInfo, DamageEffectType damagetype) const
 
uint32 GetRemainingPeriodicAmount (ObjectGuid caster, uint32 spellId, AuraType auraType, uint8 effectIndex=0) const
 
void ApplySpellImmune (uint32 spellId, uint32 op, uint32 type, bool apply)
 
void ApplySpellDispelImmunity (const SpellInfo *spellProto, DispelType type, bool apply)
 
uint32 GetSchoolImmunityMask () const
 
uint32 GetMechanicImmunityMask () const
 
bool IsImmunedToDamage (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToDamage (SpellInfo const *spellInfo) const
 
bool IsDamageReducedByArmor (SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=NULL, uint8 effIndex=MAX_SPELL_EFFECTS)
 
uint32 CalcArmorReducedDamage (Unit *victim, const uint32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=MAX_ATTACK)
 
uint32 CalcSpellResistance (Unit *victim, SpellSchoolMask schoolMask, SpellInfo const *spellInfo) const
 
void CalcAbsorbResist (Unit *victim, SpellSchoolMask schoolMask, DamageEffectType damagetype, uint32 const damage, uint32 *absorb, uint32 *resist, SpellInfo const *spellInfo=NULL)
 
void CalcHealAbsorb (Unit *victim, SpellInfo const *spellInfo, uint32 &healAmount, uint32 &absorb)
 
void UpdateSpeed (UnitMoveType mtype, bool forced)
 
float GetSpeed (UnitMoveType mtype) const
 
float GetSpeedRate (UnitMoveType mtype) const
 
void SetSpeed (UnitMoveType mtype, float rate, bool forced=false)
 
float ApplyEffectModifiers (SpellInfo const *spellProto, uint8 effect_index, float value) const
 
int32 CalculateSpellDamage (Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr, float *variance=nullptr, int32 itemLevel=-1) const
 
int32 CalcSpellDuration (SpellInfo const *spellProto)
 
int32 ModSpellDuration (SpellInfo const *spellProto, Unit const *target, int32 duration, bool positive, uint32 effectMask)
 
void ModSpellCastTime (SpellInfo const *spellProto, int32 &castTime, Spell *spell=NULL)
 
void ModSpellDurationTime (SpellInfo const *spellProto, int32 &castTime, Spell *spell=NULL)
 
float CalculateLevelPenalty (SpellInfo const *spellProto) const
 
void addFollower (FollowerReference *pRef)
 
void removeFollower (FollowerReference *)
 
MotionMasterGetMotionMaster ()
 
const MotionMasterGetMotionMaster () const
 
bool IsStopped () const
 
void StopMoving ()
 -------—End of Pet responses methods-------— More...
 
void AddUnitMovementFlag (uint32 f)
 
void RemoveUnitMovementFlag (uint32 f)
 
bool HasUnitMovementFlag (uint32 f) const
 
uint32 GetUnitMovementFlags () const
 
void SetUnitMovementFlags (uint32 f)
 
void AddExtraUnitMovementFlag (uint16 f)
 
void RemoveExtraUnitMovementFlag (uint16 f)
 
uint16 HasExtraUnitMovementFlag (uint16 f) const
 
uint16 GetExtraUnitMovementFlags () const
 
void SetExtraUnitMovementFlags (uint16 f)
 
bool IsSplineEnabled () const
 
float GetPositionZMinusOffset () const
 
void SetControlled (bool apply, UnitState state)
 
void SendPetActionFeedback (uint8 msg)
 -------—Pet responses methods--------------— More...
 
void SendPetTalk (uint32 pettalk)
 
void SendPetAIReaction (ObjectGuid guid)
 
void propagateSpeedChange ()
 -------—End of Pet responses methods-------— More...
 
void ClearAllReactives ()
 
void StartReactiveTimer (ReactiveType reactive)
 
void UpdateReactives (uint32 p_time)
 
void UpdateAuraForGroup (uint8 slot)
 
bool CanProc () const
 
void SetCantProc (bool apply)
 
void AddPetAura (PetAura const *petSpell)
 
void RemovePetAura (PetAura const *petSpell)
 
uint32 GetModelForForm (ShapeshiftForm form) const
 
uint32 GetModelForTotem (PlayerTotemType totemType)
 
void SetRedirectThreat (ObjectGuid guid, uint32 pct)
 
void ResetRedirectThreat ()
 
void ModifyRedirectThreat (int32 amount)
 
uint32 GetRedirectThreatPercent () const
 
UnitGetRedirectThreatTarget ()
 
bool CreateVehicleKit (uint32 id, uint32 creatureEntry, bool loading=false)
 
void RemoveVehicleKit (bool onRemoveFromWorld=false)
 
VehicleGetVehicleKit () const
 
VehicleGetVehicle () const
 
void SetVehicle (Vehicle *vehicle)
 
bool IsOnVehicle (const Unit *vehicle) const
 
UnitGetVehicleBase () const
 
CreatureGetVehicleCreatureBase () const
 
ObjectGuid GetTransGUID () const override
 
TransportBaseGetDirectTransport () const
 Returns the transport this unit is on directly (if on vehicle and transport, return vehicle) More...
 
bool HandleSpellClick (Unit *clicker, int8 seatId=-1)
 
void EnterVehicle (Unit *base, int8 seatId=-1)
 
void ExitVehicle (Position const *exitPosition=NULL)
 
void ChangeSeat (int8 seatId, bool next=true)
 
void _ExitVehicle (Position const *exitPosition=NULL)
 
void _EnterVehicle (Vehicle *vehicle, int8 seatId, AuraApplication const *aurApp=NULL)
 
bool isMoving () const
 
bool isTurning () const
 
bool IsFlying () const
 
bool IsFalling () const
 
void RewardRage (uint32 baseRage, bool attacker)
 
void OutDebugInfo () const
 
bool IsDuringRemoveFromWorld () const
 
PetToPet ()
 
Pet constToPet () const
 
TotemToTotem ()
 
Totem constToTotem () const
 
TempSummonToTempSummon ()
 
TempSummon constToTempSummon () const
 
ObjectGuid GetTarget () const
 
time_t GetLastDamagedTime () const
 
void SetLastDamagedTime (time_t val)
 
int32 GetHighestExclusiveSameEffectSpellGroupValue (AuraEffect const *aurEff, AuraType auraType, bool checkMiscValue=false, int32 miscValue=0) const
 
bool IsHighestExclusiveAura (Aura const *aura, bool removeOtherAuraApplications=false)
 
virtual void Talk (std::string const &text, ChatMsg msgType, Language language, float textRange, WorldObject const *target)
 
virtual void Say (std::string const &text, Language language, WorldObject const *target=nullptr)
 
virtual void Yell (std::string const &text, Language language, WorldObject const *target=nullptr)
 
virtual void TextEmote (std::string const &text, WorldObject const *target=nullptr, bool isBossEmote=false)
 
virtual void Whisper (std::string const &text, Language language, Player *target, bool isBossWhisper=false)
 
void Talk (uint32 textId, ChatMsg msgType, float textRange, WorldObject const *target)
 
void Say (uint32 textId, WorldObject const *target=nullptr)
 
void Yell (uint32 textId, WorldObject const *target=nullptr)
 
void TextEmote (uint32 textId, WorldObject const *target=nullptr, bool isBossEmote=false)
 
void Whisper (uint32 textId, Player *target, bool isBossWhisper=false)
 
uint32 GetVirtualItemId (uint32 slot) const
 
void SetVirtualItem (uint32 slot, uint32 itemId, uint16 appearanceModId=0)
 
- Public Member Functions inherited from WorldObject
virtual ~WorldObject ()
 
void GetNearPoint2D (float &x, float &y, float distance, float absAngle) const
 
void GetNearPoint (WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle) const
 
void GetClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float angle=0) const
 
void MovePosition (Position &pos, float dist, float angle)
 
Position GetNearPosition (float dist, float angle)
 
void MovePositionToFirstCollision (Position &pos, float dist, float angle)
 
Position GetFirstCollisionPosition (float dist, float angle)
 
Position GetRandomNearPosition (float radius)
 
void GetContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
float GetObjectSize () const
 
void UpdateGroundPositionZ (float x, float y, float &z) const
 
void UpdateAllowedPositionZ (float x, float y, float &z) const
 
void GetRandomPoint (Position const &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
 
Position GetRandomPoint (Position const &srcPos, float distance) const
 
uint32 GetInstanceId () const
 
virtual void SetPhaseMask (uint32 newPhaseMask, bool update)
 
void CopyPhaseFrom (WorldObject *obj, bool update=false)
 
void UpdateAreaPhase ()
 
void ClearPhases (bool update=false)
 
void RebuildTerrainSwaps ()
 
void RebuildWorldMapAreaSwaps ()
 
bool HasInPhaseList (uint32 phase)
 
uint32 GetPhaseMask () const
 
bool IsInPhase (uint32 phase) const
 
bool IsInPhase (WorldObject const *obj) const
 
bool IsInTerrainSwap (uint32 terrainSwap) const
 
std::set< uint32 > constGetPhases () const
 
std::set< uint32 > constGetTerrainSwaps () const
 
std::set< uint32 > constGetWorldMapAreaSwaps () const
 
int32 GetDBPhase () const
 
void SetDBPhase (int32 p)
 
uint32 GetZoneId () const
 
uint32 GetAreaId () const
 
void GetZoneAndAreaId (uint32 &zoneid, uint32 &areaid) const
 
InstanceScriptGetInstanceScript ()
 
std::string constGetName () const
 
void SetName (std::string const &newname)
 
float GetDistance (WorldObject const *obj) const
 
float GetDistance (Position const &pos) const
 
float GetDistance (float x, float y, float z) const
 
float GetDistance2d (WorldObject const *obj) const
 
float GetDistance2d (float x, float y) const
 
float GetDistanceZ (WorldObject const *obj) const
 
bool IsSelfOrInSameMap (WorldObject const *obj) const
 
bool IsInMap (WorldObject const *obj) const
 
bool IsWithinDist3d (float x, float y, float z, float dist) const
 
bool IsWithinDist3d (Position const *pos, float dist) const
 
bool IsWithinDist2d (float x, float y, float dist) const
 
bool IsWithinDist2d (Position const *pos, float dist) const
 
bool IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D=true) const
 
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true) const
 
bool IsWithinLOS (float x, float y, float z) const
 
bool IsWithinLOSInMap (WorldObject const *obj) const
 
bool GetDistanceOrder (WorldObject const *obj1, WorldObject const *obj2, bool is3D=true) const
 
bool IsInRange (WorldObject const *obj, float minRange, float maxRange, bool is3D=true) const
 
bool IsInRange2d (float x, float y, float minRange, float maxRange) const
 
bool IsInRange3d (float x, float y, float z, float minRange, float maxRange) const
 
bool isInFront (WorldObject const *target, float arc=float(M_PI)) const
 
bool isInBack (WorldObject const *target, float arc=float(M_PI)) const
 
bool IsInBetween (WorldObject const *obj1, WorldObject const *obj2, float size=0) const
 
virtual void SendMessageToSet (WorldPacket const *data, bool self)
 
virtual void SendMessageToSetInRange (WorldPacket const *data, float dist, bool self)
 
virtual void SendMessageToSet (WorldPacket const *data, Player const *skipped_rcvr)
 
void PlayDistanceSound (uint32 sound_id, Player *target=NULL)
 
void PlayDirectSound (uint32 sound_id, Player *target=NULL)
 
void SendObjectDeSpawnAnim (ObjectGuid guid)
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
float GetSightRange (WorldObject const *target=NULL) const
 
bool CanSeeOrDetect (WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
 
virtual void SetMap (Map *map)
 
virtual void ResetMap ()
 
MapGetMap () const
 
MapFindMap () const
 
Map constGetBaseMap () const
 
void SetZoneScript ()
 
ZoneScriptGetZoneScript () const
 
TempSummonSummonCreature (uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
 
TempSummonSummonCreature (uint32 id, float x, float y, float z, float ang=0, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0) const
 
GameObjectSummonGameObject (uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
 
CreatureSummonTrigger (float x, float y, float z, float ang, uint32 dur, CreatureAI *(*GetAI)(Creature *)=NULL)
 
void SummonCreatureGroup (uint8 group, std::list< TempSummon * > *list=NULL)
 
CreatureFindNearestCreature (uint32 entry, float range, bool alive=true) const
 
GameObjectFindNearestGameObject (uint32 entry, float range) const
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetPlayerListInGrid (std::list< Player * > &lList, float fMaxSearchRange) const
 
void DestroyForNearbyPlayers ()
 
void BuildUpdate (UpdateDataMapType &) override
 
void AddToObjectUpdate () override
 
void RemoveFromObjectUpdate () override
 
void AddToNotify (uint16 f)
 
bool isNeedNotify (uint16 f) const
 
uint16 GetNotifyFlags () const
 
bool NotifyExecuted (uint16 f) const
 
void SetNotified (uint16 f)
 
void ResetAllNotifies ()
 
bool isActiveObject () const
 
void setActive (bool isActiveObject)
 
void SetWorldObject (bool apply)
 
bool IsPermanentWorldObject () const
 
bool IsWorldObject () const
 
template<class NOTIFIER >
void VisitNearbyObject (float const &radius, NOTIFIER &notifier) const
 
template<class NOTIFIER >
void VisitNearbyGridObject (float const &radius, NOTIFIER &notifier) const
 
template<class NOTIFIER >
void VisitNearbyWorldObject (float const &radius, NOTIFIER &notifier) const
 
TransportGetTransport () const
 
float GetTransOffsetX () const
 
float GetTransOffsetY () const
 
float GetTransOffsetZ () const
 
float GetTransOffsetO () const
 
uint32 GetTransTime () const
 
int8 GetTransSeat () const
 
void SetTransport (Transport *t)
 
virtual float GetStationaryX () const
 
virtual float GetStationaryY () const
 
virtual float GetStationaryZ () const
 
virtual float GetStationaryO () const
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
ObjectGuid constGetGUID () const
 
PackedGuid constGetPackGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
TypeID GetTypeId () const
 
bool isType (uint16 mask) const
 
virtual void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target) const
 
void SendUpdateToPlayer (Player *player)
 
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player *target) const
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
int32 GetInt32Value (uint16 index) const
 
uint32 GetUInt32Value (uint16 index) const
 
uint64 GetUInt64Value (uint16 index) const
 
float GetFloatValue (uint16 index) const
 
uint8 GetByteValue (uint16 index, uint8 offset) const
 
uint16 GetUInt16Value (uint16 index, uint8 offset) const
 
ObjectGuid constGetGuidValue (uint16 index) const
 
void SetInt32Value (uint16 index, int32 value)
 
void SetUInt32Value (uint16 index, uint32 value)
 
void UpdateUInt32Value (uint16 index, uint32 value)
 
void SetUInt64Value (uint16 index, uint64 value)
 
void SetFloatValue (uint16 index, float value)
 
void SetByteValue (uint16 index, uint8 offset, uint8 value)
 
void SetUInt16Value (uint16 index, uint8 offset, uint16 value)
 
void SetGuidValue (uint16 index, ObjectGuid const &value)
 
void SetStatFloatValue (uint16 index, float value)
 
void SetStatInt32Value (uint16 index, int32 value)
 
bool AddGuidValue (uint16 index, ObjectGuid const &value)
 
bool RemoveGuidValue (uint16 index, ObjectGuid const &value)
 
void ApplyModUInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModUInt16Value (uint16 index, uint8 offset, int16 val, bool apply)
 
void ApplyModPositiveFloatValue (uint16 index, float val, bool apply)
 
void ApplyModSignedFloatValue (uint16 index, float val, bool apply)
 
void ApplyPercentModFloatValue (uint16 index, float val, bool apply)
 
void SetFlag (uint16 index, uint32 newFlag)
 
void RemoveFlag (uint16 index, uint32 oldFlag)
 
void ToggleFlag (uint16 index, uint32 flag)
 
bool HasFlag (uint16 index, uint32 flag) const
 
void ApplyModFlag (uint16 index, uint32 flag, bool apply)
 
void SetByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void RemoveByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void ToggleByteFlag (uint16 index, uint8 offset, uint8 flag)
 
bool HasByteFlag (uint16 index, uint8 offset, uint8 flag) const
 
void SetFlag64 (uint16 index, uint64 newFlag)
 
void RemoveFlag64 (uint16 index, uint64 oldFlag)
 
void ToggleFlag64 (uint16 index, uint64 flag)
 
bool HasFlag64 (uint16 index, uint64 flag) const
 
void ApplyModFlag64 (uint16 index, uint64 flag, bool apply)
 
std::vector< uint32 > constGetDynamicValues (uint16 index) const
 
void AddDynamicValue (uint16 index, uint32 value)
 
void RemoveDynamicValue (uint16 index, uint32 value)
 
void ClearDynamicValue (uint16 index)
 
void SetDynamicValue (uint16 index, uint8 offset, uint32 value)
 
void ClearUpdateMask (bool remove)
 
uint16 GetValuesCount () const
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &) const
 
void SetFieldNotifyFlag (uint16 flag)
 
void RemoveFieldNotifyFlag (uint16 flag)
 
void ForceValuesUpdateAtIndex (uint32)
 
PlayerToPlayer ()
 
Player constToPlayer () const
 
CreatureToCreature ()
 
Creature constToCreature () const
 
UnitToUnit ()
 
Unit constToUnit () const
 
GameObjectToGameObject ()
 
GameObject constToGameObject () const
 
CorpseToCorpse ()
 
Corpse constToCorpse () const
 
DynamicObjectToDynObject ()
 
DynamicObject constToDynObject () const
 
AreaTriggerToAreaTrigger ()
 
AreaTrigger constToAreaTrigger () const
 
- Public Member Functions inherited from WorldLocation
 WorldLocation (uint32 mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
 WorldLocation (WorldLocation const &loc)
 
void WorldRelocate (WorldLocation const &loc)
 
void WorldRelocate (uint32 mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
WorldLocation GetWorldLocation () const
 
uint32 GetMapId () const
 
- Public Member Functions inherited from Position
 Position (float x=0, float y=0, float z=0, float o=0)
 
 Position (Position const &loc)
 
bool operator== (Position const &a)
 
bool operator!= (Position const &a)
 
void Relocate (float x, float y)
 
void Relocate (float x, float y, float z)
 
void Relocate (float x, float y, float z, float orientation)
 
void Relocate (Position const &pos)
 
void Relocate (Position const *pos)
 
void Relocate (G3D::Vector3 const &pos)
 
void RelocateOffset (Position const &offset)
 
void SetOrientation (float orientation)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
float GetOrientation () const
 
void GetPosition (float &x, float &y) const
 
void GetPosition (float &x, float &y, float &z) const
 
void GetPosition (float &x, float &y, float &z, float &o) const
 
Position GetPosition () const
 
Position::PositionXYStreamer PositionXYStream ()
 
Position::PositionXYZStreamer PositionXYZStream ()
 
Position::PositionXYZOStreamer PositionXYZOStream ()
 
bool IsPositionValid () const
 
float GetExactDist2dSq (float x, float y) const
 
float GetExactDist2d (const float x, const float y) const
 
float GetExactDist2dSq (Position const *pos) const
 
float GetExactDist2d (Position const *pos) const
 
float GetExactDistSq (float x, float y, float z) const
 
float GetExactDist (float x, float y, float z) const
 
float GetExactDistSq (Position const *pos) const
 
float GetExactDist (Position const *pos) const
 
void GetPositionOffsetTo (Position const &endPos, Position &retOffset) const
 
Position GetPositionWithOffset (Position const &offset) const
 
float GetAngle (Position const *pos) const
 
float GetAngle (float x, float y) const
 
float GetRelativeAngle (Position const *pos) const
 
float GetRelativeAngle (float x, float y) const
 
void GetSinCos (float x, float y, float &vsin, float &vcos) const
 
bool IsInDist2d (float x, float y, float dist) const
 
bool IsInDist2d (Position const *pos, float dist) const
 
bool IsInDist (float x, float y, float z, float dist) const
 
bool IsInDist (Position const *pos, float dist) const
 
bool IsWithinBox (const Position &center, float xradius, float yradius, float zradius) const
 
bool HasInArc (float arcangle, Position const *pos, float border=2.0f) const
 
bool HasInLine (Position const *pos, float width) const
 
std::string ToString () const
 
- Public Member Functions inherited from GridObject< Creature >
virtual ~GridObject ()
 
bool IsInGrid () const
 
void AddToGrid (GridRefManager< Creature > &m)
 
void RemoveFromGrid ()
 

Static Public Member Functions

static void DeleteFromDB (uint32 guidlow)
 
static void resetTalentsForAllPetsOf (Player *owner, Pet *online_pet=nullptr)
 
- Static Public Member Functions inherited from Creature
static float _GetDamageMod (int32 Rank)
 
- Static Public Member Functions inherited from Unit
static ReputationRank GetFactionReactionTo (FactionTemplateEntry const *factionTemplateEntry, Unit const *target)
 
- Static Public Member Functions inherited from Position
static float NormalizeOrientation (float o)
 

Public Attributes

PetSpellMap m_spells
 
AutoSpellList m_autospells
 
uint32 m_usedTalentCount
 
bool m_removed
 
- Public Attributes inherited from TempSummon
const SummonPropertiesEntry *const m_Properties
 
- Public Attributes inherited from Creature
Loot loot
 
uint32 m_spells [CREATURE_MAX_SPELLS]
 
uint32 m_groupLootTimer
 
ObjectGuid lootingGroupLowGUID
 
uint32 m_PlayerDamageReq
 
float m_SightDistance
 
float m_CombatDistance
 
bool m_isTempWorldObject
 
- Public Attributes inherited from Unit
uint32 m_extraAttacks
 
bool m_canDualWield
 
ControlList m_Controlled
 
Playerm_movedPlayer
 
ObjectGuid m_SummonSlot [MAX_SUMMON_SLOT]
 
ObjectGuid m_ObjectSlot [MAX_GAMEOBJECT_SLOT]
 
float m_modMeleeHitChance
 
float m_modRangedHitChance
 
float m_modSpellHitChance
 
int32 m_baseSpellCritChance
 
float m_threatModifier [MAX_SPELL_SCHOOL]
 
float m_modAttackSpeedPct [3]
 
EventProcessor m_Events
 
SpellImmuneList m_spellImmune [MAX_SPELL_IMMUNITY]
 
uint32 m_lastSanctuaryTime
 
PetAuraSet m_petAuras
 
bool IsAIEnabled
 
bool NeedChangeAI
 
ObjectGuid LastCharmerGUID
 
bool m_ControlledByPlayer
 
Movement::MoveSplinemovespline
 
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32,
uint32, StealthType,
TOTAL_STEALTH_TYPES
m_stealth
 
FlaggedValuesArray32< int32,
uint32, StealthType,
TOTAL_STEALTH_TYPES
m_stealthDetect
 
FlaggedValuesArray32< int32,
uint32, InvisibilityType,
TOTAL_INVISIBILITY_TYPES
m_invisibility
 
FlaggedValuesArray32< int32,
uint32, InvisibilityType,
TOTAL_INVISIBILITY_TYPES
m_invisibilityDetect
 
FlaggedValuesArray32< int32,
uint32,
ServerSideVisibilityType,
TOTAL_SERVERSIDE_VISIBILITY_TYPES
m_serverSideVisibility
 
FlaggedValuesArray32< int32,
uint32,
ServerSideVisibilityType,
TOTAL_SERVERSIDE_VISIBILITY_TYPES
m_serverSideVisibilityDetect
 
uint32 LastUsedScriptID
 
MovementInfo m_movementInfo
 
- Public Attributes inherited from WorldLocation
uint32 m_mapId
 
- Public Attributes inherited from Position
float m_positionX
 
float m_positionY
 
float m_positionZ
 

Protected Attributes

PetType m_petType
 
int32 m_duration
 
bool m_loading
 
uint32 m_focusRegenTimer
 
uint32 m_groupUpdateMask
 
DeclinedNamem_declinedname
 
- Protected Attributes inherited from Guardian
int32 m_bonusSpellDamage
 
float m_statFromOwner [MAX_STATS]
 
- Protected Attributes inherited from Minion
Unit *const m_owner
 
float m_followAngle
 
- Protected Attributes inherited from Creature
VendorItemCounts m_vendorItemCounts
 
ObjectGuid m_lootRecipient
 
ObjectGuid m_lootRecipientGroup
 
ObjectGuid _skinner
 
time_t _pickpocketLootRestore
 Timers. More...
 
time_t m_corpseRemoveTime
 
time_t m_respawnTime
 
uint32 m_respawnDelay
 
uint32 m_corpseDelay
 
float m_respawnradius
 
uint32 m_boundaryCheckTime
 
uint32 m_combatPulseTime
 
uint32 m_combatPulseDelay
 
ReactStates m_reactState
 
MovementGeneratorType m_defaultMovementType
 
ObjectGuid::LowType m_spawnId
 For new or temporary creatures is 0 for saved it is lowguid. More...
 
uint8 m_equipmentId
 
int8 m_originalEquipmentId
 
bool m_AlreadyCallAssistance
 
bool m_AlreadySearchedAssistance
 
bool m_regenHealth
 
bool m_AI_locked
 
SpellSchoolMask m_meleeDamageSchoolMask
 
uint32 m_originalEntry
 
Position m_homePosition
 
Position m_transportHomePosition
 
bool DisableReputationGain
 
CreatureTemplate constm_creatureInfo
 
CreatureData constm_creatureData
 
uint16 m_LootMode
 
- Protected Attributes inherited from Unit
UnitAIi_AI
 
UnitAIi_disabledAI
 
bool m_AutoRepeatFirstCast
 
uint32 m_attackTimer [MAX_ATTACK]
 
float m_createStats [MAX_STATS]
 
AttackerSet m_attackers
 
Unitm_attacking
 
bool m_shouldReacquireTarget
 
DeathState m_deathState
 
int32 m_procDeep
 
DynObjectList m_dynObj
 
GameObjectList m_gameObj
 
uint32 m_transform
 
Spellm_currentSpells [CURRENT_MAX_SPELL]
 
AuraMap m_ownedAuras
 
AuraApplicationMap m_appliedAuras
 
AuraList m_removedAuras
 
AuraMap::iterator m_auraUpdateIterator
 
uint32 m_removedAurasCount
 
AuraEffectList m_modAuras [TOTAL_AURAS]
 
AuraList m_scAuras
 
AuraApplicationList m_interruptableAuras
 
AuraStateAurasMap m_auraStateAuras
 
uint32 m_interruptMask
 
float m_auraModifiersGroup [UNIT_MOD_END][MODIFIER_TYPE_END]
 
float m_weaponDamage [MAX_ATTACK][2]
 
bool m_canModifyStats
 
VisibleAuraMap m_visibleAuras
 
float m_speed_rate [MAX_MOVE_TYPE]
 
CharmInfom_charmInfo
 
SharedVisionList m_sharedVision
 
MotionMasteri_motionMaster
 
uint32 m_reactiveTimer [MAX_REACTIVE]
 
uint32 m_regenTimer
 
ThreatManager m_ThreatManager
 
Vehiclem_vehicle
 
Vehiclem_vehicleKit
 
uint32 m_unitTypeMask
 
LiquidTypeEntry const_lastLiquid
 
uint32 m_movementCounter
 Incrementing counter used in movement packets. More...
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
const bool m_isWorldObject
 
ZoneScriptm_zoneScript
 
Transportm_transport
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
TypeID m_objectTypeId
 
uint32 m_updateFlag
 
union {
   int32 *   m_int32Values
 
   uint32 *   m_uint32Values
 
   float *   m_floatValues
 
}; 
 
std::vector< uint32 > * _dynamicValues
 
UpdateMask _changesMask
 
UpdateMask _dynamicChangesMask
 
UpdateMask_dynamicChangesArrayMask
 
uint16 m_valuesCount
 
uint16 _dynamicValuesCount
 
uint16 _fieldNotifyFlags
 
bool m_objectUpdated
 

Private Member Functions

void SaveToDB (uint32, uint32, uint32) override
 
void DeleteFromDB () override
 

Additional Inherited Members

- Public Types inherited from Unit
typedef std::set< Unit * > AttackerSet
 
typedef std::set< Unit * > ControlList
 
typedef std::multimap< uint32,
Aura * > 
AuraMap
 
typedef std::pair
< AuraMap::const_iterator,
AuraMap::const_iterator > 
AuraMapBounds
 
typedef std::pair
< AuraMap::iterator,
AuraMap::iterator > 
AuraMapBoundsNonConst
 
typedef std::multimap< uint32,
AuraApplication * > 
AuraApplicationMap
 
typedef std::pair
< AuraApplicationMap::const_iterator,
AuraApplicationMap::const_iterator > 
AuraApplicationMapBounds
 
typedef std::pair
< AuraApplicationMap::iterator,
AuraApplicationMap::iterator > 
AuraApplicationMapBoundsNonConst
 
typedef std::multimap
< AuraStateType,
AuraApplication * > 
AuraStateAurasMap
 
typedef std::pair
< AuraStateAurasMap::const_iterator,
AuraStateAurasMap::const_iterator > 
AuraStateAurasMapBounds
 
typedef std::list< AuraEffect * > AuraEffectList
 
typedef std::list< Aura * > AuraList
 
typedef std::list
< AuraApplication * > 
AuraApplicationList
 
typedef std::list
< DiminishingReturn
Diminishing
 
typedef std::map< uint8,
AuraApplication * > 
VisibleAuraMap
 
typedef std::set< PetAura const * > PetAuraSet
 
- Protected Types inherited from Unit
typedef std::list
< DynamicObject * > 
DynObjectList
 
typedef std::list< GameObject * > GameObjectList
 
- Protected Member Functions inherited from Creature
bool CreateFromProto (ObjectGuid::LowType guidlow, uint32 entry, CreatureData const *data=nullptr, uint32 vehId=0)
 
bool InitEntry (uint32 entry, CreatureData const *data=nullptr)
 
void RegenerateMana ()
 
void RegenerateHealth ()
 
void Regenerate (Powers power)
 
bool IsInvisibleDueToDespawn () const override
 
bool CanAlwaysSee (WorldObject const *obj) const override
 
- Protected Member Functions inherited from Unit
 Unit (bool isWorldObject)
 
void BuildValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const override
 
void DestroyForPlayer (Player *target) const override
 
void _UpdateSpells (uint32 time)
 
void _DeleteRemovedAuras ()
 
void _UpdateAutoRepeatSpell ()
 
bool IsAlwaysVisibleFor (WorldObject const *seer) const override
 
bool IsAlwaysDetectableFor (WorldObject const *seer) const override
 
void DisableSpline ()
 
void SetFeared (bool apply)
 
void SetConfused (bool apply)
 
void SetStunned (bool apply)
 
void SetRooted (bool apply, bool packetOnly=false)
 
- Protected Member Functions inherited from WorldObject
 WorldObject (bool isWorldObject)
 
void SetLocationMapId (uint32 _mapId)
 
void SetLocationInstanceId (uint32 _instanceId)
 
virtual bool IsNeverVisible () const
 
- Protected Member Functions inherited from Object
 Object ()
 
void _InitValues ()
 
void _Create (ObjectGuid const &guid)
 
std::string _ConcatFields (uint16 startIndex, uint16 size) const
 
void _LoadIntoDataField (std::string const &data, uint32 startOffset, uint32 count)
 
uint32 GetUpdateFieldData (Player const *target, uint32 *&flags) const
 
uint32 GetDynamicUpdateFieldData (Player const *target, uint32 *&flags) const
 
void BuildMovementUpdate (ByteBuffer *data, uint32 flags) const
 
virtual void BuildDynamicValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const
 
void AddToObjectUpdateIfNeeded ()
 
- Protected Member Functions inherited from MapObject
 MapObject ()
 
- Static Protected Member Functions inherited from Creature
static float _GetHealthMod (int32 Rank)
 

Constructor & Destructor Documentation

Pet::Pet ( Player owner,
PetType  type = MAX_PET_TYPE 
)
explicit
39  :
40  Guardian(NULL, owner, true), m_usedTalentCount(0), m_removed(false),
41  m_petType(type), m_duration(0), m_loading(false), m_groupUpdateMask(0),
43 {
44  ASSERT(GetOwner());
45 
47  if (type == HUNTER_PET)
49 
51  {
53  InitCharmInfo();
54  }
55 
56  m_name = "Pet";
58 }
Definition: Unit.h:865
Player * GetOwner() const
Definition: Pet.cpp:1913
Guardian(SummonPropertiesEntry const *properties, Unit *owner, bool isWorldObject)
Definition: TemporarySummon.cpp:324
uint32 m_usedTalentCount
Definition: Pet.h:141
std::string m_name
Definition: Object.h:624
#define PET_FOCUS_REGEN_INTERVAL
Definition: Pet.h:25
arena_t NULL
Definition: jemalloc_internal.h:624
int32 m_duration
Definition: Pet.h:155
uint32 m_groupUpdateMask
Definition: Pet.h:158
bool m_loading
Definition: Pet.h:156
Definition: Unit.h:866
Definition: PetDefines.h:25
bool m_removed
Definition: Pet.h:149
PetType m_petType
Definition: Pet.h:154
uint32 m_focusRegenTimer
Definition: Pet.h:157
uint32 m_unitTypeMask
Definition: Unit.h:2307
CharmInfo * InitCharmInfo()
Definition: Unit.cpp:11836
#define ASSERT
Definition: Errors.h:55
Definition: Unit.h:862
DeclinedName * m_declinedname
Definition: Pet.h:160

+ Here is the call graph for this function:

Pet::~Pet ( )
virtual
61 {
62  delete m_declinedname;
63 }
DeclinedName * m_declinedname
Definition: Pet.h:160

Member Function Documentation

void Pet::_LoadAuras ( uint32  timediff)
1158 {
1159  TC_LOG_DEBUG("entities.pet", "Loading auras for %s", GetGUID().ToString().c_str());
1160 
1161  /*
1162  0 1 2 3 4 5
1163  SELECT casterGuid, spell, effectMask, effectIndex, amount, baseAmount FROM pet_aura_effect WHERE guid = ?
1164  */
1165 
1167  stmt->setUInt32(0, m_charmInfo->GetPetNumber());
1168 
1169  ObjectGuid casterGuid, itemGuid;
1170  std::map<AuraKey, AuraLoadEffectInfo> effectInfo;
1171  if (PreparedQueryResult effectResult = CharacterDatabase.Query(stmt))
1172  {
1173  do
1174  {
1175  Field* fields = effectResult->Fetch();
1176  uint32 effectIndex = fields[3].GetUInt8();
1177  if (effectIndex < MAX_SPELL_EFFECTS)
1178  {
1179  casterGuid.SetRawValue(fields[0].GetBinary());
1180  if (casterGuid.IsEmpty())
1181  casterGuid = GetGUID();
1182 
1183  AuraKey key{ casterGuid, itemGuid, fields[1].GetUInt32(), fields[2].GetUInt32() };
1184  AuraLoadEffectInfo& info = effectInfo[key];
1185  info.Amounts[effectIndex] = fields[4].GetInt32();
1186  info.BaseAmounts[effectIndex] = fields[5].GetInt32();
1187  }
1188  } while (effectResult->NextRow());
1189  }
1190 
1192  stmt->setUInt32(0, m_charmInfo->GetPetNumber());
1193 
1194  /*
1195  0 1 2 3 4 5 6 7
1196  SELECT casterGuid, spell, effectMask, recalculateMask, stackCount, maxDuration, remainTime, remainCharges FROM pet_aura WHERE guid = ?
1197  */
1198  if (PreparedQueryResult auraResult = CharacterDatabase.Query(stmt))
1199  {
1200  do
1201  {
1202  Field* fields = auraResult->Fetch();
1203  // NULL guid stored - pet is the caster of the spell - see Pet::_SaveAuras
1204  casterGuid.SetRawValue(fields[0].GetBinary());
1205  if (casterGuid.IsEmpty())
1206  casterGuid = GetGUID();
1207 
1208  AuraKey key{ casterGuid, itemGuid, fields[1].GetUInt32(), fields[2].GetUInt32() };
1209  uint32 recalculateMask = fields[3].GetUInt32();
1210  uint8 stackCount = fields[4].GetUInt8();
1211  int32 maxDuration = fields[5].GetInt32();
1212  int32 remainTime = fields[6].GetInt32();
1213  uint8 remainCharges = fields[7].GetUInt8();
1214 
1215  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(key.SpellId);
1216  if (!spellInfo)
1217  {
1218  TC_LOG_ERROR("entities.pet", "Unknown aura (spellid %u), ignore.", key.SpellId);
1219  continue;
1220  }
1221 
1222  // negative effects should continue counting down after logout
1223  if (remainTime != -1 && !spellInfo->IsPositive())
1224  {
1225  if (remainTime/IN_MILLISECONDS <= int32(timediff))
1226  continue;
1227 
1228  remainTime -= timediff*IN_MILLISECONDS;
1229  }
1230 
1231  // prevent wrong values of remainCharges
1232  if (spellInfo->ProcCharges)
1233  {
1234  // we have no control over the order of applying auras and modifiers allow auras
1235  // to have more charges than value in SpellInfo
1236  if (remainCharges <= 0/* || remainCharges > spellproto->procCharges*/)
1237  remainCharges = spellInfo->ProcCharges;
1238  }
1239  else
1240  remainCharges = 0;
1241 
1242  AuraLoadEffectInfo& info = effectInfo[key];
1243  if (Aura* aura = Aura::TryCreate(spellInfo, key.EffectMask, this, NULL, info.BaseAmounts.data(), NULL, casterGuid))
1244  {
1245  if (!aura->CanBeSaved())
1246  {
1247  aura->Remove();
1248  continue;
1249  }
1250 
1251  aura->SetLoadedState(maxDuration, remainTime, remainCharges, stackCount, recalculateMask, info.Amounts.data());
1252  aura->ApplyForTargets();
1253  TC_LOG_DEBUG("entities.pet", "Added aura spellid %u, effectmask %u", spellInfo->Id, key.EffectMask);
1254  }
1255  }
1256  while (auraResult->NextRow());
1257  }
1258 }
uint32 Id
Definition: SpellInfo.h:329
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
Definition: SpellInfo.h:326
uint32 ProcCharges
Definition: SpellInfo.h:372
Class used to access individual fields of database query result.
Definition: Field.h:56
CharmInfo * m_charmInfo
Definition: Unit.h:2292
Definition: CharacterDatabase.h:524
arena_t NULL
Definition: jemalloc_internal.h:624
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Definition: SpellAuras.h:109
Definition: PreparedStatement.h:74
uint8 GetUInt8() const
Definition: Field.h:70
bool IsPositive() const
Definition: SpellInfo.cpp:1495
uint32 GetPetNumber() const
Definition: Unit.h:1207
std::string ToString() const
Definition: Position.cpp:160
#define sSpellMgr
Definition: SpellMgr.h:756
int32_t int32
Definition: Define.h:146
void SetRawValue(std::vector< uint8 > const &guid)
Definition: ObjectGuid.cpp:134
uint32_t uint32
Definition: Define.h:150
Definition: CharacterDatabase.h:523
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
int32 GetInt32() const
Definition: Field.h:165
ObjectGuid const & GetGUID() const
Definition: Object.h:105
std::array< int32, MAX_SPELL_EFFECTS > Amounts
Definition: SpellAuras.h:111
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
Definition: Common.h:103
uint32 GetUInt32() const
Definition: Field.h:146
int32_t int32
Definition: g3dmath.h:167
uint8_t uint8
Definition: Define.h:152
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1026
std::array< int32, MAX_SPELL_EFFECTS > BaseAmounts
Definition: SpellAuras.h:112
Definition: SpellAuras.h:96
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: ObjectGuid.h:189
Definition: SpellAuras.h:116
static Aura * TryCreate(SpellInfo const *spellproto, uint32 tryEffMask, WorldObject *owner, Unit *caster, int32 *baseAmount, Item *castItem=NULL, ObjectGuid casterGUID=ObjectGuid::Empty, int32 castItemLevel=-1)
Definition: SpellAuras.cpp:309
bool IsEmpty() const
Definition: ObjectGuid.h:242

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pet::_LoadSpellCooldowns ( )
1078 {
1080  stmt->setUInt32(0, m_charmInfo->GetPetNumber());
1081  PreparedQueryResult cooldownsResult = CharacterDatabase.Query(stmt);
1082 
1084  stmt->setUInt32(0, m_charmInfo->GetPetNumber());
1085  PreparedQueryResult chargesResult = CharacterDatabase.Query(stmt);
1086 
1087  GetSpellHistory()->LoadFromDB<Pet>(cooldownsResult, chargesResult);
1088 }
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
void LoadFromDB(PreparedQueryResult cooldownsResult, PreparedQueryResult chargesResult)
Definition: SpellHistory.cpp:132
Definition: CharacterDatabase.h:526
CharmInfo * m_charmInfo
Definition: Unit.h:2292
Definition: PreparedStatement.h:74
SpellHistory * GetSpellHistory()
Definition: Unit.h:1926
Definition: CharacterDatabase.h:532
uint32 GetPetNumber() const
Definition: Unit.h:1207
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: Pet.h:46

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pet::_LoadSpells ( )
1091 {
1093  stmt->setUInt32(0, m_charmInfo->GetPetNumber());
1095 
1096  if (result)
1097  {
1098  do
1099  {
1100  Field* fields = result->Fetch();
1101 
1102  addSpell(fields[0].GetUInt32(), ActiveStates(fields[1].GetUInt8()), PETSPELL_UNCHANGED);
1103  }
1104  while (result->NextRow());
1105  }
1106 }
Definition: CharacterDatabase.h:525
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
Class used to access individual fields of database query result.
Definition: Field.h:56
CharmInfo * m_charmInfo
Definition: Unit.h:2292
Definition: PreparedStatement.h:74
uint32 GetPetNumber() const
Definition: Unit.h:1207
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
Definition: PetDefines.h:50
ActiveStates
Definition: Unit.h:1117
bool addSpell(uint32 spellId, ActiveStates active=ACT_DECIDE, PetSpellState state=PETSPELL_NEW, PetSpellType type=PETSPELL_NORMAL)
Definition: Pet.cpp:1317
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pet::_SaveAuras ( SQLTransaction trans)
1261 {
1263  stmt->setUInt32(0, m_charmInfo->GetPetNumber());
1264  trans->Append(stmt);
1265 
1267  stmt->setUInt32(0, m_charmInfo->GetPetNumber());
1268  trans->Append(stmt);
1269 
1270  uint8 index;
1271  for (AuraMap::const_iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end(); ++itr)
1272  {
1273  // check if the aura has to be saved
1274  if (!itr->second->CanBeSaved() || IsPetAura(itr->second))
1275  continue;
1276 
1277  Aura* aura = itr->second;
1278  uint32 recalculateMask = 0;
1279  AuraKey key = aura->GenerateKey(recalculateMask);
1280 
1281  // don't save guid of caster in case we are caster of the spell - guid for pet is generated every pet load, so it won't match saved guid anyways
1282  if (key.Caster == GetGUID())
1283  key.Caster.Clear();
1284 
1285  index = 0;
1287  stmt->setUInt32(index++, m_charmInfo->GetPetNumber());
1288  stmt->setBinary(index++, key.Caster.GetRawValue());
1289  stmt->setUInt32(index++, key.SpellId);
1290  stmt->setUInt32(index++, key.EffectMask);
1291  stmt->setUInt32(index++, recalculateMask);
1292  stmt->setUInt8(index++, aura->GetStackAmount());
1293  stmt->setInt32(index++, aura->GetMaxDuration());
1294  stmt->setInt32(index++, aura->GetDuration());
1295  stmt->setUInt8(index++, aura->GetCharges());
1296  trans->Append(stmt);
1297 
1298  for (AuraEffect const* effect : aura->GetAuraEffects())
1299  {
1300  if (effect)
1301  {
1302  index = 0;
1304  stmt->setUInt32(index++, m_charmInfo->GetPetNumber());
1305  stmt->setBinary(index++, key.Caster.GetRawValue());
1306  stmt->setUInt32(index++, key.SpellId);
1307  stmt->setUInt32(index++, key.EffectMask);
1308  stmt->setUInt8(index++, effect->GetEffIndex());
1309  stmt->setInt32(index++, effect->GetAmount());
1310  stmt->setInt32(index++, effect->GetBaseAmount());
1311  trans->Append(stmt);
1312  }
1313  }
1314  }
1315 }
Definition: SpellAuraEffects.h:30
Definition: CharacterDatabase.h:537
AuraMap m_ownedAuras
Definition: Unit.h:2273
AuraKey GenerateKey(uint32 &recalculateMask) const
Fills a helper structure containing aura primary key for character_aura, character_aura_effect, pet_aura, pet_aura_effect tables.
Definition: SpellAuras.cpp:1144
int32 GetMaxDuration() const
Definition: SpellAuras.h:159
void setBinary(const uint8 index, const std::vector< uint8 > &value)
Definition: PreparedStatement.cpp:197
uint32 EffectMask
Definition: SpellAuras.h:101
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
CharmInfo * m_charmInfo
Definition: Unit.h:2292
std::vector< uint8 > GetRawValue() const
Definition: ObjectGuid.cpp:127
Definition: PreparedStatement.h:74
bool IsPetAura(Aura const *aura)
Definition: Pet.cpp:1876
AuraEffectVector GetAuraEffects() const
Definition: SpellAuras.h:288
uint32 GetPetNumber() const
Definition: Unit.h:1207
Definition: CharacterDatabase.h:538
uint32_t uint32
Definition: Define.h:150
ObjectGuid Caster
Definition: SpellAuras.h:98
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
int32 GetDuration() const
Definition: SpellAuras.h:163
void setInt32(const uint8 index, const int32 value)
Definition: PreparedStatement.cpp:151
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
void Clear()
Definition: ObjectGuid.h:215
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: CharacterDatabase.h:528
Definition: CharacterDatabase.h:529
uint32 SpellId
Definition: SpellAuras.h:100
uint8 GetStackAmount() const
Definition: SpellAuras.h:179
uint8 GetCharges() const
Definition: SpellAuras.h:170
uint8_t uint8
Definition: Define.h:152
Definition: SpellAuras.h:96
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: SpellAuras.h:116

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pet::_SaveSpells ( SQLTransaction trans)
1109 {
1110  for (PetSpellMap::iterator itr = m_spells.begin(), next = m_spells.begin(); itr != m_spells.end(); itr = next)
1111  {
1112  ++next;
1113 
1114  // prevent saving family passives to DB
1115  if (itr->second.type == PETSPELL_FAMILY)
1116  continue;
1117 
1118  PreparedStatement* stmt;
1119 
1120  switch (itr->second.state)
1121  {
1122  case PETSPELL_REMOVED:
1124  stmt->setUInt32(0, m_charmInfo->GetPetNumber());
1125  stmt->setUInt32(1, itr->first);
1126  trans->Append(stmt);
1127 
1128  m_spells.erase(itr);
1129  continue;
1130  case PETSPELL_CHANGED:
1132  stmt->setUInt32(0, m_charmInfo->GetPetNumber());
1133  stmt->setUInt32(1, itr->first);
1134  trans->Append(stmt);
1135 
1137  stmt->setUInt32(0, m_charmInfo->GetPetNumber());
1138  stmt->setUInt32(1, itr->first);
1139  stmt->setUInt8(2, itr->second.active);
1140  trans->Append(stmt);
1141 
1142  break;
1143  case PETSPELL_NEW:
1145  stmt->setUInt32(0, m_charmInfo->GetPetNumber());
1146  stmt->setUInt32(1, itr->first);
1147  stmt->setUInt8(2, itr->second.active);
1148  trans->Append(stmt);
1149  break;
1150  case PETSPELL_UNCHANGED:
1151  continue;
1152  }
1153  itr->second.state = PETSPELL_UNCHANGED;
1154  }
1155 }
Definition: PetDefines.h:52
int next(int i, int n)
Definition: RecastContour.cpp:469
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
CharmInfo * m_charmInfo
Definition: Unit.h:2292
Definition: CharacterDatabase.h:536
Definition: PreparedStatement.h:74
uint32 GetPetNumber() const
Definition: Unit.h:1207
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Definition: PetDefines.h:51
Definition: PetDefines.h:53
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
Definition: PetDefines.h:59
Definition: PetDefines.h:50
PetSpellMap m_spells
Definition: Pet.h:128
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: CharacterDatabase.h:535

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Pet::addSpell ( uint32  spellId,
ActiveStates  active = ACT_DECIDE,
PetSpellState  state = PETSPELL_NEW,
PetSpellType  type = PETSPELL_NORMAL 
)
1318 {
1319  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
1320  if (!spellInfo)
1321  {
1322  // do pet spell book cleanup
1323  if (state == PETSPELL_UNCHANGED) // spell load case
1324  {
1325  TC_LOG_ERROR("entities.pet", "Pet::addSpell: Non-existed in SpellStore spell #%u request, deleting for all pets in `pet_spell`.", spellId);
1326 
1328 
1329  stmt->setUInt32(0, spellId);
1330 
1331  CharacterDatabase.Execute(stmt);
1332  }
1333  else
1334  TC_LOG_ERROR("entities.pet", "Pet::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
1335 
1336  return false;
1337  }
1338 
1339  PetSpellMap::iterator itr = m_spells.find(spellId);
1340  if (itr != m_spells.end())
1341  {
1342  if (itr->second.state == PETSPELL_REMOVED)
1343  {
1344  m_spells.erase(itr);
1345  state = PETSPELL_CHANGED;
1346  }
1347  else if (state == PETSPELL_UNCHANGED && itr->second.state != PETSPELL_UNCHANGED)
1348  {
1349  // can be in case spell loading but learned at some previous spell loading
1350  itr->second.state = PETSPELL_UNCHANGED;
1351 
1352  if (active == ACT_ENABLED)
1353  ToggleAutocast(spellInfo, true);
1354  else if (active == ACT_DISABLED)
1355  ToggleAutocast(spellInfo, false);
1356 
1357  return false;
1358  }
1359  else
1360  return false;
1361  }
1362 
1363  PetSpell newspell;
1364  newspell.state = state;
1365  newspell.type = type;
1366 
1367  if (active == ACT_DECIDE) // active was not used before, so we save it's autocast/passive state here
1368  {
1369  if (spellInfo->IsAutocastable())
1370  newspell.active = ACT_DISABLED;
1371  else
1372  newspell.active = ACT_PASSIVE;
1373  }
1374  else
1375  newspell.active = active;
1376 
1377  // talent: unlearn all other talent ranks (high and low)
1378  if (spellInfo->IsRanked())
1379  {
1380  for (PetSpellMap::const_iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2)
1381  {
1382  if (itr2->second.state == PETSPELL_REMOVED)
1383  continue;
1384 
1385  SpellInfo const* oldRankSpellInfo = sSpellMgr->GetSpellInfo(itr2->first);
1386 
1387  if (!oldRankSpellInfo)
1388  continue;
1389 
1390  if (spellInfo->IsDifferentRankOf(oldRankSpellInfo))
1391  {
1392  // replace by new high rank
1393  if (spellInfo->IsHighRankOf(oldRankSpellInfo))
1394  {
1395  newspell.active = itr2->second.active;
1396 
1397  if (newspell.active == ACT_ENABLED)
1398  ToggleAutocast(oldRankSpellInfo, false);
1399 
1400  unlearnSpell(itr2->first, false, false);
1401  break;
1402  }
1403  // ignore new lesser rank
1404  else
1405  return false;
1406  }
1407  }
1408  }
1409 
1410  m_spells[spellId] = newspell;
1411 
1412  if (spellInfo->IsPassive() && (!spellInfo->CasterAuraState || HasAuraState(AuraStateType(spellInfo->CasterAuraState))))
1413  CastSpell(this, spellId, true);
1414  else
1415  m_charmInfo->AddSpellToActionBar(spellInfo);
1416 
1417  if (newspell.active == ACT_ENABLED)
1418  ToggleAutocast(spellInfo, true);
1419 
1420  return true;
1421 }
PetSpellType type
Definition: Pet.h:32
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
bool IsPassive() const
Definition: SpellInfo.cpp:1403
bool IsAutocastable() const
Definition: SpellInfo.cpp:1408
Definition: SpellInfo.h:326
bool HasAuraState(AuraStateType flag, SpellInfo const *spellProto=NULL, Unit const *Caster=NULL) const
Definition: Unit.cpp:7491
AuraStateType
Definition: SharedDefines.h:1754
CharmInfo * m_charmInfo
Definition: Unit.h:2292
Definition: PreparedStatement.h:74
Definition: Pet.h:28
Definition: Unit.h:1124
Definition: CharacterDatabase.h:350
#define sSpellMgr
Definition: SpellMgr.h:756
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
bool IsRanked() const
Definition: SpellInfo.cpp:2741
Definition: PetDefines.h:51
Definition: PetDefines.h:53
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
void ToggleAutocast(SpellInfo const *spellInfo, bool apply)
Definition: Pet.cpp:1728
Definition: PetDefines.h:50
uint32 CasterAuraState
Definition: SpellInfo.h:354
PetSpellMap m_spells
Definition: Pet.h:128
bool IsHighRankOf(SpellInfo const *spellInfo) const
Definition: SpellInfo.cpp:2827
Definition: Unit.h:1121
bool unlearnSpell(uint32 spell_id, bool learn_prev, bool clear_ab=true)
Definition: Pet.cpp:1476
Definition: Unit.h:1119
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
ActiveStates active
Definition: Pet.h:30
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869
bool IsDifferentRankOf(SpellInfo const *spellInfo) const
Definition: SpellInfo.cpp:2820
bool AddSpellToActionBar(SpellInfo const *spellInfo, ActiveStates newstate=ACT_DECIDE, uint8 preferredSlot=0)
Definition: Unit.cpp:11987
Definition: Unit.h:1120
PetSpellState state
Definition: Pet.h:31

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pet::AddToWorld ( )
overridevirtual
  • Register the pet for guid lookup
  • Register the pet for guid lookup

Reimplemented from Creature.

66 {
68  if (!IsInWorld())
69  {
71  GetMap()->GetObjectsStore().Insert<Pet>(GetGUID(), this);
74  }
75 
76  // Prevent stuck pets when zoning. Pets default to "follow" when added to world
77  // so we'll reset flags and let the AI handle things
78  if (GetCharmInfo() && GetCharmInfo()->HasCommandState(COMMAND_FOLLOW))
79  {
82  GetCharmInfo()->SetIsAtStay(false);
83  GetCharmInfo()->SetIsFollowing(false);
84  GetCharmInfo()->SetIsReturning(false);
85  }
86 }
bool Insert(KEY_TYPE const &handle, SPECIFIC_TYPE *obj)
Definition: TypeContainer.h:119
Map * GetMap() const
Definition: Object.h:543
void SetIsFollowing(bool val)
Definition: Unit.cpp:15751
void AddToWorld() override
Definition: Unit.cpp:11724
bool AIM_Initialize(CreatureAI *ai=NULL)
Definition: Creature.cpp:796
CharmInfo * GetCharmInfo()
Definition: Unit.h:1748
void SetIsReturning(bool val)
Definition: Unit.cpp:15761
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:466
void SetIsAtStay(bool val)
Definition: Unit.cpp:15741
void SetIsCommandAttack(bool val)
Definition: Unit.cpp:15700
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: Unit.h:1138
bool IsInWorld() const
Definition: Object.h:100
void SetIsCommandFollow(bool val)
Definition: Unit.cpp:15710
Definition: Pet.h:46

+ Here is the call graph for this function:

void Pet::CastPetAura ( PetAura const aura)
1862 {
1863  uint32 auraId = aura->GetAura(GetEntry());
1864  if (!auraId)
1865  return;
1866 
1867  if (auraId == 35696) // Demonic Knowledge
1868  {
1869  int32 basePoints = CalculatePct(aura->GetDamage(), GetStat(STAT_STAMINA) + GetStat(STAT_INTELLECT));
1870  CastCustomSpell(this, auraId, &basePoints, NULL, NULL, true);
1871  }
1872  else
1873  CastSpell(this, auraId, true);
1874 }
Definition: SharedDefines.h:239
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: SharedDefines.h:240
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
T CalculatePct(T base, U pct)
Definition: Util.h:92
uint32 GetEntry() const
Definition: Object.h:107
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869
float GetStat(Stats stat) const
Definition: Unit.h:1417
void CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:920

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pet::CastPetAuras ( bool  current)
1843 {
1844  Player* owner = GetOwner();
1845 
1846  if (!IsPermanentPetFor(owner))
1847  return;
1848 
1849  for (PetAuraSet::const_iterator itr = owner->m_petAuras.begin(); itr != owner->m_petAuras.end();)
1850  {
1851  PetAura const* pa = *itr;
1852  ++itr;
1853 
1854  if (!current && pa->IsRemovedOnChangePet())
1855  owner->RemovePetAura(pa);
1856  else
1857  CastPetAura(pa);
1858  }
1859 }
Player * GetOwner() const
Definition: Pet.cpp:1913
void CastPetAura(PetAura const *aura)
Definition: Pet.cpp:1861
bool IsRemovedOnChangePet() const
Definition: SpellMgr.h:463
bool IsPermanentPetFor(Player *owner) const
Definition: Pet.cpp:1771
Definition: SpellMgr.h:433

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pet::CleanupActionBar ( )
1526 {
1527  for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
1528  if (UnitActionBarEntry const* ab = m_charmInfo->GetActionBarEntry(i))
1529  if (ab->GetAction() && ab->IsActionBarForSpell())
1530  {
1531  if (!HasSpell(ab->GetAction()))
1533  else if (ab->GetType() == ACT_ENABLED)
1534  {
1535  if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(ab->GetAction()))
1536  ToggleAutocast(spellInfo, true);
1537  }
1538  }
1539 }
Definition: SpellInfo.h:326
Definition: Unit.h:1148
CharmInfo * m_charmInfo
Definition: Unit.h:2292
UnitActionBarEntry const * GetActionBarEntry(uint8 index) const
Definition: Unit.h:1229
#define sSpellMgr
Definition: SpellMgr.h:756
void ToggleAutocast(SpellInfo const *spellInfo, bool apply)
Definition: Pet.cpp:1728
bool HasSpell(uint32 spell) const override
Definition: Pet.cpp:1814
Definition: Unit.h:1121
#define MAX_UNIT_ACTION_BAR_INDEX
Definition: Unit.h:1199
void SetActionBar(uint8 index, uint32 spellOrAction, ActiveStates type)
Definition: Unit.h:1225
uint8_t uint8
Definition: Define.h:152
Definition: Unit.h:1119

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Pet::Create ( ObjectGuid::LowType  guidlow,
Map map,
uint32  Entry 
)
1795 {
1796  ASSERT(map);
1797  SetMap(map);
1798 
1799  Object::_Create(ObjectGuid::Create<HighGuid::Pet>(map->GetId(), Entry, guidlow));
1800 
1801  m_spawnId = guidlow;
1803 
1804  if (!InitEntry(Entry))
1805  return false;
1806 
1807  // Force regen flag for player pets, just like we do for players themselves
1810 
1811  return true;
1812 }
void _Create(ObjectGuid const &guid)
Definition: Object.cpp:125
virtual void SetMap(Map *map)
Definition: Object.cpp:2169
Definition: Unit.h:721
Definition: UpdateFields.h:110
bool InitEntry(uint32 entry, CreatureData const *data=nullptr)
Definition: Creature.cpp:307
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
uint32 GetId(void) const
Definition: Map.h:325
Entry
Definition: boss_headless_horseman.cpp:50
uint32 m_originalEntry
Definition: Creature.h:757
virtual void SetSheath(SheathState sheathed)
Definition: Unit.h:1463
#define ASSERT
Definition: Errors.h:55
ObjectGuid::LowType m_spawnId
For new or temporary creatures is 0 for saved it is lowguid.
Definition: Creature.h:747
Definition: Unit.h:299

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Pet::CreateBaseAtCreature ( Creature creature)
731 {
732  ASSERT(creature);
733 
734  if (!CreateBaseAtTamed(creature->GetCreatureTemplate(), creature->GetMap()))
735  return false;
736 
737  Relocate(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetOrientation());
738 
739  if (!IsPositionValid())
740  {
741  TC_LOG_ERROR("entities.pet", "Pet (%s, entry %d) not created base at creature. Suggested coordinates isn't valid (X: %f Y: %f)",
742  GetGUID().ToString().c_str(), GetEntry(), GetPositionX(), GetPositionY());
743  return false;
744  }
745 
746  CreatureTemplate const* cinfo = GetCreatureTemplate();
747  if (!cinfo)
748  {
749  TC_LOG_ERROR("entities.pet", "CreateBaseAtCreature() failed, creatureInfo is missing!");
750  return false;
751  }
752 
753  SetDisplayId(creature->GetDisplayId());
754 
755  if (CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cinfo->family))
756  SetName(cFamily->Name_lang);
757  else
758  SetName(creature->GetNameForLocaleIdx(sObjectMgr->GetDBCLocaleIndex()));
759 
760  return true;
761 }
std::string const & GetNameForLocaleIdx(LocaleConstant locale_idx) const override
Definition: Creature.cpp:2513
Map * GetMap() const
Definition: Object.h:543
uint32 GetDisplayId() const
Definition: Unit.h:2012
void SetDisplayId(uint32 modelId) override
Definition: Pet.cpp:1918
void SetName(std::string const &newname)
Definition: Object.h:480
#define sObjectMgr
Definition: ObjectMgr.h:1567
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
float GetOrientation() const
Definition: Position.h:107
void Relocate(float x, float y)
Definition: Position.h:67
float GetPositionY() const
Definition: Position.h:105
std::string ToString() const
Definition: Position.cpp:160
float GetPositionZ() const
Definition: Position.h:106
DBCStorage< CreatureFamilyEntry > sCreatureFamilyStore(CreatureFamilyfmt)
bool CreateBaseAtTamed(CreatureTemplate const *cinfo, Map *map)
Definition: Pet.cpp:776
ObjectGuid const & GetGUID() const
Definition: Object.h:105
#define ASSERT
Definition: Errors.h:55
uint32 family
Definition: Creature.h:112
uint32 GetEntry() const
Definition: Object.h:107
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
bool IsPositionValid() const
Definition: Position.cpp:40
float GetPositionX() const
Definition: Position.h:104
Definition: Creature.h:79
Definition: DBCStructure.h:279

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Pet::CreateBaseAtCreatureInfo ( CreatureTemplate const cinfo,
Unit owner 
)
764 {
765  if (!CreateBaseAtTamed(cinfo, owner->GetMap()))
766  return false;
767 
768  if (CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cinfo->family))
769  SetName(cFamily->Name_lang);
770 
771  Relocate(owner->GetPositionX(), owner->GetPositionY(), owner->GetPositionZ(), owner->GetOrientation());
772 
773  return true;
774 }
Map * GetMap() const
Definition: Object.h:543
void SetName(std::string const &newname)
Definition: Object.h:480
float GetOrientation() const
Definition: Position.h:107
void Relocate(float x, float y)
Definition: Position.h:67
float GetPositionY() const
Definition: Position.h:105
float GetPositionZ() const
Definition: Position.h:106
DBCStorage< CreatureFamilyEntry > sCreatureFamilyStore(CreatureFamilyfmt)
bool CreateBaseAtTamed(CreatureTemplate const *cinfo, Map *map)
Definition: Pet.cpp:776
float GetPositionX() const
Definition: Position.h:104
Definition: DBCStructure.h:279

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Pet::CreateBaseAtTamed ( CreatureTemplate const cinfo,
Map map 
)
777 {
778  TC_LOG_DEBUG("entities.pet", "Pet::CreateBaseForTamed");
779  if (!Create(map->GenerateLowGuid<HighGuid::Pet>(), map, cinfo->Entry))
780  return false;
781 
787 
788  if (cinfo->type == CREATURE_TYPE_BEAST)
789  {
795  }
796 
797  return true;
798 }
bool Create(ObjectGuid::LowType guidlow, Map *map, uint32 Entry)
Definition: Pet.cpp:1794
Definition: UpdateFields.h:128
Definition: Unit.h:234
Definition: UpdateFields.h:146
Definition: UpdateFields.h:96
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
Definition: UpdateFields.h:97
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: Unit.h:233
void setPowerType(Powers power)
Definition: Unit.cpp:6977
Definition: SharedDefines.h:250
void SetByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition: Object.cpp:1252
uint8 getLevel() const
Definition: Unit.h:1408
Definition: SharedDefines.h:167
Definition: UpdateFields.h:127
Definition: UpdateFields.h:126
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition: Object.cpp:1080
#define PET_XP_FACTOR
Definition: Pet.cpp:37
Definition: Unit.h:734
virtual void SetSheath(SheathState sheathed)
Definition: Unit.h:1463
Definition: Unit.h:322
Definition: SharedDefines.h:3554
Definition: Unit.h:321
Definition: UpdateFields.h:135
void SetUInt64Value(uint16 index, uint64 value)
Definition: Object.cpp:1017
uint32_t uint32
Definition: g3dmath.h:168
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:561
Definition: Unit.h:299
Definition: SharedDefines.h:95

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pet::DeleteFromDB ( uint32  guidlow)
static
487 {
489 
491  stmt->setUInt32(0, guidlow);
492  trans->Append(stmt);
493 
495  stmt->setUInt32(0, guidlow);
496  trans->Append(stmt);
497 
499  stmt->setUInt32(0, guidlow);
500  trans->Append(stmt);
501 
503  stmt->setUInt32(0, guidlow);
504  trans->Append(stmt);
505 
507  stmt->setUInt32(0, guidlow);
508  trans->Append(stmt);
509 
511  stmt->setUInt32(0, guidlow);
512  trans->Append(stmt);
513 
515  stmt->setUInt32(0, guidlow);
516  trans->Append(stmt);
517 
519 }
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
Definition: CharacterDatabase.h:533
Definition: CharacterDatabase.h:540
Definition: PreparedStatement.h:74
Definition: CharacterDatabase.h:560
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
Definition: CharacterDatabase.h:528
Definition: CharacterDatabase.h:529
Definition: CharacterDatabase.h:554
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: CharacterDatabase.h:530
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

void Pet::DeleteFromDB ( )
inlineoverrideprivatevirtual

Reimplemented from Creature.

168  {
169  ABORT();
170  }
#define ABORT
Definition: Errors.h:56

+ Here is the caller graph for this function:

uint32 Pet::GetCurrentFoodBenefitLevel ( uint32  itemlevel) const
1062 {
1063  // -5 or greater food level
1064  if (getLevel() <= itemlevel + 5) //possible to feed level 60 pet with level 55 level food for full effect
1065  return 35000;
1066  // -10..-6
1067  else if (getLevel() <= itemlevel + 10) //pure guess, but sounds good
1068  return 17000;
1069  // -14..-11
1070  else if (getLevel() <= itemlevel + 14) //level 55 food gets green on 70, makes sense to me
1071  return 8000;
1072  // -15 or less
1073  else
1074  return 0; //food too low level
1075 }
uint8 getLevel() const
Definition: Unit.h:1408

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

DeclinedName const* Pet::GetDeclinedNames ( ) const
inline
147 { return m_declinedname; }
DeclinedName * m_declinedname
Definition: Pet.h:160
int32 Pet::GetDuration ( ) const
inline
92 { return m_duration; }
int32 m_duration
Definition: Pet.h:155
uint8 Pet::GetFreeTalentPoints ( ) const
inline
138 { return GetByteValue(UNIT_FIELD_BYTES_1, 1); }
Definition: UpdateFields.h:124
uint8 GetByteValue(uint16 index, uint8 offset) const
Definition: Object.cpp:318

+ Here is the call graph for this function:

uint32 Pet::GetGroupUpdateFlag ( ) const
inline
143 { return m_groupUpdateMask; }
uint32 m_groupUpdateMask
Definition: Pet.h:158
uint8 Pet::GetMaxTalentPointsForLevel ( uint8  level) const
1721 {
1722  uint8 points = (level >= 20) ? ((level - 16) / 4) : 0;
1723  // Mod points from owner SPELL_AURA_MOD_PET_TALENT_POINTS
1724  points += GetOwner()->GetTotalAuraModifier(SPELL_AURA_MOD_PET_TALENT_POINTS);
1725  return points;
1726 }
Player * GetOwner() const
Definition: Pet.cpp:1913
Definition: SpellAuraDefines.h:205
uint8_t uint8
Definition: Define.h:152

+ Here is the call graph for this function:

Player * Pet::GetOwner ( ) const
1914 {
1915  return Minion::GetOwner()->ToPlayer();
1916 }
Player * ToPlayer()
Definition: Object.h:191
Unit * GetOwner() const
Definition: TemporarySummon.h:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 Pet::GetPetAutoSpellOnPos ( uint8  pos) const
inlineoverridevirtual

Reimplemented from Creature.

79  {
80  if (pos >= m_autospells.size())
81  return 0;
82  else
83  return m_autospells[pos];
84  }
AutoSpellList m_autospells
Definition: Pet.h:129
uint8 Pet::GetPetAutoSpellSize ( ) const
inlineoverridevirtual

Reimplemented from Creature.

77 { return uint8(m_autospells.size()); }
AutoSpellList m_autospells
Definition: Pet.h:129
uint8_t uint8
Definition: g3dmath.h:164
PetType Pet::getPetType ( ) const
inline
57 { return m_petType; }
PetType m_petType
Definition: Pet.h:154

+ Here is the caller graph for this function:

void Pet::GivePetLevel ( uint8  level)
715 {
716  if (!level || level == getLevel())
717  return;
718 
719  if (getPetType()==HUNTER_PET)
720  {
723  }
724 
725  InitStatsForLevel(level);
728 }
Definition: UpdateFields.h:128
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
void InitLevelupSpellsForLevel()
Definition: Pet.cpp:1439
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: PetDefines.h:25
uint8 getLevel() const
Definition: Unit.h:1408
Definition: UpdateFields.h:127
#define PET_XP_FACTOR
Definition: Pet.cpp:37
void InitTalentForLevel()
Definition: Pet.cpp:1704
bool InitStatsForLevel(uint8 level)
Definition: Pet.cpp:801
uint32_t uint32
Definition: g3dmath.h:168
PetType getPetType() const
Definition: Pet.h:57

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pet::GivePetXP ( uint32  xp)
678 {
679  if (getPetType() != HUNTER_PET)
680  return;
681 
682  if (xp < 1)
683  return;
684 
685  if (!IsAlive())
686  return;
687 
688  uint8 maxlevel = std::min((uint8)sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL), GetOwner()->getLevel());
689  uint8 petlevel = getLevel();
690 
691  // If pet is detected to be at, or above(?) the players level, don't hand out XP
692  if (petlevel >= maxlevel)
693  return;
694 
697  uint32 newXP = curXP + xp;
698 
699  // Check how much XP the pet should receive, and hand off have any left from previous levelups
700  while (newXP >= nextLvlXP && petlevel < maxlevel)
701  {
702  // Subtract newXP from amount needed for nextlevel, and give pet the level
703  newXP -= nextLvlXP;
704  ++petlevel;
705 
706  GivePetLevel(petlevel);
707 
709  }
710  // Not affected by special conditions - give it new XP
711  SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, petlevel < maxlevel ? newXP : 0);
712 }
Definition: UpdateFields.h:128
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
Player * GetOwner() const
Definition: Pet.cpp:1913
void GivePetLevel(uint8 level)
Definition: Pet.cpp:714
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
#define sWorld
Definition: World.h:887
Definition: PetDefines.h:25
uint8 getLevel() const
Definition: Unit.h:1408
T min(const T &x, const T &y)
Definition: g3dmath.h:305
Definition: UpdateFields.h:127
bool IsAlive() const
Definition: Unit.h:1692
uint32_t uint32
Definition: Define.h:150
uint8_t uint8
Definition: Define.h:152
Definition: World.h:235
PetType getPetType() const
Definition: Pet.h:57

+ Here is the call graph for this function:

bool Pet::HasSpell ( uint32  spell) const
overridevirtual

Reimplemented from Creature.

1815 {
1816  PetSpellMap::const_iterator itr = m_spells.find(spell);
1817  return itr != m_spells.end() && itr->second.state != PETSPELL_REMOVED;
1818 }
Definition: PetDefines.h:53
PetSpellMap m_spells
Definition: Pet.h:128

+ Here is the caller graph for this function:

bool Pet::HaveInDiet ( ItemTemplate const item) const
1044 {
1045  if (!item->FoodType)
1046  return false;
1047 
1048  CreatureTemplate const* cInfo = GetCreatureTemplate();
1049  if (!cInfo)
1050  return false;
1051 
1052  CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cInfo->family);
1053  if (!cFamily)
1054  return false;
1055 
1056  uint32 diet = cFamily->PetFoodMask;
1057  uint32 FoodMask = 1 << (item->FoodType-1);
1058  return (diet & FoodMask) != 0;
1059 }
uint32 PetFoodMask
Definition: DBCStructure.h:287
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
uint32_t uint32
Definition: Define.h:150
DBCStorage< CreatureFamilyEntry > sCreatureFamilyStore(CreatureFamilyfmt)
uint32 family
Definition: Creature.h:112
Definition: Creature.h:79
Definition: DBCStructure.h:279

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pet::InitLevelupSpellsForLevel ( )
1440 {
1441  uint8 level = getLevel();
1442 
1443  if (PetLevelupSpellSet const* levelupSpells = GetCreatureTemplate()->family ? sSpellMgr->GetPetLevelupSpellList(GetCreatureTemplate()->family) : NULL)
1444  {
1445  // PetLevelupSpellSet ordered by levels, process in reversed order
1446  for (PetLevelupSpellSet::const_reverse_iterator itr = levelupSpells->rbegin(); itr != levelupSpells->rend(); ++itr)
1447  {
1448  // will called first if level down
1449  if (itr->first > level)
1450  unlearnSpell(itr->second, true); // will learn prev rank if any
1451  // will called if level up
1452  else
1453  learnSpell(itr->second); // will unlearn prev rank if any
1454  }
1455  }
1456 
1457  // default spells (can be not learned if pet level (as owner level decrease result for example) less first possible in normal game)
1458  if (PetDefaultSpellsEntry const* defSpells = sSpellMgr->GetPetDefaultSpellsEntry(int32(GetEntry())))
1459  {
1460  for (uint8 i = 0; i < MAX_CREATURE_SPELL_DATA_SLOT; ++i)
1461  {
1462  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(defSpells->spellid[i]);
1463  if (!spellInfo)
1464  continue;
1465 
1466  // will called first if level down
1467  if (spellInfo->SpellLevel > level)
1468  unlearnSpell(spellInfo->Id, true);
1469  // will called if level up
1470  else
1471  learnSpell(spellInfo->Id);
1472  }
1473  }
1474 }
uint32 Id
Definition: SpellInfo.h:329
#define MAX_CREATURE_SPELL_DATA_SLOT
Definition: SpellMgr.h:559
uint32 SpellLevel
Definition: SpellInfo.h:375
Definition: SpellInfo.h:326
arena_t NULL
Definition: jemalloc_internal.h:624
uint8 getLevel() const
Definition: Unit.h:1408
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
#define sSpellMgr
Definition: SpellMgr.h:756
int32_t int32
Definition: Define.h:146
std::multimap< uint32, uint32 > PetLevelupSpellSet
Definition: SpellMgr.h:554
bool learnSpell(uint32 spell_id)
Definition: Pet.cpp:1423
bool unlearnSpell(uint32 spell_id, bool learn_prev, bool clear_ab=true)
Definition: Pet.cpp:1476
uint8_t uint8
Definition: Define.h:152
uint32 GetEntry() const
Definition: Object.h:107
Definition: SpellMgr.h:561

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pet::InitPetCreateSpells ( )
1542 {
1544  m_spells.clear();
1545 
1546  LearnPetPassives();
1548 
1549  CastPetAuras(false);
1550 }
CharmInfo * m_charmInfo
Definition: Unit.h:2292
void InitLevelupSpellsForLevel()
Definition: Pet.cpp:1439
void InitPetActionBar()
Definition: Unit.cpp:11877
void CastPetAuras(bool current)
Definition: Pet.cpp:1842
void LearnPetPassives()
Definition: Pet.cpp:1821
PetSpellMap m_spells
Definition: Pet.h:128

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pet::InitTalentForLevel ( )
1705 {
1706  /* TODO: 6.x remove/update pet talents
1707  uint8 level = getLevel();
1708  uint32 talentPointsForLevel = GetMaxTalentPointsForLevel(level);
1709  // Reset talents in case low level (on level down) or wrong points for level (hunter can unlearn TP increase talent)
1710  if (talentPointsForLevel == 0 || m_usedTalentCount > talentPointsForLevel)
1711  resetTalents(); // Remove all talent points
1712 
1713  SetFreeTalentPoints(talentPointsForLevel - m_usedTalentCount);
1714 
1715  if (!m_loading)
1716  GetOwner()->SendTalentsInfoData(true);
1717  */
1718 }

+ Here is the caller graph for this function:

bool Pet::isControlled ( ) const
inline
59 { return getPetType() == SUMMON_PET || getPetType() == HUNTER_PET; }
Definition: PetDefines.h:24
Definition: PetDefines.h:25
PetType getPetType() const
Definition: Pet.h:57

+ Here is the caller graph for this function:

bool Pet::IsLoading ( ) const
inlineoverridevirtual

Reimplemented from Unit.

69 { return m_loading;}
bool m_loading
Definition: Pet.h:156
bool Pet::IsPermanentPetFor ( Player owner) const
1772 {
1773  switch (getPetType())
1774  {
1775  case SUMMON_PET:
1776  switch (owner->getClass())
1777  {
1778  case CLASS_WARLOCK:
1780  case CLASS_DEATH_KNIGHT:
1782  case CLASS_MAGE:
1784  default:
1785  return false;
1786  }
1787  case HUNTER_PET:
1788  return true;
1789  default:
1790  return false;
1791  }
1792 }
Definition: PetDefines.h:24
Definition: SharedDefines.h:172
Definition: SharedDefines.h:3556
Definition: SharedDefines.h:3559
Definition: PetDefines.h:25
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
Definition: SharedDefines.h:174
Definition: SharedDefines.h:175
uint32 type
Definition: Creature.h:116
PetType getPetType() const
Definition: Pet.h:57
Definition: SharedDefines.h:3557

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Pet::IsPetAura ( Aura const aura)
1877 {
1878  Player* owner = GetOwner();
1879 
1880  // if the owner has that pet aura, return true
1881  for (PetAuraSet::const_iterator itr = owner->m_petAuras.begin(); itr != owner->m_petAuras.end(); ++itr)
1882  {
1883  if ((*itr)->GetAura(GetEntry()) == aura->GetId())
1884  return true;
1885  }
1886  return false;
1887 }
Player * GetOwner() const
Definition: Pet.cpp:1913
uint32 GetEntry() const
Definition: Object.h:107

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Pet::isTemporarySummoned ( ) const
inline
60 { return m_duration > 0; }
int32 m_duration
Definition: Pet.h:155

+ Here is the caller graph for this function:

void Pet::LearnPetPassives ( )
1822 {
1823  CreatureTemplate const* cInfo = GetCreatureTemplate();
1824  if (!cInfo)
1825  return;
1826 
1827  CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cInfo->family);
1828  if (!cFamily)
1829  return;
1830 
1831  PetFamilySpellsStore::const_iterator petStore = sPetFamilySpellsStore.find(cFamily->ID);
1832  if (petStore != sPetFamilySpellsStore.end())
1833  {
1834  // For general hunter pets skill 270
1835  // Passive 01~10, Passive 00 (20782, not used), Ferocious Inspiration (34457)
1836  // Scale 01~03 (34902~34904, bonus from owner, not used)
1837  for (PetFamilySpellsSet::const_iterator petSet = petStore->second.begin(); petSet != petStore->second.end(); ++petSet)
1839  }
1840 }
uint32 ID
Definition: DBCStructure.h:281
Definition: PetDefines.h:52
Definition: Unit.h:1124
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
DBCStorage< CreatureFamilyEntry > sCreatureFamilyStore(CreatureFamilyfmt)
PetFamilySpellsStore sPetFamilySpellsStore
Definition: SpellMgr.cpp:31
Definition: PetDefines.h:59
bool addSpell(uint32 spellId, ActiveStates active=ACT_DECIDE, PetSpellState state=PETSPELL_NEW, PetSpellType type=PETSPELL_NORMAL)
Definition: Pet.cpp:1317
uint32 family
Definition: Creature.h:112
Definition: Creature.h:79
Definition: DBCStructure.h:279

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Pet::learnSpell ( uint32  spell_id)
1424 {
1425  // prevent duplicated entires in spell book
1426  if (!addSpell(spell_id))
1427  return false;
1428 
1429  if (!m_loading)
1430  {
1432  packet.Spells.push_back(spell_id);
1433  GetOwner()->GetSession()->SendPacket(packet.Write());
1434  GetOwner()->PetSpellInitialize();
1435  }
1436  return true;
1437 }
Player * GetOwner() const
Definition: Pet.cpp:1913
std::vector< uint32 > Spells
Definition: PetPackets.h:147
bool m_loading
Definition: Pet.h:156
Definition: PetPackets.h:140
WorldPacket const * Write() override
Definition: PetPackets.cpp:79
bool addSpell(uint32 spellId, ActiveStates active=ACT_DECIDE, PetSpellState state=PETSPELL_NEW, PetSpellType type=PETSPELL_NORMAL)
Definition: Pet.cpp:1317

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pet::learnSpellHighRank ( uint32  spellid)
1890 {
1891  learnSpell(spellid);
1892 
1893  if (uint32 next = sSpellMgr->GetNextSpellInChain(spellid))
1895 }
void learnSpellHighRank(uint32 spellid)
Definition: Pet.cpp:1889
int next(int i, int n)
Definition: RecastContour.cpp:469
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
bool learnSpell(uint32 spell_id)
Definition: Pet.cpp:1423

+ Here is the call graph for this function:

bool Pet::LoadPetFromDB ( Player owner,
uint32  petentry = 0,
uint32  petnumber = 0,
bool  current = false 
)
Todo:
pets should be summoned from real cast instead of just faking it?
100 {
101  m_loading = true;
102 
103  ObjectGuid::LowType ownerid = owner->GetGUID().GetCounter();
104 
105  PreparedStatement* stmt;
106  PreparedQueryResult result;
107 
108  if (petnumber)
109  {
110  // Known petnumber entry
112  stmt->setUInt64(0, ownerid);
113  stmt->setUInt32(1, petnumber);
114  }
115  else if (current)
116  {
117  // Current pet (slot 0)
119  stmt->setUInt64(0, ownerid);
121  }
122  else if (petEntry)
123  {
124  // known petEntry entry (unique for summoned pet, but non unique for hunter pet (only from current or not stabled pets)
126  stmt->setUInt64(0, ownerid);
127  stmt->setUInt32(1, petEntry);
130  }
131  else
132  {
133  // Any current or other non-stabled pet (for hunter "call pet")
135  stmt->setUInt64(0, ownerid);
138  }
139 
140  result = CharacterDatabase.Query(stmt);
141 
142  if (!result)
143  {
144  m_loading = false;
145  return false;
146  }
147 
148  Field* fields = result->Fetch();
149 
150  // update for case of current pet "slot = 0"
151  petEntry = fields[1].GetUInt32();
152  if (!petEntry)
153  return false;
154 
155  uint32 summonSpellId = fields[14].GetUInt32();
156  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(summonSpellId);
157 
158  bool isTemporarySummon = spellInfo && spellInfo->GetDuration() > 0;
159  if (current && isTemporarySummon)
160  return false;
161 
162  PetType petType = PetType(fields[15].GetUInt8());
163  if (petType == HUNTER_PET)
164  {
165  CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(petEntry);
166  if (!creatureInfo || !creatureInfo->IsTameable(owner->CanTameExoticPets()))
167  return false;
168  }
169 
170  uint32 petId = fields[0].GetUInt32();
171 
172  if (current && owner->IsPetNeedBeTemporaryUnsummoned())
173  {
174  owner->SetTemporaryUnsummonedPetNumber(petId);
175  return false;
176  }
177 
178  Map* map = owner->GetMap();
179  if (!Create(map->GenerateLowGuid<HighGuid::Pet>(), map, petEntry))
180  return false;
181 
182  CopyPhaseFrom(owner);
183 
184  setPetType(petType);
185  setFaction(owner->getFaction());
186  SetUInt32Value(UNIT_CREATED_BY_SPELL, summonSpellId);
187 
188  if (IsCritter())
189  {
190  float px, py, pz;
191  owner->GetClosePoint(px, py, pz, GetObjectSize(), PET_FOLLOW_DIST, GetFollowAngle());
192  Relocate(px, py, pz, owner->GetOrientation());
193 
194  if (!IsPositionValid())
195  {
196  TC_LOG_ERROR("entities.pet", "Pet (%s, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)",
197  GetGUID().ToString().c_str(), GetEntry(), GetPositionX(), GetPositionY());
198  return false;
199  }
200 
201  map->AddToMap(this->ToCreature());
202  return true;
203  }
204 
206 
207  SetDisplayId(fields[3].GetUInt32());
208  SetNativeDisplayId(fields[3].GetUInt32());
209  uint32 petlevel = fields[4].GetUInt16();
211  SetName(fields[8].GetString());
212 
213  switch (getPetType())
214  {
215  case SUMMON_PET:
216  petlevel = owner->getLevel();
218  SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); // this enables popup window (pet dismiss, cancel)
219  break;
220  case HUNTER_PET:
225  SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); // this enables popup window (pet abandon, cancel)
227  break;
228  default:
229  if (!IsPetGhoul())
230  TC_LOG_ERROR("entities.pet", "Pet have incorrect type (%u) for pet loading.", getPetType());
231  break;
232  }
233 
234  SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped here
235  SetCreatorGUID(owner->GetGUID());
236 
237  InitStatsForLevel(petlevel);
238  SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, fields[5].GetUInt32());
239 
241 
242  // Set pet's position after setting level, its size depends on it
243  float px, py, pz;
244  owner->GetClosePoint(px, py, pz, GetObjectSize(), PET_FOLLOW_DIST, GetFollowAngle());
245  Relocate(px, py, pz, owner->GetOrientation());
246  if (!IsPositionValid())
247  {
248  TC_LOG_ERROR("entities.pet", "Pet (%s, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)",
249  GetGUID().ToString().c_str(), GetEntry(), GetPositionX(), GetPositionY());
250  return false;
251  }
252 
253  SetReactState(ReactStates(fields[6].GetUInt8()));
254  SetCanModifyStats(true);
255 
256  if (getPetType() == SUMMON_PET && !current) //all (?) summon pets come with full health when called, but not when they are current
258  else
259  {
260  uint32 savedhealth = fields[10].GetUInt32();
261  uint32 savedmana = fields[11].GetUInt32();
262  if (!savedhealth && getPetType() == HUNTER_PET)
264  else
265  {
266  SetHealth(savedhealth > GetMaxHealth() ? GetMaxHealth() : savedhealth);
267  SetPower(POWER_MANA, savedmana > uint32(GetMaxPower(POWER_MANA)) ? GetMaxPower(POWER_MANA) : savedmana);
268  }
269  }
270 
271  // set current pet as current
272  // 0=current
273  // 1..MAX_PET_STABLES in stable slot
274  // PET_SAVE_NOT_IN_SLOT(100) = not stable slot (summoning))
275  if (fields[7].GetUInt8())
276  {
278 
281  stmt->setUInt64(1, ownerid);
283  stmt->setUInt32(3, m_charmInfo->GetPetNumber());
284  trans->Append(stmt);
285 
288  stmt->setUInt64(1, ownerid);
289  stmt->setUInt32(2, m_charmInfo->GetPetNumber());
290  trans->Append(stmt);
291 
293  }
294 
295  // Send fake summon spell cast - this is needed for correct cooldown application for spells
296  // Example: 46584 - without this cooldown (which should be set always when pet is loaded) isn't set clientside
298  if (summonSpellId)
299  {
301  WorldPackets::Spells::SpellCastData& castData = spellGo.Cast;
302 
303  castData.CasterGUID = owner->GetGUID();
304  castData.CasterUnit = owner->GetGUID();
305  castData.SpellID = summonSpellId;
306  castData.CastFlags = CAST_FLAG_UNKNOWN_9;
307  castData.CastTime = getMSTime();
308 
309  owner->SendMessageToSet(spellGo.Write(), true);
310  }
311 
312  owner->SetMinion(this, true);
313  map->AddToMap(this->ToCreature());
314 
315  InitTalentForLevel(); // set original talents points before spell loading
316 
317  uint32 timediff = uint32(time(NULL) - fields[13].GetUInt32());
318  _LoadAuras(timediff);
319 
320  // load action bar, if data broken will fill later by default spells.
321  if (!isTemporarySummon)
322  {
323  m_charmInfo->LoadPetActionBar(fields[12].GetString());
324 
325  _LoadSpells();
326  InitTalentForLevel(); // re-init to check talent count
330  CastPetAuras(current);
331  }
332 
333  CleanupActionBar(); // remove unknown spells from action bar after load
334 
335  TC_LOG_DEBUG("entities.pet", "New Pet has %s", GetGUID().ToString().c_str());
336 
337  owner->PetSpellInitialize();
338 
340 
341  // TODO: 6.x remove/update pet talents
342  //owner->SendTalentsInfoData(true);
343 
344  if (getPetType() == HUNTER_PET)
345  {
347  stmt->setUInt64(0, owner->GetGUID().GetCounter());
348  stmt->setUInt32(1, GetCharmInfo()->GetPetNumber());
349  result = CharacterDatabase.Query(stmt);
350 
351  if (result)
352  {
353  delete m_declinedname;
355  Field* fields2 = result->Fetch();
356  for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
357  {
358  m_declinedname->name[i] = fields2[i].GetString();
359  }
360  }
361  }
362 
363  //set last used pet number (for use in BG's)
364  if (owner->GetTypeId() == TYPEID_PLAYER && isControlled() && !isTemporarySummoned() && (getPetType() == SUMMON_PET || getPetType() == HUNTER_PET))
365  owner->ToPlayer()->SetLastPetNumber(petId);
366 
367  m_loading = false;
368 
369  return true;
370 }
bool Create(ObjectGuid::LowType guidlow, Map *map, uint32 Entry)
Definition: Pet.cpp:1794
Definition: Spell.h:60
Definition: PetDefines.h:24
bool IsPetGhoul() const
Definition: TemporarySummon.h:75
Definition: Unit.h:234
void SetPetNumber(uint32 petnumber, bool statwindow)
Definition: Unit.cpp:12048
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
uint32 GetMaxHealth() const
Definition: Unit.h:1427
Definition: UpdateFields.h:146
uint32 CastTime
Definition: SpellPackets.h:348
Definition: UpdateFields.h:96
void SetDisplayId(uint32 modelId) override
Definition: Pet.cpp:1918
Definition: SpellInfo.h:326
void _LoadSpells()
Definition: Pet.cpp:1090
Definition: Unit.h:542
uint32 CastFlags
Definition: SpellPackets.h:346
Definition: CharacterDatabase.h:553
Class used to access individual fields of database query result.
Definition: Field.h:56
WorldPacket const * Write() override
Definition: SpellPackets.cpp:406
Definition: UpdateFields.h:134
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
CharmInfo * m_charmInfo
Definition: Unit.h:2292
uint32 getMSTime()
Definition: Timer.h:24
void setPetType(PetType type)
Definition: Pet.h:58
int32 SpellID
Definition: SpellPackets.h:344
void SynchronizeLevelWithOwner()
Definition: Pet.cpp:1897
void SetCanModifyStats(bool modifyStats)
Definition: Unit.h:1960
arena_t NULL
Definition: jemalloc_internal.h:624
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
void _LoadSpellCooldowns()
Definition: Pet.cpp:1077
void CopyPhaseFrom(WorldObject *obj, bool update=false)
Definition: Object.cpp:2915
void SetNativeDisplayId(uint32 modelId)
Definition: Unit.h:2016
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
void InitLevelupSpellsForLevel()
Definition: Pet.cpp:1439
#define MAX_DECLINED_NAME_CASES
Definition: Unit.h:1099
void SetName(std::string const &newname)
Definition: Object.h:480
bool m_loading
Definition: Pet.h:156
uint64 LowType
Definition: ObjectGuid.h:199
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: PreparedStatement.h:74
CharmInfo * GetCharmInfo()
Definition: Unit.h:1748
Definition: Unit.h:233
void setPowerType(Powers power)
Definition: Unit.cpp:6977
void setDeathState(DeathState s) override
Definition: Pet.cpp:521
Definition: PetDefines.h:25
Definition: SharedDefines.h:250
void SetByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition: Object.cpp:1252
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
Definition: SharedDefines.h:167
int32 GetDuration() const
Definition: SpellInfo.cpp:2490
void setFaction(uint32 faction)
Definition: Unit.h:1467
Definition: PetDefines.h:35
bool IsPermanentPetFor(Player *owner) const
Definition: Pet.cpp:1771
Definition: CharacterDatabase.h:552
Definition: CharacterDatabase.h:559
void Relocate(float x, float y)
Definition: Position.h:67
Definition: SpellPackets.h:363
Definition: Group.h:140
Definition: UpdateFields.h:127
bool isTemporarySummoned() const
Definition: Pet.h:60
Definition: UpdateFields.h:126
uint32 GetPetNumber() const
Definition: Unit.h:1207
Definition: CharacterDatabase.h:557
void CastPetAuras(bool current)
Definition: Pet.cpp:1842
float GetPositionY() const
Definition: Position.h:105
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition: Object.cpp:1080
std::string ToString() const
Definition: Position.cpp:160
void LoadPetActionBar(const std::string &data)
Definition: Unit.cpp:12057
bool isControlled() const
Definition: Pet.h:59
bool AddToMap(T *)
Definition: Map.cpp:566
void _LoadAuras(uint32 timediff)
Definition: Pet.cpp:1157
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
void LearnPetPassives()
Definition: Pet.cpp:1821
SpellCastData Cast
Definition: SpellPackets.h:371
Definition: CharacterDatabase.h:527
uint16 GetUInt16() const
Definition: Field.h:108
Definition: CharacterDatabase.h:543
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Definition: Unit.h:734
virtual void SetSheath(SheathState sheathed)
Definition: Unit.h:1463
Definition: Map.h:259
ReactStates
Definition: Unit.h:1127
Definition: SharedDefines.h:174
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
void InitTalentForLevel()
Definition: Pet.cpp:1704
Definition: Unit.h:676
void SetPower(Powers power, int32 val)
Definition: Unit.cpp:11607
Definition: Unit.h:322
uint8_t uint8
Definition: g3dmath.h:164
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: ObjectGuid.h:33
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
Definition: UpdateFields.h:109
bool IsCritter() const
Definition: Unit.h:1580
Creature * ToCreature()
Definition: Object.h:194
ObjectGuid CasterUnit
Definition: SpellPackets.h:342
Definition: CharacterDatabase.h:551
uint32 GetUInt32() const
Definition: Field.h:146
Definition: PetDefines.h:38
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
void SetGroupUpdateFlag(uint32 flag)
Definition: Pet.cpp:1928
uint8_t uint8
Definition: Define.h:152
void SetCreatorGUID(ObjectGuid creator)
Definition: Unit.h:1701
float GetFollowAngle() const override
Definition: TemporarySummon.h:73
Definition: Unit.h:321
Definition: UpdateFields.h:135
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
bool InitStatsForLevel(uint8 level)
Definition: Pet.cpp:801
int32 GetMaxPower(Powers power) const
Definition: Unit.cpp:11598
#define PET_FOLLOW_DIST
Definition: PetDefines.h:77
uint32 GetEntry() const
Definition: Object.h:107
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
void SetUInt64Value(uint16 index, uint64 value)
Definition: Object.cpp:1017
bool IsPositionValid() const
Definition: Position.cpp:40
uint32_t uint32
Definition: g3dmath.h:168
void SetHealth(uint32 val)
Definition: Unit.cpp:11537
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:561
Definition: Unit.h:1101
float GetPositionX() const
Definition: Position.h:104
Definition: Unit.h:299
Definition: SpellPackets.h:339
std::string GetString() const
Definition: Field.h:276
float GetObjectSize() const
Definition: Object.cpp:2656
bool IsTameable(bool canTameExotic) const
Definition: Creature.h:167
void SetReactState(ReactStates st)
Definition: Creature.h:502
void CleanupActionBar()
Definition: Pet.cpp:1525
std::string name[MAX_DECLINED_NAME_CASES]
Definition: Unit.h:1103
PetType
Definition: PetDefines.h:22
Definition: PetDefines.h:37
Definition: Creature.h:79
ObjectGuid CasterGUID
Definition: SpellPackets.h:341
PetType getPetType() const
Definition: Pet.h:57
Definition: SharedDefines.h:248
Definition: SharedDefines.h:95
DeclinedName * m_declinedname
Definition: Pet.h:160
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the caller graph for this function:

void Pet::Remove ( PetSaveMode  mode,
bool  returnreagent = false 
)
673 {
674  GetOwner()->RemovePet(this, mode, returnreagent);
675 }
Player * GetOwner() const
Definition: Pet.cpp:1913

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pet::RemoveFromWorld ( )
overridevirtual
  • Remove the pet from the accessor
  • Don't call the function for Creature, normal mobs + totems go in a different storage

Reimplemented from Minion.

89 {
91  if (IsInWorld())
92  {
96  }
97 }
void RemoveFromWorld() override
Definition: Unit.cpp:11733
Map * GetMap() const
Definition: Object.h:543
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:466
ObjectGuid const & GetGUID() const
Definition: Object.h:105
bool Remove(KEY_TYPE const &handle)
Definition: TypeContainer.h:125
bool IsInWorld() const
Definition: Object.h:100
Definition: Pet.h:46

+ Here is the call graph for this function:

bool Pet::removeSpell ( uint32  spell_id,
bool  learn_prev,
bool  clear_ab = true 
)
1492 {
1493  PetSpellMap::iterator itr = m_spells.find(spell_id);
1494  if (itr == m_spells.end())
1495  return false;
1496 
1497  if (itr->second.state == PETSPELL_REMOVED)
1498  return false;
1499 
1500  if (itr->second.state == PETSPELL_NEW)
1501  m_spells.erase(itr);
1502  else
1503  itr->second.state = PETSPELL_REMOVED;
1504 
1505  RemoveAurasDueToSpell(spell_id);
1506 
1507  if (learn_prev)
1508  {
1509  if (uint32 prev_id = sSpellMgr->GetPrevSpellInChain (spell_id))
1510  learnSpell(prev_id);
1511  else
1512  learn_prev = false;
1513  }
1514 
1515  // if remove last rank or non-ranked then update action bar at server and client if need
1516  if (clear_ab && !learn_prev && m_charmInfo->RemoveSpellFromActionBar(spell_id))
1517  {
1518  if (!m_loading)
1519  GetOwner()->PetSpellInitialize(); // need update action bar for last removed rank
1520  }
1521 
1522  return true;
1523 }
Player * GetOwner() const
Definition: Pet.cpp:1913
Definition: PetDefines.h:52
CharmInfo * m_charmInfo
Definition: Unit.h:2292
bool m_loading
Definition: Pet.h:156
bool RemoveSpellFromActionBar(uint32 spell_id)
Definition: Unit.cpp:12019
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
Definition: PetDefines.h:53
PetSpellMap m_spells
Definition: Pet.h:128
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3586
bool learnSpell(uint32 spell_id)
Definition: Pet.cpp:1423

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pet::ResetGroupUpdateFlag ( )
1938 {
1940  if (GetOwner()->GetGroup())
1941  GetOwner()->RemoveGroupUpdateFlag(GROUP_UPDATE_FLAG_PET);
1942 }
Player * GetOwner() const
Definition: Pet.cpp:1913
uint32 m_groupUpdateMask
Definition: Pet.h:158
Definition: Group.h:119
Definition: Group.h:132

+ Here is the call graph for this function:

bool Pet::resetTalents ( )
1553 {
1554  /* TODO: 6.x remove pet talents
1555  Player* player = GetOwner();
1556 
1557  // not need after this call
1558  if (player->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
1559  player->RemoveAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS, true);
1560 
1561  CreatureTemplate const* ci = GetCreatureTemplate();
1562  if (!ci)
1563  return false;
1564  // Check pet talent type
1565  CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(ci->family);
1566  if (!pet_family || pet_family->PetTalentType < 0)
1567  return false;
1568 
1569  uint8 level = getLevel();
1570  uint32 talentPointsForLevel = GetMaxTalentPointsForLevel(level);
1571 
1572  if (m_usedTalentCount == 0)
1573  {
1574  SetFreeTalentPoints(talentPointsForLevel);
1575  return false;
1576  }
1577 
1578  for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i)
1579  {
1580  TalentEntry const* talentInfo = sTalentStore.LookupEntry(i);
1581 
1582  if (!talentInfo)
1583  continue;
1584 
1585  TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab);
1586 
1587  if (!talentTabInfo)
1588  continue;
1589 
1590  // unlearn only talents for pets family talent type
1591  if (!((1 << pet_family->PetTalentType) & talentTabInfo->petTalentMask))
1592  continue;
1593 
1594  for (uint8 j = 0; j < MAX_TALENT_RANK; ++j)
1595  {
1596  for (PetSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end();)
1597  {
1598  if (itr->second.state == PETSPELL_REMOVED)
1599  {
1600  ++itr;
1601  continue;
1602  }
1603  // remove learned spells (all ranks)
1604  uint32 itrFirstId = sSpellMgr->GetFirstSpellInChain(itr->first);
1605 
1606  // unlearn if first rank is talent or learned by talent
1607  if (itrFirstId == talentInfo->RankID[j] || sSpellMgr->IsSpellLearnToSpell(talentInfo->RankID[j], itrFirstId))
1608  {
1609  unlearnSpell(itr->first, false);
1610  itr = m_spells.begin();
1611  continue;
1612  }
1613  else
1614  ++itr;
1615  }
1616  }
1617  }
1618 
1619  SetFreeTalentPoints(talentPointsForLevel);
1620 
1621  if (!m_loading)
1622  player->PetSpellInitialize();*/
1623  return true;
1624 }
void Pet::resetTalentsForAllPetsOf ( Player owner,
Pet online_pet = nullptr 
)
static
1627 {
1628  /* TODO: 6.x remove pet talents
1629  // not need after this call
1630  if (owner->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
1631  owner->RemoveAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS, true);
1632 
1633  // reset for online
1634  if (onlinePet)
1635  onlinePet->resetTalents();
1636 
1637  // now need only reset for offline pets (all pets except online case)
1638  uint32 exceptPetNumber = onlinePet ? onlinePet->GetCharmInfo()->GetPetNumber() : 0;
1639 
1640  PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PET);
1641  stmt->setUInt64(0, owner->GetGUID().GetCounter());
1642  stmt->setUInt32(1, exceptPetNumber);
1643  PreparedQueryResult resultPets = CharacterDatabase.Query(stmt);
1644 
1645  // no offline pets
1646  if (!resultPets)
1647  return;
1648 
1649  stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SPELL_LIST);
1650  stmt->setUInt64(0, owner->GetGUID().GetCounter());
1651  stmt->setUInt32(1, exceptPetNumber);
1652  PreparedQueryResult result = CharacterDatabase.Query(stmt);
1653 
1654  if (!result)
1655  return;
1656 
1657  bool need_comma = false;
1658  std::ostringstream ss;
1659  ss << "DELETE FROM pet_spell WHERE guid IN (";
1660 
1661  do
1662  {
1663  Field* fields = resultPets->Fetch();
1664 
1665  uint32 id = fields[0].GetUInt32();
1666 
1667  if (need_comma)
1668  ss << ',';
1669 
1670  ss << id;
1671 
1672  need_comma = true;
1673  } while (resultPets->NextRow());
1674 
1675  ss << ") AND spell IN (";
1676 
1677  bool need_execute = false;
1678  do
1679  {
1680  Field* fields = result->Fetch();
1681 
1682  uint32 spell = fields[0].GetUInt32();
1683 
1684  if (!GetTalentSpellCost(spell))
1685  continue;
1686 
1687  if (need_execute)
1688  ss << ',';
1689 
1690  ss << spell;
1691 
1692  need_execute = true;
1693  }
1694  while (result->NextRow());
1695 
1696  if (!need_execute)
1697  return;
1698 
1699  ss << ')';
1700 
1701  CharacterDatabase.Execute(ss.str().c_str());*/
1702 }

+ Here is the caller graph for this function:

void Pet::SavePetToDB ( PetSaveMode  mode)
373 {
374  if (!GetEntry())
375  return;
376 
377  // save only fully controlled creature
378  if (!isControlled())
379  return;
380 
381  // not save not player pets
382  if (!GetOwnerGUID().IsPlayer())
383  return;
384 
385  Player* owner = GetOwner();
386 
387  // not save pet as current if another pet temporary unsummoned
388  if (mode == PET_SAVE_AS_CURRENT && owner->GetTemporaryUnsummonedPetNumber() &&
389  owner->GetTemporaryUnsummonedPetNumber() != m_charmInfo->GetPetNumber())
390  {
391  // pet will lost anyway at restore temporary unsummoned
392  if (getPetType() == HUNTER_PET)
393  return;
394 
395  // for warlock case
396  mode = PET_SAVE_NOT_IN_SLOT;
397  }
398 
399  uint32 curhealth = GetHealth();
400  uint32 curmana = GetPower(POWER_MANA);
401 
403  // save auras before possibly removing them
404  _SaveAuras(trans);
405 
406  // stable and not in slot saves
407  if (mode > PET_SAVE_AS_CURRENT)
408  RemoveAllAuras();
409 
410  _SaveSpells(trans);
411  GetSpellHistory()->SaveToDB<Pet>(trans);
413 
414  // current/stable/not_in_slot
415  if (mode >= PET_SAVE_AS_CURRENT)
416  {
417  ObjectGuid::LowType ownerLowGUID = GetOwnerGUID().GetCounter();
418  std::string name = m_name;
421  // remove current data
422 
424  stmt->setUInt32(0, m_charmInfo->GetPetNumber());
425  trans->Append(stmt);
426 
427  // prevent duplicate using slot (except PET_SAVE_NOT_IN_SLOT)
428  if (mode <= PET_SAVE_LAST_STABLE_SLOT)
429  {
432  stmt->setUInt64(1, ownerLowGUID);
433  stmt->setUInt8(2, uint8(mode));
434  trans->Append(stmt);
435  }
436 
437  // prevent existence another hunter pet in PET_SAVE_AS_CURRENT and PET_SAVE_NOT_IN_SLOT
438  if (getPetType() == HUNTER_PET && (mode == PET_SAVE_AS_CURRENT || mode > PET_SAVE_LAST_STABLE_SLOT))
439  {
441  stmt->setUInt64(0, ownerLowGUID);
444  trans->Append(stmt);
445  }
446 
447  // save pet
448  std::ostringstream ss;
449  ss << "INSERT INTO character_pet (id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, CreatedBySpell, PetType) "
450  << "VALUES ("
451  << m_charmInfo->GetPetNumber() << ','
452  << GetEntry() << ','
453  << ownerLowGUID << ','
454  << GetNativeDisplayId() << ','
455  << uint32(getLevel()) << ','
457  << uint32(GetReactState()) << ','
458  << uint32(mode) << ", '"
459  << name.c_str() << "', "
461  << curhealth << ','
462  << curmana << ", '";
463 
465  {
466  ss << uint32(m_charmInfo->GetActionBarEntry(i)->GetType()) << ' '
467  << uint32(m_charmInfo->GetActionBarEntry(i)->GetAction()) << ' ';
468  };
469 
470  ss << "', "
471  << time(NULL) << ','
473  << uint32(getPetType()) << ')';
474 
475  trans->Append(ss.str().c_str());
477  }
478  // delete
479  else
480  {
481  RemoveAllAuras();
483  }
484 }
Definition: CharacterDatabase.h:558
void RemoveAllAuras()
Definition: Unit.cpp:3920
void DeleteFromDB() override
Definition: Pet.h:167
uint32 GetAction() const
Definition: Unit.h:1156
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
Definition: UpdateFields.h:146
Player * GetOwner() const
Definition: Pet.cpp:1913
ActiveStates GetType() const
Definition: Unit.h:1155
void _SaveAuras(SQLTransaction &trans)
Definition: Pet.cpp:1260
std::string m_name
Definition: Object.h:624
Definition: UpdateFields.h:134
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
CharmInfo * m_charmInfo
Definition: Unit.h:2292
bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const
Definition: Object.cpp:1298
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Unit.h:1196
UnitActionBarEntry const * GetActionBarEntry(uint8 index) const
Definition: Unit.h:1229
int32 GetPower(Powers power) const
Definition: Unit.cpp:11589
uint64 LowType
Definition: ObjectGuid.h:199
Definition: PreparedStatement.h:74
Definition: PetDefines.h:25
Definition: CharacterDatabase.h:560
uint8 getLevel() const
Definition: Unit.h:1408
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
Definition: PetDefines.h:35
SpellHistory * GetSpellHistory()
Definition: Unit.h:1926
Definition: UpdateFields.h:127
uint32 GetPetNumber() const
Definition: Unit.h:1207
void SaveToDB(SQLTransaction &trans)
Definition: SpellHistory.cpp:167
bool isControlled() const
Definition: Pet.h:59
uint32_t uint32
Definition: Define.h:150
void EscapeString(std::string &str)
Apply escape string'ing for current collation. (utf8)
Definition: DatabaseWorkerPool.cpp:231
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
uint8_t uint8
Definition: g3dmath.h:164
uint32 GetNativeDisplayId() const
Definition: Unit.h:2014
ReactStates GetReactState() const
Definition: Creature.h:503
void _SaveSpells(SQLTransaction &trans)
Definition: Pet.cpp:1108
Definition: PetDefines.h:38
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
Definition: Unit.h:321
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
uint32 GetEntry() const
Definition: Object.h:107
uint32_t uint32
Definition: g3dmath.h:168
ObjectGuid GetOwnerGUID() const
Definition: Unit.h:1698
uint32 GetHealth() const
Definition: Unit.h:1426
Definition: Unit.h:1193
Definition: PetDefines.h:37
Definition: CharacterDatabase.h:561
Definition: Pet.h:46
PetType getPetType() const
Definition: Pet.h:57
Definition: SharedDefines.h:248
LowType GetCounter() const
Definition: ObjectGuid.h:221
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pet::SaveToDB ( uint32  ,
uint32  ,
uint32   
)
inlineoverrideprivatevirtual

Reimplemented from TempSummon.

164  {
165  ABORT();
166  }
#define ABORT
Definition: Errors.h:56
void Pet::setDeathState ( DeathState  s)
overridevirtual

Reimplemented from Creature.

522 {
524  if (getDeathState() == CORPSE)
525  {
526  if (getPetType() == HUNTER_PET)
527  {
528  // pet corpse non lootable and non skinnable
531 
532  //SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
533  }
534  }
535  else if (getDeathState() == ALIVE)
536  {
537  //RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
538  CastPetAuras(true);
539  }
540 }
Definition: Unit.h:699
Definition: Unit.h:541
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
Definition: Unit.h:543
Definition: PetDefines.h:25
void setDeathState(DeathState s) override
Definition: Creature.cpp:1624
void CastPetAuras(bool current)
Definition: Pet.cpp:1842
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
Definition: UpdateFields.h:109
Definition: UpdateFields.h:30
Definition: SharedDefines.h:4199
PetType getPetType() const
Definition: Pet.h:57
DeathState getDeathState() const
Definition: Unit.h:1695

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pet::SetDisplayId ( uint32  modelId)
overridevirtual

Reimplemented from Creature.

1919 {
1920  Guardian::SetDisplayId(modelId);
1921 
1922  if (!isControlled())
1923  return;
1924 
1926 }
Definition: Group.h:135
bool isControlled() const
Definition: Pet.h:59
void SetDisplayId(uint32 modelId) override
Definition: Creature.cpp:2664
void SetGroupUpdateFlag(uint32 flag)
Definition: Pet.cpp:1928

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pet::SetDuration ( int32  dur)
inline
91 { m_duration = dur; }
int32 m_duration
Definition: Pet.h:155
void Pet::SetFreeTalentPoints ( uint8  points)
inline
139 { SetByteValue(UNIT_FIELD_BYTES_1, 1, points); }
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition: Object.cpp:1080
Definition: UpdateFields.h:124

+ Here is the call graph for this function:

void Pet::SetGroupUpdateFlag ( uint32  flag)
1929 {
1930  if (GetOwner()->GetGroup())
1931  {
1932  m_groupUpdateMask |= flag;
1933  GetOwner()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET);
1934  }
1935 }
Player * GetOwner() const
Definition: Pet.cpp:1913
uint32 m_groupUpdateMask
Definition: Pet.h:158
Definition: Group.h:119

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pet::setPetType ( PetType  type)
inline
58 { m_petType = type; }
PetType m_petType
Definition: Pet.h:154

+ Here is the caller graph for this function:

void Pet::SynchronizeLevelWithOwner ( )
1898 {
1899  Player* owner = GetOwner();
1900 
1901  switch (getPetType())
1902  {
1903  // always same level
1904  case SUMMON_PET:
1905  case HUNTER_PET:
1906  GivePetLevel(owner->getLevel());
1907  break;
1908  default:
1909  break;
1910  }
1911 }
Definition: PetDefines.h:24
Player * GetOwner() const
Definition: Pet.cpp:1913
void GivePetLevel(uint8 level)
Definition: Pet.cpp:714
Definition: PetDefines.h:25
PetType getPetType() const
Definition: Pet.h:57

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pet::ToggleAutocast ( SpellInfo const spellInfo,
bool  apply 
)
1729 {
1730  ASSERT(spellInfo);
1731 
1732  if (!spellInfo->IsAutocastable())
1733  return;
1734 
1735  PetSpellMap::iterator itr = m_spells.find(spellInfo->Id);
1736  if (itr == m_spells.end())
1737  return;
1738 
1739  auto autospellItr = std::find(m_autospells.begin(), m_autospells.end(), spellInfo->Id);
1740 
1741  if (apply)
1742  {
1743  if (autospellItr == m_autospells.end())
1744  {
1745  m_autospells.push_back(spellInfo->Id);
1746 
1747  if (itr->second.active != ACT_ENABLED)
1748  {
1749  itr->second.active = ACT_ENABLED;
1750  if (itr->second.state != PETSPELL_NEW)
1751  itr->second.state = PETSPELL_CHANGED;
1752  }
1753  }
1754  }
1755  else
1756  {
1757  if (autospellItr != m_autospells.end())
1758  {
1759  m_autospells.erase(autospellItr);
1760 
1761  if (itr->second.active != ACT_DISABLED)
1762  {
1763  itr->second.active = ACT_DISABLED;
1764  if (itr->second.state != PETSPELL_NEW)
1765  itr->second.state = PETSPELL_CHANGED;
1766  }
1767  }
1768  }
1769 }
Definition: PetDefines.h:52
AutoSpellList m_autospells
Definition: Pet.h:129
void apply(T *val)
Definition: ByteConverter.h:41
Definition: PetDefines.h:51
PetSpellMap m_spells
Definition: Pet.h:128
Definition: Unit.h:1121
#define ASSERT
Definition: Errors.h:55
Definition: Unit.h:1120

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Pet::unlearnSpell ( uint32  spell_id,
bool  learn_prev,
bool  clear_ab = true 
)
1477 {
1478  if (removeSpell(spell_id, learn_prev, clear_ab))
1479  {
1480  if (!m_loading)
1481  {
1483  packet.Spells.push_back(spell_id);
1484  GetOwner()->GetSession()->SendPacket(packet.Write());
1485  }
1486  return true;
1487  }
1488  return false;
1489 }
Player * GetOwner() const
Definition: Pet.cpp:1913
bool m_loading
Definition: Pet.h:156
std::vector< uint32 > Spells
Definition: PetPackets.h:157
Definition: PetPackets.h:150
WorldPacket const * Write() override
Definition: PetPackets.cpp:87
bool removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab=true)
Definition: Pet.cpp:1491

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pet::Update ( uint32  diff)
overridevirtual

Reimplemented from TempSummon.

543 {
544  if (m_removed) // pet already removed, just wait in remove queue, no updates
545  return;
546 
547  if (m_loading)
548  return;
549 
550  switch (m_deathState)
551  {
552  case CORPSE:
553  {
554  if (getPetType() != HUNTER_PET || m_corpseRemoveTime <= time(NULL))
555  {
556  Remove(PET_SAVE_NOT_IN_SLOT); //hunters' pets never get removed because of death, NEVER!
557  return;
558  }
559  break;
560  }
561  case ALIVE:
562  {
563  // unsummon pet that lost owner
564  Player* owner = GetOwner();
565  if ((!IsWithinDistInMap(owner, GetMap()->GetVisibilityRange()) && !isPossessed()) || (isControlled() && !owner->GetPetGUID()))
566  //if (!owner || (!IsWithinDistInMap(owner, GetMap()->GetVisibilityDistance()) && (owner->GetCharmGUID() && (owner->GetCharmGUID() != GetGUID()))) || (isControlled() && !owner->GetPetGUID()))
567  {
569  return;
570  }
571 
572  if (isControlled())
573  {
574  if (owner->GetPetGUID() != GetGUID())
575  {
576  TC_LOG_ERROR("entities.pet", "Pet %u is not pet of owner %s, removed", GetEntry(), GetOwner()->GetName().c_str());
578  return;
579  }
580  }
581 
582  if (m_duration > 0)
583  {
584  if (uint32(m_duration) > diff)
585  m_duration -= diff;
586  else
587  {
589  return;
590  }
591  }
592 
593  //regenerate focus for hunter pets or energy for deathknight's ghoul
594  if (m_focusRegenTimer)
595  {
596  if (m_focusRegenTimer > diff)
597  m_focusRegenTimer -= diff;
598  else
599  {
600  switch (getPowerType())
601  {
602  case POWER_FOCUS:
606 
607  // Reset if large diff (lag) causes focus to get 'stuck'
610 
611  break;
612 
613  // in creature::update
614  //case POWER_ENERGY:
615  // Regenerate(POWER_ENERGY);
616  // m_regenTimer += CREATURE_REGEN_INTERVAL - diff;
617  // if (!m_regenTimer) ++m_regenTimer;
618  // break;
619  default:
620  m_focusRegenTimer = 0;
621  break;
622  }
623  }
624  }
625  break;
626  }
627  default:
628  break;
629  }
630  Creature::Update(diff);
631 }
Definition: PetDefines.h:24
Player * GetOwner() const
Definition: Pet.cpp:1913
Map * GetMap() const
Definition: Object.h:543
#define PET_FOCUS_REGEN_INTERVAL
Definition: Pet.h:25
std::string const & GetName() const
Definition: Object.h:479
Definition: Unit.h:541
float GetVisibilityRange() const
Definition: Object.cpp:1912
arena_t NULL
Definition: jemalloc_internal.h:624
int32 m_duration
Definition: Pet.h:155
Definition: Unit.h:543
bool m_loading
Definition: Pet.h:156
Definition: PetDefines.h:25
Definition: SharedDefines.h:250
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition: Object.cpp:1663
Powers getPowerType() const
Definition: Unit.h:1444
time_t m_corpseRemoveTime
Definition: Creature.h:733
DeathState m_deathState
Definition: Unit.h:2259
bool isControlled() const
Definition: Pet.h:59
bool isPossessed() const
Definition: Unit.h:1743
bool m_removed
Definition: Pet.h:149
ObjectGuid const & GetGUID() const
Definition: Object.h:105
uint32 m_focusRegenTimer
Definition: Pet.h:157
void Regenerate(Powers power)
Definition: Pet.cpp:633
Definition: PetDefines.h:38
void Update(uint32 time) override
Definition: Creature.cpp:494
uint32 GetEntry() const
Definition: Object.h:107
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: PetDefines.h:34
uint32_t uint32
Definition: g3dmath.h:168
void Remove(PetSaveMode mode, bool returnreagent=false)
Definition: Pet.cpp:672
PetType getPetType() const
Definition: Pet.h:57

+ Here is the call graph for this function:

Member Data Documentation

AutoSpellList Pet::m_autospells
DeclinedName* Pet::m_declinedname
protected
int32 Pet::m_duration
protected
uint32 Pet::m_focusRegenTimer
protected
uint32 Pet::m_groupUpdateMask
protected
bool Pet::m_loading
protected
PetType Pet::m_petType
protected
bool Pet::m_removed
PetSpellMap Pet::m_spells
uint32 Pet::m_usedTalentCount

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