TrinityCore
GameObject Class Reference

#include <GameObject.h>

Classes

struct  ValuesUpdateForPlayerWithMaskSender
 

Public Member Functions

 GameObject ()
 
 ~GameObject ()
 
void BuildValuesUpdateForPlayerWithMask (UpdateData *data, UF::ObjectData::Mask const &requestedObjectMask, UF::GameObjectData::Mask const &requestedGameObjectMask, Player const *target) const
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void CleanupsBeforeDelete (bool finalCleanup=true) override
 
void Update (uint32 p_time) override
 
GameObjectTemplate const * GetGOInfo () const
 
GameObjectTemplateAddon const * GetTemplateAddon () const
 
GameObjectOverride const * GetGameObjectOverride () const
 
GameObjectData const * GetGameObjectData () const
 
GameObjectValue const * GetGOValue () const
 
bool IsTransport () const
 
bool IsDynTransport () const
 
bool IsDestructibleBuilding () const
 
ObjectGuid::LowType GetSpawnId () const
 
void SetLocalRotationAngles (float z_rot, float y_rot, float x_rot)
 
void SetLocalRotation (float qx, float qy, float qz, float qw)
 
void SetParentRotation (QuaternionData const &rotation)
 
QuaternionData const & GetLocalRotation () const
 
int64 GetPackedLocalRotation () const
 
QuaternionData GetWorldRotation () const
 
std::string GetNameForLocaleIdx (LocaleConstant locale) const override
 
void SaveToDB ()
 
void SaveToDB (uint32 mapid, std::vector< Difficulty > const &spawnDifficulties)
 
bool LoadFromDB (ObjectGuid::LowType spawnId, Map *map, bool addToMap, bool=true)
 
void SetOwnerGUID (ObjectGuid owner)
 
ObjectGuid GetOwnerGUID () const override
 
void SetSpellId (uint32 id)
 
uint32 GetSpellId () const
 
time_t GetRespawnTime () const
 
time_t GetRespawnTimeEx () const
 
void SetRespawnTime (int32 respawn)
 
void Respawn ()
 
bool isSpawned () const
 
bool isSpawnedByDefault () const
 
void SetSpawnedByDefault (bool b)
 
uint32 GetRespawnDelay () const
 
void Refresh ()
 
void DespawnOrUnsummon (Milliseconds delay=0ms, Seconds forceRespawnTime=0s)
 
void Delete ()
 
void SendGameObjectDespawn ()
 
void getFishLoot (Loot *loot, Player *loot_owner)
 
void getFishLootJunk (Loot *loot, Player *loot_owner)
 
bool HasFlag (GameObjectFlags flags) const
 
void SetFlag (GameObjectFlags flags)
 
void RemoveFlag (GameObjectFlags flags)
 
void ReplaceAllFlags (GameObjectFlags flags)
 
void SetLevel (uint32 level)
 
GameobjectTypes GetGoType () const
 
void SetGoType (GameobjectTypes type)
 
GOState GetGoState () const
 
void SetGoState (GOState state)
 
uint32 GetGoArtKit () const
 
void SetGoArtKit (uint32 artkit)
 
uint8 GetGoAnimProgress () const
 
void SetGoAnimProgress (uint8 animprogress)
 
std::vector< uint32 > const * GetPauseTimes () const
 
void SetPathProgressForClient (float progress)
 
void EnableCollision (bool enable)
 
void Use (Unit *user)
 
LootState getLootState () const
 
void SetLootState (LootState s, Unit *unit=nullptr)
 
uint16 GetLootMode () const
 
bool HasLootMode (uint16 lootMode) const
 
void SetLootMode (uint16 lootMode)
 
void AddLootMode (uint16 lootMode)
 
void RemoveLootMode (uint16 lootMode)
 
void ResetLootMode ()
 
void SetLootGenerationTime ()
 
uint32 GetLootGenerationTime () const
 
void AddToSkillupList (ObjectGuid const &PlayerGuidLow)
 
bool IsInSkillupList (ObjectGuid const &playerGuid) const
 
void ClearSkillupList ()
 
void AddUniqueUse (Player *player)
 
void AddUse ()
 
uint32 GetUseCount () const
 
uint32 GetUniqueUseCount () const
 
void SaveRespawnTime (uint32 forceDelay=0)
 
PlayerGetLootRecipient () const
 
GroupGetLootRecipientGroup () const
 
void SetLootRecipient (Unit *unit, Group *group=nullptr)
 
bool IsLootAllowedFor (Player const *player) const
 
bool HasLootRecipient () const
 
GameObjectGetLinkedTrap ()
 
void SetLinkedTrap (GameObject *linkedTrap)
 
bool hasQuest (uint32 quest_id) const override
 
bool hasInvolvedQuest (uint32 quest_id) const override
 
bool ActivateToQuest (Player const *target) const
 
void UseDoorOrButton (uint32 time_to_restore=0, bool alternative=false, Unit *user=nullptr)
 
void ResetDoorOrButton ()
 
void ActivateObject (GameObjectActions action, int32 param, WorldObject *spellCaster=nullptr, uint32 spellId=0, int32 effectIndex=-1)
 
void TriggeringLinkedGameObject (uint32 trapEntry, Unit *target)
 
bool IsNeverVisibleFor (WorldObject const *seer) const override
 
bool IsAlwaysVisibleFor (WorldObject const *seer) const override
 
bool IsInvisibleDueToDespawn () const override
 
uint8 GetLevelForTarget (WorldObject const *target) const override
 
GameObjectLookupFishingHoleAround (float range)
 
void SendCustomAnim (uint32 anim)
 
bool IsInRange (float x, float y, float z, float radius) const
 
void ModifyHealth (int32 change, WorldObject *attackerOrHealer=nullptr, uint32 spellId=0)
 
void SetDestructibleState (GameObjectDestructibleState state, WorldObject *attackerOrHealer=nullptr, bool setHealth=false)
 
GameObjectDestructibleState GetDestructibleState () const
 
void SetRespawnCompatibilityMode (bool mode=true)
 
bool GetRespawnCompatibilityMode ()
 
uint32 GetScriptId () const
 
GameObjectAIAI () const
 
std::string const & GetAIName () const
 
void SetDisplayId (uint32 displayid)
 
uint32 GetDisplayId () const
 
uint8 GetNameSetId () const
 
uint32 GetFaction () const override
 
void SetFaction (uint32 faction) override
 
void GetRespawnPosition (float &x, float &y, float &z, float *ori=nullptr) const
 
TransportBaseToTransportBase ()
 
TransportBase const * ToTransportBase () const
 
TransportToTransport ()
 
Transport const * ToTransport () const
 
float GetStationaryX () const override
 
float GetStationaryY () const override
 
float GetStationaryZ () const override
 
float GetStationaryO () const override
 
Position const & GetStationaryPosition () const
 
void RelocateStationaryPosition (float x, float y, float z, float o)
 
void AfterRelocation ()
 
float GetInteractionDistance () const
 
void UpdateModelPosition ()
 
bool IsAtInteractDistance (Position const &pos, float radius) const
 
bool IsAtInteractDistance (Player const *player, SpellInfo const *spell=nullptr) const
 
bool IsWithinDistInMap (Player const *player) const
 
SpellInfo const * GetSpellForLock (Player const *player) const
 
uint16 GetAIAnimKitId () const override
 
void SetAnimKitId (uint16 animKitId, bool oneshot)
 
uint32 GetWorldEffectID () const
 
void SetWorldEffectID (uint32 worldEffectID)
 
void SetSpellVisualId (int32 spellVisualId, ObjectGuid activatorGuid=ObjectGuid::Empty)
 
void AssaultCapturePoint (Player *player)
 
void UpdateCapturePoint ()
 
bool CanInteractWithCapturePoint (Player const *target) const
 
void AIM_Destroy ()
 
bool AIM_Initialize ()
 
std::string GetDebugInfo () const override
 
void UpdateDynamicFlagsForNearbyPlayers () const
 
void HandleCustomTypeCommand (GameObjectTypeBase::CustomCommand const &command) const
 
- Public Member Functions inherited from WorldObject
virtual ~WorldObject ()
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void GetNearPoint2D (WorldObject const *searcher, float &x, float &y, float distance, float absAngle) const
 
void GetNearPoint (WorldObject const *searcher, float &x, float &y, float &z, float distance2d, float absAngle) const
 
void GetClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float relAngle=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
 
virtual float GetCombatReach () const
 
void UpdateGroundPositionZ (float x, float y, float &z) const
 
void UpdateAllowedPositionZ (float x, float y, float &z, float *groundZ=nullptr) 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
 
bool IsInPhase (WorldObject const *obj) const
 
PhaseShiftGetPhaseShift ()
 
PhaseShift const & GetPhaseShift () const
 
PhaseShiftGetSuppressedPhaseShift ()
 
PhaseShift const & GetSuppressedPhaseShift () const
 
int32 GetDBPhase () const
 
void SetDBPhase (int32 p)
 
uint32 GetZoneId () const
 
uint32 GetAreaId () const
 
void GetZoneAndAreaId (uint32 &zoneid, uint32 &areaid) const
 
bool IsInWorldPvpZone () const
 
bool IsOutdoors () const
 
ZLiquidStatus GetLiquidStatus () const
 
InstanceScriptGetInstanceScript () const
 
std::string const & GetName () const
 
void SetName (std::string newname)
 
std::string GetNameForLocaleIdx (LocaleConstant) const override
 
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, bool incOwnRadius=true, bool incTargetRadius=true) const
 
bool IsWithinLOS (float x, float y, float z, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing) const
 
bool IsWithinLOSInMap (WorldObject const *obj, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing) const
 
Position GetHitSpherePointFor (Position const &dest) const
 
void GetHitSpherePointFor (Position const &dest, float &x, float &y, float &z) const
 
bool GetDistanceOrder (WorldObject const *obj1, WorldObject const *obj2, bool is3D=true) const
 
bool IsInRange (WorldObject const *obj, float minRange, float maxRange, bool is3D=true) const
 
bool IsInRange2d (float x, float y, float minRange, float maxRange) const
 
bool IsInRange3d (float x, float y, float z, float minRange, float maxRange) const
 
bool isInFront (WorldObject const *target, float arc=float(M_PI)) const
 
bool isInBack (WorldObject const *target, float arc=float(M_PI)) const
 
bool IsInBetween (Position const &pos1, Position const &pos2, float size=0) const
 
bool IsInBetween (WorldObject const *obj1, WorldObject const *obj2, float size=0) const
 
virtual void SendMessageToSet (WorldPacket const *data, bool self) const
 
virtual void SendMessageToSetInRange (WorldPacket const *data, float dist, bool self) const
 
virtual void SendMessageToSet (WorldPacket const *data, Player const *skipped_rcvr) const
 
void SendCombatLogMessage (WorldPackets::CombatLog::CombatLogServerPacket *combatLog) const
 
void PlayDistanceSound (uint32 soundId, Player *target=nullptr)
 
void PlayDirectSound (uint32 soundId, Player *target=nullptr, uint32 broadcastTextId=0)
 
void PlayDirectMusic (uint32 musicId, Player *target=nullptr)
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
float GetSightRange (WorldObject const *target=nullptr) 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
 
void SetZoneScript ()
 
ZoneScriptFindZoneScript () const
 
ZoneScriptGetZoneScript () const
 
ScenarioGetScenario () const
 
TempSummonSummonCreature (uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
 
TempSummonSummonCreature (uint32 entry, float x, float y, float z, float o=0, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
 
TempSummonSummonPersonalClone (Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, Player *privateObjectOwner=nullptr)
 
GameObjectSummonGameObject (uint32 entry, Position const &pos, QuaternionData const &rot, Seconds respawnTime, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
 
GameObjectSummonGameObject (uint32 entry, float x, float y, float z, float ang, QuaternionData const &rot, Seconds respawnTime, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
 
CreatureSummonTrigger (float x, float y, float z, float ang, Milliseconds despawnTime, CreatureAI *(*GetAI)(Creature *)=nullptr)
 
void SummonCreatureGroup (uint8 group, std::list< TempSummon *> *list=nullptr)
 
CreatureFindNearestCreature (uint32 entry, float range, bool alive=true) const
 
GameObjectFindNearestGameObject (uint32 entry, float range, bool spawnedOnly=true) const
 
GameObjectFindNearestUnspawnedGameObject (uint32 entry, float range) const
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
PlayerSelectNearestPlayer (float distance) const
 
virtual ObjectGuid GetCharmerOrOwnerGUID () const
 
ObjectGuid GetCharmerOrOwnerOrOwnGUID () const
 
UnitGetOwner () const
 
UnitGetCharmerOrOwner () const
 
UnitGetCharmerOrOwnerOrSelf () const
 
PlayerGetCharmerOrOwnerPlayerOrPlayerItself () const
 
PlayerGetAffectingPlayer () const
 
PlayerGetSpellModOwner () const
 
int32 CalculateSpellDamage (Unit const *target, SpellEffectInfo const &spellEffectInfo, int32 const *basePoints=nullptr, float *variance=nullptr, uint32 castItemId=0, int32 itemLevel=-1) const
 
float GetSpellMaxRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
float GetSpellMinRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
float ApplyEffectModifiers (SpellInfo const *spellInfo, uint8 effIndex, float value) const
 
int32 CalcSpellDuration (SpellInfo const *spellInfo) const
 
int32 ModSpellDuration (SpellInfo const *spellInfo, WorldObject const *target, int32 duration, bool positive, uint32 effectMask) const
 
void ModSpellCastTime (SpellInfo const *spellInfo, int32 &castTime, Spell *spell=nullptr) const
 
void ModSpellDurationTime (SpellInfo const *spellInfo, int32 &durationTime, Spell *spell=nullptr) const
 
virtual float MeleeSpellMissChance (Unit const *victim, WeaponAttackType attType, SpellInfo const *spellInfo) const
 
virtual SpellMissInfo MeleeSpellHitResult (Unit *victim, SpellInfo const *spellInfo) const
 
SpellMissInfo MagicSpellHitResult (Unit *victim, SpellInfo const *spellInfo) const
 
SpellMissInfo SpellHitResult (Unit *victim, SpellInfo const *spellInfo, bool canReflect=false) const
 
void SendSpellMiss (Unit *target, uint32 spellID, SpellMissInfo missInfo)
 
FactionTemplateEntry const * GetFactionTemplateEntry () const
 
ReputationRank GetReactionTo (WorldObject const *target) const
 
bool IsHostileTo (WorldObject const *target) const
 
bool IsHostileToPlayers () const
 
bool IsFriendlyTo (WorldObject const *target) const
 
bool IsNeutralToAll () const
 
SpellCastResult CastSpell (CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
 
void SendPlayOrphanSpellVisual (ObjectGuid const &target, uint32 spellVisualId, float travelSpeed, bool speedAsTime=false, bool withSourceOrientation=false)
 
void SendPlayOrphanSpellVisual (Position const &targetLocation, uint32 spellVisualId, float travelSpeed, bool speedAsTime=false, bool withSourceOrientation=false)
 
void SendCancelOrphanSpellVisual (uint32 id)
 
void SendPlaySpellVisual (WorldObject *target, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime=false)
 
void SendPlaySpellVisual (Position const &targetPosition, float o, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime=false)
 
void SendCancelSpellVisual (uint32 id)
 
void SendPlaySpellVisualKit (uint32 id, uint32 type, uint32 duration) const
 
void SendCancelSpellVisualKit (uint32 id)
 
bool IsValidAttackTarget (WorldObject const *target, SpellInfo const *bySpell=nullptr) const
 
bool IsValidAssistTarget (WorldObject const *target, SpellInfo const *bySpell=nullptr) const
 
UnitGetMagicHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo)
 
virtual uint32 GetCastSpellXSpellVisualId (SpellInfo const *spellInfo) const
 
template<typename Container >
void GetGameObjectListWithEntryInGrid (Container &gameObjectContainer, uint32 entry, float maxSearchRange=250.0f) const
 
template<typename Container >
void GetCreatureListWithEntryInGrid (Container &creatureContainer, uint32 entry, float maxSearchRange=250.0f) const
 
template<typename Container >
void GetPlayerListInGrid (Container &playerContainer, float maxSearchRange, bool alive=true) const
 
void DestroyForNearbyPlayers ()
 
virtual void UpdateObjectVisibility (bool forced=true)
 
virtual void UpdateObjectVisibilityOnCreate ()
 
virtual void UpdateObjectVisibilityOnDestroy ()
 
void UpdatePositionData ()
 
void BuildUpdate (UpdateDataMapType &) override
 
bool AddToObjectUpdate () override
 
void RemoveFromObjectUpdate () override
 
void AddToNotify (uint16 f)
 
bool isNeedNotify (uint16 f) const
 
uint16 GetNotifyFlags () const
 
void ResetAllNotifies ()
 
bool isActiveObject () const
 
void setActive (bool isActiveObject)
 
bool IsFarVisible () const
 
void SetFarVisible (bool on)
 
bool IsVisibilityOverridden () const
 
void SetVisibilityDistanceOverride (VisibilityDistanceType type)
 
void SetWorldObject (bool apply)
 
bool IsPermanentWorldObject () const
 
bool IsWorldObject () const
 
TransportBaseGetTransport () const
 
float GetTransOffsetX () const
 
float GetTransOffsetY () const
 
float GetTransOffsetZ () const
 
float GetTransOffsetO () const
 
Position const & GetTransOffset () const
 
uint32 GetTransTime () const
 
int8 GetTransSeat () const
 
virtual ObjectGuid GetTransGUID () const
 
void SetTransport (TransportBase *t)
 
float GetFloorZ () const
 
virtual float GetCollisionHeight () const
 
float GetMapWaterOrGroundLevel (float x, float y, float z, float *ground=nullptr) const
 
float GetMapHeight (float x, float y, float z, bool vmap=true, float distanceToSearch=50.0f) const
 
std::string GetDebugInfo () const override
 
virtual uint16 GetMovementAnimKitId () const
 
virtual uint16 GetMeleeAnimKitId () const
 
bool IsPrivateObject () const
 
ObjectGuid GetPrivateObjectOwner () const
 
void SetPrivateObjectOwner (ObjectGuid const &owner)
 
bool CheckPrivateObjectOwnerVisibility (WorldObject const *seer) const
 
SmoothPhasingGetOrCreateSmoothPhasing ()
 
SmoothPhasingGetSmoothPhasing ()
 
SmoothPhasing const * GetSmoothPhasing () const
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
ObjectGuid const & GetGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
virtual void SetObjectScale (float scale)
 
uint32 GetDynamicFlags () const
 
bool HasDynamicFlag (uint32 flag) const
 
void SetDynamicFlag (uint32 flag)
 
void RemoveDynamicFlag (uint32 flag)
 
void ReplaceAllDynamicFlags (uint32 flag)
 
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 const *target) const
 
void BuildValuesUpdateBlockForPlayerWithFlag (UpdateData *data, UF::UpdateFieldFlag flags, Player const *target) const
 
void BuildDestroyUpdateBlock (UpdateData *data) const
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
ByteBuffer PrepareValuesUpdateBuffer () const
 
virtual void DestroyForPlayer (Player *target) const
 
void SendOutOfRangeForPlayer (Player *target) const
 
void SetIsNewObject (bool enable)
 
bool IsDestroyedObject () const
 
void SetDestroyedObject (bool destroyed)
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &) const
 
bool IsPlayer () const
 
PlayerToPlayer ()
 
Player const * ToPlayer () const
 
bool IsCreature () const
 
CreatureToCreature ()
 
Creature const * ToCreature () const
 
bool IsUnit () const
 
UnitToUnit ()
 
Unit const * ToUnit () const
 
bool IsGameObject () const
 
GameObjectToGameObject ()
 
GameObject const * ToGameObject () const
 
bool IsCorpse () const
 
CorpseToCorpse ()
 
Corpse const * ToCorpse () const
 
bool IsDynObject () const
 
DynamicObjectToDynObject ()
 
DynamicObject const * ToDynObject () const
 
bool IsAreaTrigger () const
 
AreaTriggerToAreaTrigger ()
 
AreaTrigger const * ToAreaTrigger () const
 
bool IsSceneObject () const
 
SceneObjectToSceneObject ()
 
SceneObject const * ToSceneObject () const
 
bool IsConversation () const
 
ConversationToConversation ()
 
Conversation const * ToConversation () const
 
template<typename T >
void ForceUpdateFieldChange (UF::UpdateFieldSetter< T > const &)
 
virtual void BuildValuesUpdateWithFlag (ByteBuffer *data, UF::UpdateFieldFlag flags, Player const *target) 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 (uint32 mapId, Position const &position)
 
void WorldRelocate (WorldLocation const &loc)
 
void WorldRelocate (WorldLocation const *loc)
 
void WorldRelocate (uint32 mapId, Position const &pos)
 
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
 
std::string GetDebugInfo () const
 
- Public Member Functions inherited from Position
 Position (float x=0, float y=0, float z=0, float o=0)
 
bool operator== (Position const &a) const
 
bool operator!= (Position const &a) const
 
void Relocate (float x, float y)
 
void Relocate (float x, float y, float z)
 
void Relocate (float x, float y, float z, float o)
 
void Relocate (Position const &pos)
 
void Relocate (Position const *pos)
 
void RelocateOffset (Position const &offset)
 
void SetOrientation (float orientation)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
float GetOrientation () const
 
void GetPosition (float &x, float &y) const
 
void GetPosition (float &x, float &y, float &z) const
 
void GetPosition (float &x, float &y, float &z, float &o) const
 
Position GetPosition () const
 
Streamer< XY > PositionXYStream ()
 
ConstStreamer< XY > PositionXYStream () const
 
Streamer< XYZ > PositionXYZStream ()
 
ConstStreamer< XYZ > PositionXYZStream () const
 
Streamer< XYZO > PositionXYZOStream ()
 
ConstStreamer< XYZO > PositionXYZOStream () const
 
Streamer< PackedXYZ > PositionPackedXYZStream ()
 
ConstStreamer< PackedXYZ > PositionPackedXYZStream () const
 
bool IsPositionValid () const
 
float GetExactDist2dSq (const float x, const float y) const
 
float GetExactDist2dSq (Position const &pos) const
 
float GetExactDist2dSq (Position const *pos) const
 
float GetExactDist2d (const float x, const float y) const
 
float GetExactDist2d (Position const &pos) const
 
float GetExactDist2d (Position const *pos) const
 
float GetExactDistSq (float x, float y, float z) const
 
float GetExactDistSq (Position const &pos) const
 
float GetExactDistSq (Position const *pos) const
 
float GetExactDist (float x, float y, float z) const
 
float GetExactDist (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 GetAbsoluteAngle (float x, float y) const
 
float GetAbsoluteAngle (Position const &pos) const
 
float GetAbsoluteAngle (Position const *pos) const
 
float ToAbsoluteAngle (float relAngle) const
 
float ToRelativeAngle (float absAngle) const
 
float GetRelativeAngle (float x, float y) const
 
float GetRelativeAngle (Position const &pos) const
 
float GetRelativeAngle (Position const *pos) 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 IsInDist (Position const *pos, float dist) const
 
bool IsWithinBox (Position const &center, float xradius, float yradius, float zradius) const
 
bool IsWithinDoubleVerticalCylinder (Position const *center, float radius, float height) const
 
bool HasInArc (float arcangle, Position const *pos, float border=2.0f) const
 
bool HasInLine (Position const *pos, float objSize, float width) const
 
std::string ToString () const
 
- Public Member Functions inherited from GridObject< GameObject >
virtual ~GridObject ()
 
bool IsInGrid () const
 
void AddToGrid (GridRefManager< GameObject > &m)
 
void RemoveFromGrid ()
 

Static Public Member Functions

static GameObjectCreateGameObject (uint32 entry, Map *map, Position const &pos, QuaternionData const &rotation, uint32 animProgress, GOState goState, uint32 artKit=0)
 
static GameObjectCreateGameObjectFromDB (ObjectGuid::LowType spawnId, Map *map, bool addToMap=true)
 
static bool DeleteFromDB (ObjectGuid::LowType spawnId)
 
static void SetGoArtKit (uint32 artkit, GameObject *go, ObjectGuid::LowType lowguid=UI64LIT(0))
 
- Static Public Member Functions inherited from WorldObject
static bool InSamePhase (WorldObject const *a, WorldObject const *b)
 
static ReputationRank GetFactionReactionTo (FactionTemplateEntry const *factionTemplateEntry, WorldObject const *target)
 
- Static Public Member Functions inherited from Object
static ObjectGuid GetGUID (Object const *o)
 
static PlayerToPlayer (Object *o)
 
static Player const * ToPlayer (Object const *o)
 
static CreatureToCreature (Object *o)
 
static Creature const * ToCreature (Object const *o)
 
static UnitToUnit (Object *o)
 
static Unit const * ToUnit (Object const *o)
 
static GameObjectToGameObject (Object *o)
 
static GameObject const * ToGameObject (Object const *o)
 
static CorpseToCorpse (Object *o)
 
static Corpse const * ToCorpse (Object const *o)
 
static DynamicObjectToDynObject (Object *o)
 
static DynamicObject const * ToDynObject (Object const *o)
 
static AreaTriggerToAreaTrigger (Object *o)
 
static AreaTrigger const * ToAreaTrigger (Object const *o)
 
static SceneObjectToSceneObject (Object *o)
 
static SceneObject const * ToSceneObject (Object const *o)
 
static ConversationToConversation (Object *o)
 
static Conversation const * ToConversation (Object const *o)
 
- Static Public Member Functions inherited from Position
static float NormalizeOrientation (float o)
 

Public Attributes

Loot loot
 
uint32 m_groupLootTimer
 
ObjectGuid lootingGroupLowGUID
 
GameObjectModelm_model
 
UF::UpdateField< UF::GameObjectData, 0, TYPEID_GAMEOBJECTm_gameObjectData
 
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealth
 
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealthDetect
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibility
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibilityDetect
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibility
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibilityDetect
 
uint32 LastUsedScriptID
 
MovementInfo m_movementInfo
 
EventProcessor m_Events
 
- Public Attributes inherited from Object
UF::UpdateFieldHolder m_values
 
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECTm_objectData
 
- Public Attributes inherited from WorldLocation
uint32 m_mapId
 
- Public Attributes inherited from Position
float m_positionX
 
float m_positionY
 
float m_positionZ
 

Protected Types

typedef std::map< uint32, ObjectGuidChairSlotAndUser
 

Protected Member Functions

void BuildValuesCreate (ByteBuffer *data, Player const *target) const override
 
void BuildValuesUpdate (ByteBuffer *data, Player const *target) const override
 
void ClearUpdateMask (bool remove) override
 
void CreateModel ()
 
void UpdateModel ()
 
- Protected Member Functions inherited from WorldObject
 WorldObject (bool isWorldObject)
 
virtual void ProcessPositionDataChanged (PositionFullTerrainStatus const &data)
 
void SetLocationMapId (uint32 _mapId)
 
void SetLocationInstanceId (uint32 _instanceId)
 
virtual bool CanNeverSee (WorldObject const *obj) const
 
virtual bool IsAlwaysDetectableFor (WorldObject const *) const
 
- Protected Member Functions inherited from Object
 Object ()
 
void _Create (ObjectGuid const &guid)
 
template<typename T >
void SetUpdateFieldValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
 
template<typename T >
void SetUpdateFieldFlagValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type flag)
 
template<typename T >
void RemoveUpdateFieldFlagValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type flag)
 
template<typename T >
UF::DynamicUpdateFieldSetter< T >::insert_result AddDynamicUpdateFieldValue (UF::DynamicUpdateFieldSetter< T > setter)
 
template<typename T >
UF::DynamicUpdateFieldSetter< T >::insert_result InsertDynamicUpdateFieldValue (UF::DynamicUpdateFieldSetter< T > setter, uint32 index)
 
template<typename T >
void RemoveDynamicUpdateFieldValue (UF::DynamicUpdateFieldSetter< T > setter, uint32 index)
 
template<typename T >
void ClearDynamicUpdateFieldValues (UF::DynamicUpdateFieldSetter< T > setter)
 
template<typename T >
void RemoveOptionalUpdateFieldValue (UF::OptionalUpdateFieldSetter< T > setter)
 
template<typename T >
void SetUpdateFieldStatValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
 
template<typename T >
void ApplyModUpdateFieldValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type mod, bool apply)
 
template<typename T >
void ApplyPercentModUpdateFieldValue (UF::UpdateFieldSetter< T > setter, float percent, bool apply)
 
template<typename Action >
void DoWithSuppressingObjectUpdates (Action &&action)
 
void BuildMovementUpdate (ByteBuffer *data, CreateObjectBits flags, Player *target) const
 
virtual UF::UpdateFieldFlag GetUpdateFieldFlagsFor (Player const *target) const
 
void AddToObjectUpdateIfNeeded ()
 
- Protected Member Functions inherited from MapObject
 MapObject ()
 

Protected Attributes

uint32 m_spellId
 
time_t m_respawnTime
 
uint32 m_respawnDelayTime
 
uint32 m_despawnDelay
 
Seconds m_despawnRespawnTime
 
LootState m_lootState
 
ObjectGuid m_lootStateUnitGUID
 
bool m_spawnedByDefault
 
time_t m_restockTime
 
time_t m_cooldownTime
 
GOState m_prevGoState
 
GuidSet m_SkillupList
 
ObjectGuid m_ritualOwnerGUID
 
GuidSet m_unique_users
 
uint32 m_usetimes
 
ChairSlotAndUser ChairListSlots
 
ObjectGuid::LowType m_spawnId
 For new or temporary gameobjects is 0 for saved it is lowguid. More...
 
GameObjectTemplate const * m_goInfo
 
GameObjectTemplateAddon const * m_goTemplateAddon
 
GameObjectData const * m_goData
 
std::unique_ptr< GameObjectTypeBasem_goTypeImpl
 
GameObjectValue m_goValue
 
int64 m_packedRotation
 
QuaternionData m_localRotation
 
Position m_stationaryPosition
 
ObjectGuid m_lootRecipient
 
ObjectGuid m_lootRecipientGroup
 
uint16 m_LootMode
 
uint32 m_lootGenerationTime
 
ObjectGuid m_linkedTrap
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
bool m_isFarVisible
 
Optional< float > m_visibilityDistanceOverride
 
bool const m_isWorldObject
 
ZoneScriptm_zoneScript
 
TransportBasem_transport
 
uint32 m_zoneId
 
uint32 m_areaId
 
float m_staticFloorZ
 
bool m_outdoors
 
ZLiquidStatus m_liquidStatus
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
TypeID m_objectTypeId
 
CreateObjectBits m_updateFlag
 
bool m_objectUpdated
 

Private Member Functions

bool Create (uint32 entry, Map *map, Position const &pos, QuaternionData const &rotation, uint32 animProgress, GOState goState, uint32 artKit, bool dynamic, ObjectGuid::LowType spawnid)
 
void RemoveFromOwner ()
 
void SwitchDoorOrButton (bool activate, bool alternative=false)
 
void UpdatePackedRotation ()
 
bool _IsWithinDist (WorldObject const *obj, float dist2compare, bool, bool, bool) const override
 Object distance/size - overridden from Object::_IsWithinDist. Needs to take in account proper GO size. More...
 

Private Attributes

GameObjectAIm_AI
 
bool m_respawnCompatibilityMode
 
uint16 _animKitId
 
uint32 _worldEffectID
 

Member Typedef Documentation

◆ ChairSlotAndUser

typedef std::map<uint32, ObjectGuid> GameObject::ChairSlotAndUser
protected

Constructor & Destructor Documentation

◆ GameObject()

GameObject::GameObject ( )
explicit
490  : WorldObject(false), MapObject(),
491  m_model(nullptr), m_goValue(), m_AI(nullptr), m_respawnCompatibilityMode(false), _animKitId(0), _worldEffectID(0)
492 {
495 
496  m_updateFlag.Stationary = true;
497  m_updateFlag.Rotation = true;
498 
499  m_respawnTime = 0;
500  m_respawnDelayTime = 300;
501  m_despawnDelay = 0;
503  m_restockTime = 0;
505  m_spawnedByDefault = true;
506  m_usetimes = 0;
507  m_spellId = 0;
508  m_cooldownTime = 0;
510  m_goInfo = nullptr;
511  m_goData = nullptr;
512  m_packedRotation = 0;
513  m_goTemplateAddon = nullptr;
514 
515  m_spawnId = UI64LIT(0);
516 
517  m_groupLootTimer = 0;
519 
520  ResetLootMode(); // restore default loot mode
521  m_stationaryPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
522 }
LootState m_lootState
Definition: GameObject.h:403
uint32 m_usetimes
Definition: GameObject.h:415
uint32 m_respawnDelayTime
Definition: GameObject.h:400
Position m_stationaryPosition
Definition: GameObject.h:429
CreateObjectBits m_updateFlag
Definition: Object.h:385
GameObjectAI * m_AI
Definition: GameObject.h:450
bool Rotation
Definition: Object.h:90
GOState m_prevGoState
Definition: GameObject.h:409
#define UI64LIT(N)
Definition: Define.h:128
GameObjectData const * m_goData
Definition: GameObject.h:423
uint16 m_objectType
Definition: Object.h:382
GameObjectTemplate const * m_goInfo
Definition: GameObject.h:421
time_t m_cooldownTime
Definition: GameObject.h:407
uint32 _worldEffectID
Definition: GameObject.h:453
bool m_respawnCompatibilityMode
Definition: GameObject.h:451
time_t m_respawnTime
Definition: GameObject.h:399
GameObjectModel * m_model
Definition: GameObject.h:343
Definition: ObjectGuid.h:62
void Relocate(float x, float y)
Definition: Position.h:64
TypeID m_objectTypeId
Definition: Object.h:384
GameObjectValue m_goValue
Definition: GameObject.h:425
Definition: SharedDefines.h:2840
MapObject()
Definition: MapObject.h:41
Definition: ObjectGuid.h:42
Seconds m_despawnRespawnTime
Definition: GameObject.h:402
time_t m_restockTime
Definition: GameObject.h:406
uint32 m_groupLootTimer
Definition: GameObject.h:289
WorldObject(bool isWorldObject)
Definition: Object.cpp:824
bool m_spawnedByDefault
Definition: GameObject.h:405
GameObjectTemplateAddon const * m_goTemplateAddon
Definition: GameObject.h:422
uint32 m_spellId
Definition: GameObject.h:398
Definition: GameObject.h:116
uint32 m_despawnDelay
Definition: GameObject.h:401
int64 m_packedRotation
Definition: GameObject.h:427
void ResetLootMode()
Definition: GameObject.h:263
bool Stationary
Definition: Object.h:85
uint32 m_lootGenerationTime
Definition: GameObject.h:434
ObjectGuid::LowType m_spawnId
For new or temporary gameobjects is 0 for saved it is lowguid.
Definition: GameObject.h:420
uint16 _animKitId
Definition: GameObject.h:452
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ~GameObject()

GameObject::~GameObject ( )
525 {
526  delete m_AI;
527  delete m_model;
528 }
GameObjectAI * m_AI
Definition: GameObject.h:450
GameObjectModel * m_model
Definition: GameObject.h:343

Member Function Documentation

◆ _IsWithinDist()

bool GameObject::_IsWithinDist ( WorldObject const *  obj,
float  dist2compare,
bool  ,
bool  ,
bool   
) const
inlineoverrideprivatevirtual

Object distance/size - overridden from Object::_IsWithinDist. Needs to take in account proper GO size.

Following check does check 3d distance

Reimplemented from WorldObject.

445  {
447  return IsInRange(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), dist2compare);
448  }
bool IsInRange(float x, float y, float z, float radius) const
Definition: GameObject.cpp:2812
+ Here is the call graph for this function:

◆ ActivateObject()

void GameObject::ActivateObject ( GameObjectActions  action,
int32  param,
WorldObject spellCaster = nullptr,
uint32  spellId = 0,
int32  effectIndex = -1 
)
1949 {
1950  Unit* unitCaster = spellCaster ? spellCaster->ToUnit() : nullptr;
1951 
1952  switch (action)
1953  {
1955  TC_LOG_FATAL("spell", "Spell %d has action type NONE in effect %d", spellId, effectIndex);
1956  break;
1962  break;
1963  case GameObjectActions::Disturb: // What's the difference with Open?
1964  if (unitCaster)
1965  Use(unitCaster);
1966  break;
1969  break;
1972  break;
1974  if (unitCaster)
1975  Use(unitCaster);
1976  break;
1978  if (unitCaster)
1979  UseDoorOrButton(0, false, unitCaster);
1981  break;
1984  break;
1986  // No use cases, implementation unknown
1987  break;
1989  if (unitCaster)
1990  UseDoorOrButton(0, true, unitCaster);
1991  break;
1994  break;
1996  // No use cases, implementation unknown
1997  break;
2000  break;
2003  break;
2006  break;
2010  break;
2016  {
2017  GameObjectTemplateAddon const* templateAddon = GetTemplateAddon();
2018 
2019  uint32 artKitIndex = action != GameObjectActions::UseArtKit4 ? uint32(action) - uint32(GameObjectActions::UseArtKit0) : 4;
2020 
2021  uint32 artKitValue = 0;
2022  if (templateAddon != nullptr)
2023  artKitValue = templateAddon->ArtKits[artKitIndex];
2024 
2025  if (artKitValue == 0)
2026  TC_LOG_ERROR("sql.sql", "GameObject %d hit by spell %d needs `artkit%d` in `gameobject_template_addon`", GetEntry(), spellId, artKitIndex);
2027  else
2028  SetGoArtKit(artKitValue);
2029 
2030  break;
2031  }
2044  SetGoState(GOState(action));
2045  else
2046  TC_LOG_ERROR("spell", "Spell %d targeted non-transport gameobject for transport only action \"Go to Floor\" %d in effect %d", spellId, int32(action), effectIndex);
2047  break;
2049  SetAnimKitId(param, false);
2050  break;
2052  if (unitCaster)
2053  UseDoorOrButton(0, false, unitCaster);
2054  SetAnimKitId(param, false);
2055  break;
2058  SetAnimKitId(param, false);
2059  break;
2061  SetAnimKitId(param, true);
2062  break;
2064  SetAnimKitId(0, false);
2065  break;
2067  if (unitCaster)
2068  UseDoorOrButton(0, false, unitCaster);
2069  SetAnimKitId(0, false);
2070  break;
2073  SetAnimKitId(0, false);
2074  break;
2076  SetSpellVisualId(param, Object::GetGUID(spellCaster));
2077  break;
2079  SetSpellVisualId(0);
2080  break;
2081  default:
2082  TC_LOG_ERROR("spell", "Spell %d has unhandled action %d in effect %d", spellId, int32(action), effectIndex);
2083  break;
2084  }
2085 }
void SetFlag(GameObjectFlags flags)
Definition: GameObject.h:232
void ResetDoorOrButton()
Definition: GameObject.cpp:1922
Definition: SharedDefines.h:2804
void UseDoorOrButton(uint32 time_to_restore=0, bool alternative=false, Unit *user=nullptr)
Definition: GameObject.cpp:1934
void SetAnimKitId(uint16 animKitId, bool oneshot)
Definition: GameObject.cpp:3430
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:185
void RemoveFlag(GameObjectFlags flags)
Definition: GameObject.h:233
std::array< uint32, 5 > ArtKits
Definition: GameObjectData.h:1090
ObjectGuid const & GetGUID() const
Definition: Object.h:157
#define TC_LOG_FATAL(filterType__,...)
Definition: Log.h:188
GameobjectTypes GetGoType() const
Definition: GameObject.h:237
Definition: GameObjectData.h:1086
void DespawnOrUnsummon(Milliseconds delay=0ms, Seconds forceRespawnTime=0s)
Definition: GameObject.cpp:1363
int32_t int32
Definition: Define.h:139
Definition: SharedDefines.h:2801
uint32_t uint32
Definition: Define.h:143
void Use(Unit *user)
Definition: GameObject.cpp:2123
void SetGoState(GOState state)
Definition: GameObject.cpp:3088
uint32 GetEntry() const
Definition: Object.h:158
void SendCustomAnim(uint32 anim)
Definition: GameObject.cpp:2804
Definition: SharedDefines.h:2843
static Unit * ToUnit(Object *o)
Definition: Object.h:210
Definition: Unit.h:746
void SetSpellVisualId(int32 spellVisualId, ObjectGuid activatorGuid=ObjectGuid::Empty)
Definition: GameObject.cpp:3450
Definition: SharedDefines.h:2743
void SetGoArtKit(uint32 artkit)
Definition: GameObject.cpp:2087
GOState
Definition: SharedDefines.h:2838
GameObjectTemplateAddon const * GetTemplateAddon() const
Definition: GameObject.h:163
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ActivateToQuest()

bool GameObject::ActivateToQuest ( Player const *  target) const
1848 {
1849  if (target->HasQuestForGO(GetEntry()))
1850  return true;
1851 
1852  if (!sObjectMgr->IsGameObjectForQuests(GetEntry()))
1853  return false;
1854 
1855  switch (GetGoType())
1856  {
1858  {
1859  GameObject* go = const_cast<GameObject*>(this);
1860  QuestGiverStatus questStatus = const_cast<Player*>(target)->GetQuestDialogStatus(go);
1861  if (questStatus != QuestGiverStatus::None && questStatus != QuestGiverStatus::Future)
1862  return true;
1863  break;
1864  }
1865  case GAMEOBJECT_TYPE_CHEST:
1866  {
1867  // Chests become inactive while not ready to be looted
1868  if (getLootState() == GO_NOT_READY)
1869  return false;
1870 
1871  // scan GO chest with loot including quest items
1872  if (target->GetQuestStatus(GetGOInfo()->chest.questID) == QUEST_STATUS_INCOMPLETE || LootTemplates_Gameobject.HaveQuestLootForPlayer(GetGOInfo()->GetLootId(), target))
1873  {
1874  if (Battleground const* bg = target->GetBattleground())
1875  return bg->CanActivateGO(GetEntry(), bg->GetPlayerTeam(target->GetGUID()));
1876  return true;
1877  }
1878  break;
1879  }
1881  {
1882  if (target->GetQuestStatus(GetGOInfo()->generic.questID) == QUEST_STATUS_INCOMPLETE)
1883  return true;
1884  break;
1885  }
1887  {
1888  if (target->GetQuestStatus(GetGOInfo()->goober.questID) == QUEST_STATUS_INCOMPLETE)
1889  return true;
1890  break;
1891  }
1892  default:
1893  break;
1894  }
1895 
1896  return false;
1897 }
LootStore LootTemplates_Gameobject("gameobject_loot_template", "gameobject entry", true)
Definition: QuestDef.h:144
bool HaveQuestLootForPlayer(uint32 loot_id, Player const *player) const
Definition: LootMgr.cpp:207
LootState getLootState() const
Definition: GameObject.h:254
#define sObjectMgr
Definition: ObjectMgr.h:1967
uint32 questID
Definition: GameObjectData.h:103
QuestGiverStatus
Definition: QuestDef.h:151
GameobjectTypes GetGoType() const
Definition: GameObject.h:237
Definition: GameObject.h:125
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:162
uint32 GetEntry() const
Definition: Object.h:158
Definition: SharedDefines.h:2734
Definition: SharedDefines.h:2742
Definition: GameObject.h:116
Definition: SharedDefines.h:2735
Definition: Battleground.h:267
Definition: SharedDefines.h:2737
Definition: Player.h:1131
+ Here is the call graph for this function:

◆ AddLootMode()

void GameObject::AddLootMode ( uint16  lootMode)
inline
261 { m_LootMode |= lootMode; }
uint16 m_LootMode
Definition: GameObject.h:433

◆ AddToSkillupList()

void GameObject::AddToSkillupList ( ObjectGuid const &  PlayerGuidLow)
inline
267 { m_SkillupList.insert(PlayerGuidLow); }
GuidSet m_SkillupList
Definition: GameObject.h:411
+ Here is the caller graph for this function:

◆ AddToWorld()

void GameObject::AddToWorld ( )
overridevirtual
  • Register the gameobject for guid lookup

Reimplemented from Object.

581 {
583  if (!IsInWorld())
584  {
585  if (m_zoneScript)
587 
589  if (m_spawnId)
590  GetMap()->GetGameObjectBySpawnIdStore().insert(std::make_pair(m_spawnId, this));
591 
592  // The state can be changed after GameObject::Create but before GameObject::AddToWorld
593  bool toggledState = GetGoType() == GAMEOBJECT_TYPE_CHEST ? getLootState() == GO_READY : (GetGoState() == GO_STATE_READY || IsTransport());
594  if (m_model)
595  {
596  if (Transport* trans = ToTransport())
597  trans->SetDelayedAddModelToMap();
598  else
600  }
601 
602  EnableCollision(toggledState);
604  }
605 }
bool Insert(KEY_TYPE const &handle, SPECIFIC_TYPE *obj)
Definition: TypeContainer.h:116
bool IsTransport() const
Definition: GameObject.cpp:1702
Definition: SharedDefines.h:2841
virtual void OnGameObjectCreate(GameObject *)
Definition: ZoneScript.h:47
void InsertGameObjectModel(GameObjectModel const &model)
Definition: Map.h:544
bool IsInWorld() const
Definition: Object.h:151
LootState getLootState() const
Definition: GameObject.h:254
Definition: Transport.h:29
Map * GetMap() const
Definition: Object.h:555
void AddToWorld() override
Definition: Object.cpp:919
ObjectGuid const & GetGUID() const
Definition: Object.h:157
GameObjectModel * m_model
Definition: GameObject.h:343
ZoneScript * m_zoneScript
Definition: Object.h:729
GameobjectTypes GetGoType() const
Definition: GameObject.h:237
Transport * ToTransport()
Definition: GameObject.h:349
void EnableCollision(bool enable)
Definition: GameObject.cpp:3151
Definition: GameObject.h:125
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:493
GOState GetGoState() const
Definition: GameObject.h:239
GameObjectBySpawnIdContainer & GetGameObjectBySpawnIdStore()
Definition: Map.h:500
Definition: SharedDefines.h:2735
Definition: GameObject.h:117
ObjectGuid::LowType m_spawnId
For new or temporary gameobjects is 0 for saved it is lowguid.
Definition: GameObject.h:420
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddUniqueUse()

void GameObject::AddUniqueUse ( Player player)
1358 {
1359  AddUse();
1360  m_unique_users.insert(player->GetGUID());
1361 }
GuidSet m_unique_users
Definition: GameObject.h:414
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:156
void AddUse()
Definition: GameObject.h:275
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddUse()

void GameObject::AddUse ( )
inline
275 { ++m_usetimes; }
uint32 m_usetimes
Definition: GameObject.h:415
+ Here is the caller graph for this function:

◆ AfterRelocation()

void GameObject::AfterRelocation ( )
3370 {
3373  if (m_goTypeImpl)
3374  m_goTypeImpl->OnRelocated();
3375 
3376  UpdateObjectVisibility(false);
3377 }
void UpdatePositionData()
Definition: Object.cpp:901
void UpdateModelPosition()
Definition: GameObject.cpp:3417
std::unique_ptr< GameObjectTypeBase > m_goTypeImpl
Definition: GameObject.h:424
virtual void UpdateObjectVisibility(bool forced=true)
Definition: Object.cpp:3486
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AI()

GameObjectAI* GameObject::AI ( ) const
inline
333 { return m_AI; }
GameObjectAI * m_AI
Definition: GameObject.h:450
+ Here is the caller graph for this function:

◆ AIM_Destroy()

void GameObject::AIM_Destroy ( )
531 {
532  delete m_AI;
533  m_AI = nullptr;
534 }
GameObjectAI * m_AI
Definition: GameObject.h:450
+ Here is the caller graph for this function:

◆ AIM_Initialize()

bool GameObject::AIM_Initialize ( )
537 {
538  AIM_Destroy();
539 
541 
542  if (!m_AI)
543  return false;
544 
545  m_AI->InitializeAI();
546  return true;
547 }
GameObjectAI * m_AI
Definition: GameObject.h:450
GameObjectAI * SelectGameObjectAI(GameObject *go)
Definition: CreatureAISelector.cpp:140
void AIM_Destroy()
Definition: GameObject.cpp:530
virtual void InitializeAI()
Definition: GameObjectAI.h:61
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AssaultCapturePoint()

void GameObject::AssaultCapturePoint ( Player player)
3462 {
3463  if (!CanInteractWithCapturePoint(player))
3464  return;
3465 
3466  if (GameObjectAI* ai = AI())
3467  if (ai->OnCapturePointAssaulted(player))
3468  return;
3469 
3470  // only supported in battlegrounds
3471  Battleground* battleground = nullptr;
3472  if (BattlegroundMap* map = GetMap()->ToBattlegroundMap())
3473  if (Battleground* bg = map->GetBG())
3474  battleground = bg;
3475 
3476  if (!battleground)
3477  return;
3478 
3479  // Cancel current timer
3481 
3482  if (player->GetBGTeam() == HORDE)
3483  {
3485  {
3486  // defended. capture instantly.
3488  battleground->SendBroadcastText(GetGOInfo()->capturePoint.DefendedBroadcastHorde, CHAT_MSG_BG_SYSTEM_HORDE, player);
3490  if (GetGOInfo()->capturePoint.DefendedEventHorde)
3491  GameEvents::Trigger(GetGOInfo()->capturePoint.DefendedEventHorde, player, this);
3492  return;
3493  }
3494 
3495  switch (m_goValue.CapturePoint.State)
3496  {
3501  battleground->SendBroadcastText(GetGOInfo()->capturePoint.AssaultBroadcastHorde, CHAT_MSG_BG_SYSTEM_HORDE, player);
3503  if (GetGOInfo()->capturePoint.ContestedEventHorde)
3504  GameEvents::Trigger(GetGOInfo()->capturePoint.ContestedEventHorde, player, this);
3506  break;
3507  default:
3508  break;
3509  }
3510  }
3511  else
3512  {
3514  {
3515  // defended. capture instantly.
3517  battleground->SendBroadcastText(GetGOInfo()->capturePoint.DefendedBroadcastAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
3519  if (GetGOInfo()->capturePoint.DefendedEventAlliance)
3520  GameEvents::Trigger(GetGOInfo()->capturePoint.DefendedEventAlliance, player, this);
3521  return;
3522  }
3523 
3524  switch (m_goValue.CapturePoint.State)
3525  {
3530  battleground->SendBroadcastText(GetGOInfo()->capturePoint.AssaultBroadcastAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
3532  if (GetGOInfo()->capturePoint.ContestedEventAlliance)
3533  GameEvents::Trigger(GetGOInfo()->capturePoint.ContestedEventAlliance, player, this);
3535  break;
3536  default:
3537  break;
3538  }
3539  }
3540 }
BattlegroundMap * ToBattlegroundMap()
Definition: Map.h:531
Definition: SharedDefines.h:5735
struct GameObjectTemplate::@212::@256 capturePoint
void SendBroadcastText(uint32 id, ChatMsg msgType, WorldObject const *target=nullptr)
Definition: Battleground.cpp:623
Definition: SharedDefines.h:5734
uint32 DefendedEventHorde
Definition: GameObjectData.h:623
GameObjectAI * AI() const
Definition: GameObject.h:333
uint32 AssaultBroadcastHorde
Definition: GameObjectData.h:614
uint32 AssaultBroadcastAlliance
Definition: GameObjectData.h:617
Definition: GameObjectAI.h:43
TC_GAME_API void Trigger(uint32 gameEventId, WorldObject *source, WorldObject *target)
Definition: GameEventSender.cpp:28
void UpdateCapturePoint()
Definition: GameObject.cpp:3542
Map * GetMap() const
Definition: Object.h:555
uint32 AssaultTimer
Definition: GameObject.h:106
uint32 DefendedBroadcastAlliance
Definition: GameObjectData.h:619
uint32 ContestedEventAlliance
Definition: GameObjectData.h:446
uint32 ContestedEventHorde
Definition: GameObjectData.h:445
Definition: Map.h:988
GameObjectValue m_goValue
Definition: GameObject.h:425
uint32 GetBGTeam() const
Definition: Player.cpp:23887
Definition: SharedDefines.h:1129
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:162
Definition: SharedDefines.h:1136
TeamId LastTeamCapture
Definition: GameObject.h:104
uint32 DefendedBroadcastHorde
Definition: GameObjectData.h:616
Definition: Battleground.h:267
bool CanInteractWithCapturePoint(Player const *target) const
Definition: GameObject.cpp:3601
uint32 DefendedEventAlliance
Definition: GameObjectData.h:626
WorldPackets::Battleground::BattlegroundCapturePointState State
Definition: GameObject.h:105
Definition: SharedDefines.h:1130
struct GameObjectValue::@211 CapturePoint
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BuildValuesCreate()

void GameObject::BuildValuesCreate ( ByteBuffer data,
Player const *  target 
) const
overrideprotectedvirtual

Implements Object.

3241 {
3243  std::size_t sizePos = data->wpos();
3244  *data << uint32(0);
3245  *data << uint8(flags);
3246  m_objectData->WriteCreate(*data, flags, this, target);
3247  m_gameObjectData->WriteCreate(*data, flags, this, target);
3248  data->put<uint32>(sizePos, data->wpos() - sizePos - 4);
3249 }
size_t wpos() const
Definition: ByteBuffer.h:412
uint16 flags
Definition: DisableMgr.cpp:49
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECT > m_objectData
Definition: Object.h:252
UF::UpdateField< UF::GameObjectData, 0, TYPEID_GAMEOBJECT > m_gameObjectData
Definition: GameObject.h:393
uint32_t uint32
Definition: Define.h:143
virtual UF::UpdateFieldFlag GetUpdateFieldFlagsFor(Player const *target) const
Definition: Object.cpp:736
uint8_t uint8
Definition: Define.h:145
UpdateFieldFlag
Definition: UpdateField.h:33
void put(std::size_t pos, T value)
Definition: ByteBuffer.h:220
+ Here is the call graph for this function:

◆ BuildValuesUpdate()

void GameObject::BuildValuesUpdate ( ByteBuffer data,
Player const *  target 
) const
overrideprotectedvirtual

Implements Object.

3252 {
3254  std::size_t sizePos = data->wpos();
3255  *data << uint32(0);
3257 
3259  m_objectData->WriteUpdate(*data, flags, this, target);
3260 
3262  m_gameObjectData->WriteUpdate(*data, flags, this, target);
3263 
3264  data->put<uint32>(sizePos, data->wpos() - sizePos - 4);
3265 }
size_t wpos() const
Definition: ByteBuffer.h:412
uint16 flags
Definition: DisableMgr.cpp:49
uint32 GetChangedObjectTypeMask() const
Definition: UpdateField.h:670
bool HasChanged(uint32 index) const
Definition: UpdateField.h:675
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECT > m_objectData
Definition: Object.h:252
Definition: ObjectGuid.h:42
UF::UpdateField< UF::GameObjectData, 0, TYPEID_GAMEOBJECT > m_gameObjectData
Definition: GameObject.h:393
uint32_t uint32
Definition: Define.h:143
Definition: ObjectGuid.h:34
virtual UF::UpdateFieldFlag GetUpdateFieldFlagsFor(Player const *target) const
Definition: Object.cpp:736
UF::UpdateFieldHolder m_values
Definition: Object.h:251
UpdateFieldFlag
Definition: UpdateField.h:33
void put(std::size_t pos, T value)
Definition: ByteBuffer.h:220
+ Here is the call graph for this function:

◆ BuildValuesUpdateForPlayerWithMask()

void GameObject::BuildValuesUpdateForPlayerWithMask ( UpdateData data,
UF::ObjectData::Mask const &  requestedObjectMask,
UF::GameObjectData::Mask const &  requestedGameObjectMask,
Player const *  target 
) const
3269 {
3271  if (requestedObjectMask.IsAnySet())
3272  valuesMask.Set(TYPEID_OBJECT);
3273 
3274  if (requestedGameObjectMask.IsAnySet())
3275  valuesMask.Set(TYPEID_GAMEOBJECT);
3276 
3278  std::size_t sizePos = buffer.wpos();
3279  buffer << uint32(0);
3280  buffer << uint32(valuesMask.GetBlock(0));
3281 
3282  if (valuesMask[TYPEID_OBJECT])
3283  m_objectData->WriteUpdate(buffer, requestedObjectMask, true, this, target);
3284 
3285  if (valuesMask[TYPEID_GAMEOBJECT])
3286  m_gameObjectData->WriteUpdate(buffer, requestedGameObjectMask, true, this, target);
3287 
3288  buffer.put<uint32>(sizePos, buffer.wpos() - sizePos - 4);
3289 
3290  data->AddUpdateBlock(buffer);
3291 }
size_t wpos() const
Definition: ByteBuffer.h:412
Definition: ByteBuffer.h:61
void AddUpdateBlock(ByteBuffer const &block)
Definition: UpdateData.cpp:40
uint32 GetBlock(uint32 index) const
Definition: UpdateMask.h:53
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECT > m_objectData
Definition: Object.h:252
Definition: ObjectGuid.h:42
UF::UpdateField< UF::GameObjectData, 0, TYPEID_GAMEOBJECT > m_gameObjectData
Definition: GameObject.h:393
void Set(uint32 index)
Definition: UpdateMask.h:84
uint32_t uint32
Definition: Define.h:143
ByteBuffer PrepareValuesUpdateBuffer() const
Definition: Object.cpp:233
Definition: ObjectGuid.h:34
void put(std::size_t pos, T value)
Definition: ByteBuffer.h:220
+ Here is the call graph for this function:

◆ CanInteractWithCapturePoint()

bool GameObject::CanInteractWithCapturePoint ( Player const *  target) const
3602 {
3604  return false;
3605 
3607  return true;
3608 
3609  if (target->GetBGTeam() == HORDE)
3610  {
3613  }
3614 
3615  // For Alliance players
3618 }
Definition: SharedDefines.h:2774
GameObjectTemplate const * m_goInfo
Definition: GameObject.h:421
GameObjectValue m_goValue
Definition: GameObject.h:425
Definition: SharedDefines.h:1136
WorldPackets::Battleground::BattlegroundCapturePointState State
Definition: GameObject.h:105
uint32 type
Definition: GameObjectData.h:33
struct GameObjectValue::@211 CapturePoint
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CleanupsBeforeDelete()

void GameObject::CleanupsBeforeDelete ( bool  finalCleanup = true)
overridevirtual

Reimplemented from WorldObject.

Reimplemented in Transport.

555 {
556  WorldObject::CleanupsBeforeDelete(finalCleanup);
557 
558  RemoveFromOwner();
559 }
virtual void CleanupsBeforeDelete(bool finalCleanup=true)
Definition: Object.cpp:892
void RemoveFromOwner()
Definition: GameObject.cpp:561
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClearSkillupList()

void GameObject::ClearSkillupList ( )
inline
272 { m_SkillupList.clear(); }
GuidSet m_SkillupList
Definition: GameObject.h:411

◆ ClearUpdateMask()

void GameObject::ClearUpdateMask ( bool  remove)
overrideprotectedvirtual

Reimplemented from Object.

3305 {
3307  Object::ClearUpdateMask(remove);
3308 }
virtual void ClearUpdateMask(bool remove)
Definition: Object.cpp:756
void ClearChangesMask(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:664
UF::UpdateField< UF::GameObjectData, 0, TYPEID_GAMEOBJECT > m_gameObjectData
Definition: GameObject.h:393
UF::UpdateFieldHolder m_values
Definition: Object.h:251
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Create()

bool GameObject::Create ( uint32  entry,
Map map,
Position const &  pos,
QuaternionData const &  rotation,
uint32  animProgress,
GOState  goState,
uint32  artKit,
bool  dynamic,
ObjectGuid::LowType  spawnid 
)
private
633 {
634  ASSERT(map);
635  SetMap(map);
636 
637  Relocate(pos);
639  if (!IsPositionValid())
640  {
641  TC_LOG_ERROR("misc", "Gameobject (Spawn id: " UI64FMTD " Entry: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", GetSpawnId(), entry, pos.GetPositionX(), pos.GetPositionY());
642  return false;
643  }
644 
645  // Set if this object can handle dynamic spawns
646  if (!dynamic)
648 
650 
651  SetZoneScript();
652  if (m_zoneScript)
653  {
654  entry = m_zoneScript->GetGameObjectEntry(m_spawnId, entry);
655  if (!entry)
656  return false;
657  }
658 
659  GameObjectTemplate const* goInfo = sObjectMgr->GetGameObjectTemplate(entry);
660  if (!goInfo)
661  {
662  TC_LOG_ERROR("sql.sql", "Gameobject (Spawn id: " UI64FMTD " Entry: %u) not created: non-existing entry in `gameobject_template`. Map: %u (X: %f Y: %f Z: %f)", GetSpawnId(), entry, map->GetId(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
663  return false;
664  }
665 
667  {
668  TC_LOG_ERROR("sql.sql", "Gameobject (Spawn id: " UI64FMTD " Entry: %u) not created: gameobject type GAMEOBJECT_TYPE_MAP_OBJ_TRANSPORT cannot be manually created.", GetSpawnId(), entry);
669  return false;
670  }
671 
672  ObjectGuid guid;
673  if (goInfo->type != GAMEOBJECT_TYPE_TRANSPORT)
674  guid = ObjectGuid::Create<HighGuid::GameObject>(map->GetId(), goInfo->entry, map->GenerateLowGuid<HighGuid::GameObject>());
675  else
676  {
677  guid = ObjectGuid::Create<HighGuid::Transport>(map->GenerateLowGuid<HighGuid::Transport>());
678  m_updateFlag.ServerTime = true;
679  }
680 
681  Object::_Create(guid);
682 
683  m_goInfo = goInfo;
684  m_goTemplateAddon = sObjectMgr->GetGameObjectTemplateAddon(entry);
685 
686  if (goInfo->type >= MAX_GAMEOBJECT_TYPE)
687  {
688  TC_LOG_ERROR("sql.sql", "Gameobject (%s Spawn id: " UI64FMTD " Entry: %u) not created: non-existing GO type '%u' in `gameobject_template`. It will crash client if created.", guid.ToString().c_str(), GetSpawnId(), entry, goInfo->type);
689  return false;
690  }
691 
692  SetLocalRotation(rotation.x, rotation.y, rotation.z, rotation.w);
693  GameObjectAddon const* gameObjectAddon = sObjectMgr->GetGameObjectAddon(GetSpawnId());
694 
695  // For most of gameobjects is (0, 0, 0, 1) quaternion, there are only some transports with not standard rotation
696  QuaternionData parentRotation;
697  if (gameObjectAddon)
698  parentRotation = gameObjectAddon->ParentRotation;
699 
700  SetParentRotation(parentRotation);
701 
702  SetObjectScale(goInfo->size);
703 
704  if (GameObjectOverride const* goOverride = GetGameObjectOverride())
705  {
706  SetFaction(goOverride->Faction);
707  ReplaceAllFlags(GameObjectFlags(goOverride->Flags));
708  }
709 
710  if (m_goTemplateAddon)
711  {
713  {
714  m_updateFlag.GameObject = true;
716  }
717 
720  }
721 
722  SetEntry(goInfo->entry);
723 
724  // set name for logs usage, doesn't affect anything ingame
725  SetName(goInfo->name);
726 
727  SetDisplayId(goInfo->displayId);
728 
729  CreateModel();
730  // GAMEOBJECT_BYTES_1, index at 0, 1, 2 and 3
731  SetGoType(GameobjectTypes(goInfo->type));
732  m_prevGoState = goState;
733  SetGoState(goState);
734  SetGoArtKit(artKit);
735 
737 
738  switch (goInfo->type)
739  {
741  SetGoAnimProgress(animProgress);
742  m_goValue.FishingHole.MaxOpens = urand(GetGOInfo()->fishingHole.minRestock, GetGOInfo()->fishingHole.maxRestock);
743  break;
745  {
746  // TODO: Get the values somehow, no longer in gameobject_template
747  m_goValue.Building.Health = 20000/*goinfo->destructibleBuilding.intactNumHits + goinfo->destructibleBuilding.damagedNumHits*/;
749  SetGoAnimProgress(255);
750  // yes, even after the updatefield rewrite this garbage hack is still in client
751  QuaternionData reinterpretId;
752  memcpy(&reinterpretId.x, &m_goInfo->destructibleBuilding.DestructibleModelRec, sizeof(float));
754  break;
755  }
757  {
758  m_goTypeImpl = std::make_unique<GameObjectType::Transport>(*this);
759  if (goInfo->transport.startOpen)
761  else
763 
764  SetGoAnimProgress(animProgress);
765  setActive(true);
766  break;
767  }
769  SetLevel(1);
770  SetGoAnimProgress(255);
771  break;
773  if (GetGOInfo()->trap.stealthed)
774  {
777  }
778 
779  if (GetGOInfo()->trap.stealthAffected)
780  {
783  }
784  break;
786  RemoveFlag(GameObjectFlags(0xF00));
787  SetFlag(GameObjectFlags((m_goInfo->phaseableMO.AreaNameSet & 0xF) << 8));
788  break;
795  break;
796  default:
797  SetGoAnimProgress(animProgress);
798  break;
799  }
800 
801  if (gameObjectAddon)
802  {
803  if (gameObjectAddon->InvisibilityValue)
804  {
805  m_invisibility.AddFlag(gameObjectAddon->invisibilityType);
806  m_invisibility.AddValue(gameObjectAddon->invisibilityType, gameObjectAddon->InvisibilityValue);
807  }
808 
809  if (gameObjectAddon->WorldEffectID)
810  {
811  m_updateFlag.GameObject = true;
812  SetWorldEffectID(gameObjectAddon->WorldEffectID);
813  }
814 
815  if (gameObjectAddon->AIAnimKitID)
816  _animKitId = gameObjectAddon->AIAnimKitID;
817  }
818 
820  AIM_Initialize();
821 
822  // Initialize loot duplicate count depending on raid difficulty
823  if (map->Is25ManRaid())
824  loot.maxDuplicates = 3;
825 
826  if (spawnid)
827  m_spawnId = spawnid;
828 
829  if (uint32 linkedEntry = GetGOInfo()->GetLinkedGameObjectEntry())
830  {
831  if (GameObject* linkedGo = GameObject::CreateGameObject(linkedEntry, map, pos, rotation, 255, GO_STATE_READY))
832  {
833  SetLinkedTrap(linkedGo);
834  if (!map->AddToMap(linkedGo))
835  delete linkedGo;
836  }
837  }
838 
839  // Check if GameObject is Infinite
840  if (goInfo->IsInfiniteGameObject())
842 
843  // Check if GameObject is Gigantic
844  if (goInfo->IsGiganticGameObject())
846 
847  // Check if GameObject is Large
848  if (goInfo->IsLargeGameObject())
850 
851  return true;
852 }
#define MAX_GAMEOBJECT_TYPE
Definition: SharedDefines.h:2795
void SetFlag(GameObjectFlags flags)
Definition: GameObject.h:232
void CreateModel()
Definition: GameObject.cpp:3653
#define sDB2Manager
Definition: DB2Stores.h:479
bool AIM_Initialize()
Definition: GameObject.cpp:536
struct GameObjectTemplate::@212::@257 phaseableMO
uint32 AIAnimKitID
Definition: GameObjectData.h:1092
QuaternionData ParentRotation
Definition: GameObjectData.h:1105
void SetRespawnCompatibilityMode(bool mode=true)
Definition: GameObject.h:329
bool Is25ManRaid() const
Definition: Map.cpp:4447
void SetLinkedTrap(GameObject *linkedTrap)
Definition: GameObject.h:293
void SetParentRotation(QuaternionData const &rotation)
Definition: GameObject.cpp:2884
uint32 WorldEffectID
Definition: GameObjectData.h:1108
void _Create(ObjectGuid const &guid)
Definition: Object.cpp:116
Definition: SharedDefines.h:2774
Definition: SharedDefines.h:2841
uint32 minRestock
Definition: GameObjectData.h:99
uint32 GetLinkedGameObjectEntry() const
Definition: GameObjectData.h:922
std::string ToString() const
Definition: ObjectGuid.cpp:531
UpdateField< QuaternionData, 0, 12 > ParentRotation
Definition: UpdateFields.h:804
Definition: GameObjectData.h:1103
Definition: SharedDefines.h:2357
bool IsLargeGameObject() const
Definition: GameObjectData.h:1038
bool GameObject
Definition: Object.h:92
struct GameObjectTemplate::@212::@225 transport
void SetFaction(uint32 faction) override
Definition: GameObject.h:341
struct GameObjectTemplate::@212::@256 capturePoint
Definition: GameObjectData.h:1079
void SetGoType(GameobjectTypes type)
Definition: GameObject.h:238
bool IsGiganticGameObject() const
Definition: GameObjectData.h:1008
Position m_stationaryPosition
Definition: GameObject.h:429
struct GameObjectValue::@208 FishingHole
CreateObjectBits m_updateFlag
Definition: Object.h:385
void setActive(bool isActiveObject)
Definition: Object.cpp:852
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:185
UpdateField< uint32, 0, 6 > SpawnTrackingStateAnimID
Definition: UpdateFields.h:797
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:657
virtual void SetMap(Map *map)
Definition: Object.cpp:1698
void UpdatePositionData()
Definition: Object.cpp:901
GOState m_prevGoState
Definition: GameObject.h:409
Definition: GameObjectData.h:30
void RemoveFlag(GameObjectFlags flags)
Definition: GameObject.h:233
uint32 WorldEffectID
Definition: GameObjectData.h:1091
void SetLocalRotation(float qx, float qy, float qz, float qw)
Definition: GameObject.cpp:2873
uint32 displayId
Definition: GameObjectData.h:34
void SetEntry(uint32 entry)
Definition: Object.h:159
uint32 AIAnimKitID
Definition: GameObjectData.h:1109
Definition: SharedDefines.h:2749
float size
Definition: GameObjectData.h:39
void SetGoAnimProgress(uint8 animprogress)
Definition: GameObject.h:244
#define sObjectMgr
Definition: ObjectMgr.h:1967
bool ServerTime
Definition: Object.h:87
GameObjectTemplate const * m_goInfo
Definition: GameObject.h:421
void ReplaceAllFlags(GameObjectFlags flags)
Definition: GameObject.h:234
uint32 GetId() const
Definition: Map.cpp:4410
GameobjectTypes
Definition: SharedDefines.h:2730
Definition: SharedDefines.h:1131
void UpdateCapturePoint()
Definition: GameObject.cpp:3542
Definition: SharedDefines.h:2775
void SetDisplayId(uint32 displayid)
Definition: GameObject.cpp:3112
uint32 AssaultTimer
Definition: GameObject.h:106
struct GameObjectTemplate::@212::@247 destructibleBuilding
void Relocate(float x, float y)
Definition: Position.h:64
uint32 stealthAffected
Definition: GameObjectData.h:164
uint32 MaxOpens
Definition: GameObject.h:88
void SetWorldEffectID(uint32 worldEffectID)
Definition: GameObject.h:377
ZoneScript * m_zoneScript
Definition: Object.h:729
uint32 maxRestock
Definition: GameObjectData.h:100
Definition: SharedDefines.h:2747
GameObjectValue m_goValue
Definition: GameObject.h:425
GameObjectFlags
Definition: SharedDefines.h:2798
bool AddToMap(T *)
Definition: Map.cpp:745
#define UI64FMTD
Definition: Define.h:127
void SetUpdateFieldValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
Definition: Object.h:268
UF::UpdateField< UF::GameObjectData, 0, TYPEID_GAMEOBJECT > m_gameObjectData
Definition: GameObject.h:393
uint32_t uint32
Definition: Define.h:143
static GameObject * CreateGameObject(uint32 entry, Map *map, Position const &pos, QuaternionData const &rotation, uint32 animProgress, GOState goState, uint32 artKit=0)
Definition: GameObject.cpp:854
Loot loot
Definition: GameObject.h:282
virtual uint32 GetGameObjectEntry(ObjectGuid::LowType, uint32 entry)
Definition: ZoneScript.h:42
Definition: GameObject.h:125
Definition: SharedDefines.h:2347
void AddValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:423
uint32 entry
Definition: GameObjectData.h:32
std::unique_ptr< GameObjectTypeBase > m_goTypeImpl
Definition: GameObject.h:424
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:162
uint32 ScriptId
Definition: GameObjectData.h:810
InvisibilityType invisibilityType
Definition: GameObjectData.h:1106
ObjectGuid::LowType GetSpawnId() const
Definition: GameObject.h:172
void AddFlag(FLAG_TYPE flag)
Definition: Object.h:418
Definition: SharedDefines.h:2757
Definition: SharedDefines.h:2844
bool IsInfiniteGameObject() const
Definition: GameObjectData.h:994
void SetGoState(GOState state)
Definition: GameObject.cpp:3088
uint8 maxDuplicates
Definition: Loot.h:221
Definition: QuaternionData.h:23
TeamId LastTeamCapture
Definition: GameObject.h:104
GameObjectTemplateAddon const * m_goTemplateAddon
Definition: GameObject.h:422
std::string name
Definition: GameObjectData.h:35
virtual void SetObjectScale(float scale)
Definition: Object.h:162
UpdateField< uint32, 0, 4 > SpellVisualID
Definition: UpdateFields.h:795
void SetZoneScript()
Definition: Object.cpp:1913
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
void SetLevel(uint32 level)
Definition: GameObject.h:236
uint32 Health
Definition: GameObject.h:98
GameObjectOverride const * GetGameObjectOverride() const
Definition: GameObject.cpp:1336
struct GameObjectValue::@210 Building
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealth
Definition: Object.h:544
#define ASSERT
Definition: Errors.h:68
Definition: SharedDefines.h:2843
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibility
Definition: Object.h:547
Definition: ObjectGuid.h:258
void SetVisibilityDistanceOverride(VisibilityDistanceType type)
Definition: Object.cpp:875
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:600
WorldPackets::Battleground::BattlegroundCapturePointState State
Definition: GameObject.h:105
void SetName(std::string newname)
Definition: Object.h:489
UF::UpdateFieldHolder m_values
Definition: Object.h:251
uint32 stealthed
Definition: GameObjectData.h:162
Definition: SharedDefines.h:2765
Definition: SharedDefines.h:2743
Definition: SharedDefines.h:2738
void SetGoArtKit(uint32 artkit)
Definition: GameObject.cpp:2087
uint32 MaxHealth
Definition: GameObject.h:99
uint32 type
Definition: GameObjectData.h:33
ObjectGuid::LowType m_spawnId
For new or temporary gameobjects is 0 for saved it is lowguid.
Definition: GameObject.h:420
float x
Definition: QuaternionData.h:25
uint32 InvisibilityValue
Definition: GameObjectData.h:1107
uint16 _animKitId
Definition: GameObject.h:452
bool IsPositionValid() const
Definition: Position.cpp:42
uint32 LastUsedScriptID
Definition: Object.h:676
struct GameObjectValue::@211 CapturePoint
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateGameObject()

GameObject * GameObject::CreateGameObject ( uint32  entry,
Map map,
Position const &  pos,
QuaternionData const &  rotation,
uint32  animProgress,
GOState  goState,
uint32  artKit = 0 
)
static
855 {
856  GameObjectTemplate const* goInfo = sObjectMgr->GetGameObjectTemplate(entry);
857  if (!goInfo)
858  return nullptr;
859 
860  GameObject* go = new GameObject();
861  if (!go->Create(entry, map, pos, rotation, animProgress, goState, artKit, false, 0))
862  {
863  delete go;
864  return nullptr;
865  }
866 
867  return go;
868 }
Definition: GameObjectData.h:30
GameObject()
Definition: GameObject.cpp:490
#define sObjectMgr
Definition: ObjectMgr.h:1967
Definition: GameObject.h:125
bool Create(uint32 entry, Map *map, Position const &pos, QuaternionData const &rotation, uint32 animProgress, GOState goState, uint32 artKit, bool dynamic, ObjectGuid::LowType spawnid)
Definition: GameObject.cpp:632
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateGameObjectFromDB()

GameObject * GameObject::CreateGameObjectFromDB ( ObjectGuid::LowType  spawnId,
Map map,
bool  addToMap = true 
)
static
871 {
872  GameObject* go = new GameObject();
873  if (!go->LoadFromDB(spawnId, map, addToMap))
874  {
875  delete go;
876  return nullptr;
877  }
878 
879  return go;
880 }
GameObject()
Definition: GameObject.cpp:490
Definition: GameObject.h:125
bool LoadFromDB(ObjectGuid::LowType spawnId, Map *map, bool addToMap, bool=true)
Definition: GameObject.cpp:1550
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateModel()

void GameObject::CreateModel ( )
protected
3654 {
3655  m_model = GameObjectModel::Create(std::make_unique<GameObjectModelOwnerImpl>(this), sWorld->GetDataPath());
3656  if (m_model && m_model->isMapObject())
3658 }
void SetFlag(GameObjectFlags flags)
Definition: GameObject.h:232
static GameObjectModel * Create(std::unique_ptr< GameObjectModelOwnerBase > modelOwner, std::string const &dataPath)
Definition: GameObjectModel.cpp:151
#define sWorld
Definition: World.h:946
GameObjectModel * m_model
Definition: GameObject.h:343
Definition: SharedDefines.h:2817
bool isMapObject() const
Definition: GameObjectModel.h:74
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Delete()

void GameObject::Delete ( )
1385 {
1387  RemoveFromOwner();
1388 
1390  {
1392  SendMessageToSet(packet.Write(), true);
1393  }
1394 
1396 
1398 
1399  if (GameObjectOverride const* goOverride = GetGameObjectOverride())
1400  ReplaceAllFlags(GameObjectFlags(goOverride->Flags));
1401 
1402  uint32 poolid = GetGameObjectData() ? GetGameObjectData()->poolId : 0;
1403  if (poolid)
1404  sPoolMgr->UpdatePool<GameObject>(GetMap()->GetPoolData(), poolid, GetSpawnId());
1405  else
1407 }
Definition: SharedDefines.h:2774
Definition: SharedDefines.h:2841
uint32 poolId
Definition: SpawnData.h:110
Definition: GameObjectData.h:1079
void RemoveFromOwner()
Definition: GameObject.cpp:561
GameObjectTemplate const * m_goInfo
Definition: GameObject.h:421
void ReplaceAllFlags(GameObjectFlags flags)
Definition: GameObject.h:234
void SendGameObjectDespawn()
Definition: GameObject.cpp:1409
Map * GetMap() const
Definition: Object.h:555
ObjectGuid const & GetGUID() const
Definition: Object.h:157
GameObjectData const * GetGameObjectData() const
Definition: GameObject.h:165
#define sPoolMgr
Definition: PoolMgr.h:179
void AddObjectToRemoveList()
Definition: Object.cpp:1728
GameObjectFlags
Definition: SharedDefines.h:2798
void SetLootState(LootState s, Unit *unit=nullptr)
Definition: GameObject.cpp:3055
Definition: BattlegroundPackets.h:530
uint32_t uint32
Definition: Define.h:143
Definition: GameObject.h:125
ObjectGuid::LowType GetSpawnId() const
Definition: GameObject.h:172
void SetGoState(GOState state)
Definition: GameObject.cpp:3088
SpawnedPoolData & GetPoolData()
Definition: Map.h:812
Definition: GameObject.h:116
GameObjectOverride const * GetGameObjectOverride() const
Definition: GameObject.cpp:1336
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition: Object.cpp:1648
uint32 type
Definition: GameObjectData.h:33
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DeleteFromDB()

bool GameObject::DeleteFromDB ( ObjectGuid::LowType  spawnId)
static
1619 {
1620  GameObjectData const* data = sObjectMgr->GetGameObjectData(spawnId);
1621  if (!data)
1622  return false;
1623 
1624  CharacterDatabaseTransaction charTrans = CharacterDatabase.BeginTransaction();
1625 
1626  sMapMgr->DoForAllMapsWithMapId(data->mapId,
1627  [spawnId, charTrans](Map* map) -> void
1628  {
1629  // despawn all active objects, and remove their respawns
1630  std::vector<GameObject*> toUnload;
1631  for (auto const& pair : Trinity::Containers::MapEqualRange(map->GetGameObjectBySpawnIdStore(), spawnId))
1632  toUnload.push_back(pair.second);
1633  for (GameObject* obj : toUnload)
1634  map->AddObjectToRemoveList(obj);
1635  map->RemoveRespawnTime(SPAWN_TYPE_GAMEOBJECT, spawnId, charTrans);
1636  }
1637  );
1638 
1639  // delete data from memory
1640  sObjectMgr->DeleteGameObjectData(spawnId);
1641 
1642  CharacterDatabase.CommitTransaction(charTrans);
1643 
1644  WorldDatabaseTransaction trans = WorldDatabase.BeginTransaction();
1645 
1646  // ... and the database
1648  stmt->setUInt64(0, spawnId);
1649  trans->Append(stmt);
1650 
1651  stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_SPAWNGROUP_MEMBER);
1653  stmt->setUInt64(1, spawnId);
1654  trans->Append(stmt);
1655 
1656  stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_EVENT_GAMEOBJECT);
1657  stmt->setUInt64(0, spawnId);
1658  trans->Append(stmt);
1659 
1660  stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_LINKED_RESPAWN);
1661  stmt->setUInt64(0, spawnId);
1663  trans->Append(stmt);
1664 
1665  stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_LINKED_RESPAWN);
1666  stmt->setUInt64(0, spawnId);
1668  trans->Append(stmt);
1669 
1670  stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_LINKED_RESPAWN_MASTER);
1671  stmt->setUInt64(0, spawnId);
1673  trans->Append(stmt);
1674 
1675  stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_LINKED_RESPAWN_MASTER);
1676  stmt->setUInt64(0, spawnId);
1678  trans->Append(stmt);
1679 
1680  stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAMEOBJECT_ADDON);
1681  stmt->setUInt64(0, spawnId);
1682  trans->Append(stmt);
1683 
1684  WorldDatabase.CommitTransaction(trans);
1685 
1686  return true;
1687 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: WorldDatabase.h:100
Definition: SpawnData.h:123
uint32 mapId
Definition: SpawnData.h:94
Definition: SpawnData.h:35
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:36
#define sObjectMgr
Definition: ObjectMgr.h:1967
Definition: DatabaseEnvFwd.h:40
Definition: WorldDatabase.h:37
Definition: WorldDatabase.h:31
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:48
SQLTransaction< WorldDatabaseConnection > WorldDatabaseTransaction
Definition: DatabaseEnvFwd.h:75
Definition: Map.h:264
Definition: SpawnData.h:122
Definition: GameObjectData.h:1113
#define sMapMgr
Definition: MapManager.h:215
uint8_t uint8
Definition: Define.h:145
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
Definition: WorldDatabase.h:32
Definition: SpawnData.h:124
Definition: WorldDatabase.h:101
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:54
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
Definition: DatabaseEnvFwd.h:72
Definition: WorldDatabase.h:38
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DespawnOrUnsummon()

void GameObject::DespawnOrUnsummon ( Milliseconds  delay = 0ms,
Seconds  forceRespawnTime = 0s 
)
1364 {
1365  if (delay > 0ms)
1366  {
1367  if (!m_despawnDelay || m_despawnDelay > delay.count())
1368  {
1369  m_despawnDelay = delay.count();
1370  m_despawnRespawnTime = forceRespawnTime;
1371  }
1372  }
1373  else
1374  {
1375  if (m_goData)
1376  {
1377  uint32 const respawnDelay = (forceRespawnTime > 0s) ? forceRespawnTime.count() : m_goData->spawntimesecs;
1378  SaveRespawnTime(respawnDelay);
1379  }
1380  Delete();
1381  }
1382 }
int32 spawntimesecs
Definition: SpawnData.h:111
GameObjectData const * m_goData
Definition: GameObject.h:423
Seconds m_despawnRespawnTime
Definition: GameObject.h:402
uint32_t uint32
Definition: Define.h:143
uint32 m_despawnDelay
Definition: GameObject.h:401
void SaveRespawnTime(uint32 forceDelay=0)
Definition: GameObject.cpp:1732
void Delete()
Definition: GameObject.cpp:1384
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EnableCollision()

void GameObject::EnableCollision ( bool  enable)
3152 {
3153  if (!m_model)
3154  return;
3155 
3156  /*if (enable && !GetMap()->ContainsGameObjectModel(*m_model))
3157  GetMap()->InsertGameObjectModel(*m_model);*/
3158 
3159  m_model->enableCollision(enable);
3160 }
GameObjectModel * m_model
Definition: GameObject.h:343
void enableCollision(bool enable)
Definition: GameObjectModel.h:72
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAIAnimKitId()

uint16 GameObject::GetAIAnimKitId ( ) const
inlineoverridevirtual

Reimplemented from WorldObject.

373 { return _animKitId; }
uint16 _animKitId
Definition: GameObject.h:452

◆ GetAIName()

std::string const & GameObject::GetAIName ( ) const
550 {
551  return sObjectMgr->GetGameObjectTemplate(GetEntry())->AIName;
552 }
#define sObjectMgr
Definition: ObjectMgr.h:1967
uint32 GetEntry() const
Definition: Object.h:158
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDebugInfo()

std::string GameObject::GetDebugInfo ( ) const
overridevirtual

Reimplemented from Object.

Reimplemented in Transport.

3661 {
3662  std::stringstream sstr;
3663  sstr << WorldObject::GetDebugInfo() << "\n"
3664  << "SpawnId: " << GetSpawnId() << " GoState: " << std::to_string(GetGoState()) << " ScriptId: " << GetScriptId() << " AIName: " << GetAIName();
3665  return sstr.str();
3666 }
uint32 GetScriptId() const
Definition: GameObject.cpp:2838
std::string GetDebugInfo() const override
Definition: Object.cpp:3613
ObjectGuid::LowType GetSpawnId() const
Definition: GameObject.h:172
GOState GetGoState() const
Definition: GameObject.h:239
std::string const & GetAIName() const
Definition: GameObject.cpp:549
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDestructibleState()

GameObjectDestructibleState GameObject::GetDestructibleState ( ) const
inline
320  {
321  if ((*m_gameObjectData->Flags & GO_FLAG_DESTROYED))
323  if ((*m_gameObjectData->Flags & GO_FLAG_DAMAGED))
325  return GO_DESTRUCTIBLE_INTACT;
326  }
Definition: SharedDefines.h:2810
Definition: SharedDefines.h:2853
Definition: SharedDefines.h:2852
Definition: SharedDefines.h:2854
Definition: SharedDefines.h:2811
UF::UpdateField< UF::GameObjectData, 0, TYPEID_GAMEOBJECT > m_gameObjectData
Definition: GameObject.h:393
+ Here is the caller graph for this function:

◆ GetDisplayId()

uint32 GameObject::GetDisplayId ( ) const
inline
337 { return m_gameObjectData->DisplayID; }
UF::UpdateField< UF::GameObjectData, 0, TYPEID_GAMEOBJECT > m_gameObjectData
Definition: GameObject.h:393
+ Here is the caller graph for this function:

◆ GetFaction()

uint32 GameObject::GetFaction ( ) const
inlineoverridevirtual

Implements WorldObject.

340 { return m_gameObjectData->FactionTemplate; }
UF::UpdateField< UF::GameObjectData, 0, TYPEID_GAMEOBJECT > m_gameObjectData
Definition: GameObject.h:393
+ Here is the caller graph for this function:

◆ getFishLoot()

void GameObject::getFishLoot ( Loot loot,
Player loot_owner 
)
1417 {
1418  fishloot->clear();
1419 
1420  uint32 zone, subzone;
1421  uint32 defaultzone = 1;
1422  GetZoneAndAreaId(zone, subzone);
1423 
1424  // if subzone loot exist use it
1425  fishloot->FillLoot(subzone, LootTemplates_Fishing, loot_owner, true, true);
1426  if (fishloot->empty()) //use this becase if zone or subzone has set LOOT_MODE_JUNK_FISH,Even if no normal drop, fishloot->FillLoot return true. it wrong.
1427  {
1428  //subzone no result,use zone loot
1429  fishloot->FillLoot(zone, LootTemplates_Fishing, loot_owner, true, true);
1430  //use zone 1 as default, somewhere fishing got nothing,becase subzone and zone not set, like Off the coast of Storm Peaks.
1431  if (fishloot->empty())
1432  fishloot->FillLoot(defaultzone, LootTemplates_Fishing, loot_owner, true, true);
1433  }
1434 }
void GetZoneAndAreaId(uint32 &zoneid, uint32 &areaid) const
Definition: Object.h:481
uint32_t uint32
Definition: Define.h:143
LootStore LootTemplates_Fishing("fishing_loot_template", "area id", true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFishLootJunk()

void GameObject::getFishLootJunk ( Loot loot,
Player loot_owner 
)
1437 {
1438  fishloot->clear();
1439 
1440  uint32 zone, subzone;
1441  uint32 defaultzone = 1;
1442  GetZoneAndAreaId(zone, subzone);
1443 
1444  // if subzone loot exist use it
1445  fishloot->FillLoot(subzone, LootTemplates_Fishing, loot_owner, true, true, LOOT_MODE_JUNK_FISH);
1446  if (fishloot->empty()) //use this becase if zone or subzone has normal mask drop, then fishloot->FillLoot return true.
1447  {
1448  //use zone loot
1449  fishloot->FillLoot(zone, LootTemplates_Fishing, loot_owner, true, true, LOOT_MODE_JUNK_FISH);
1450  if (fishloot->empty())
1451  //use zone 1 as default
1452  fishloot->FillLoot(defaultzone, LootTemplates_Fishing, loot_owner, true, true, LOOT_MODE_JUNK_FISH);
1453  }
1454 }
void GetZoneAndAreaId(uint32 &zoneid, uint32 &areaid) const
Definition: Object.h:481
uint32_t uint32
Definition: Define.h:143
Definition: SharedDefines.h:75
LootStore LootTemplates_Fishing("fishing_loot_template", "area id", true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetGameObjectData()

GameObjectData const* GameObject::GetGameObjectData ( ) const
inline
165 { return m_goData; }
GameObjectData const * m_goData
Definition: GameObject.h:423
+ Here is the caller graph for this function:

◆ GetGameObjectOverride()

GameObjectOverride const * GameObject::GetGameObjectOverride ( ) const
1337 {
1338  if (m_spawnId)
1339  {
1340  if (GameObjectOverride const* goOverride = sObjectMgr->GetGameObjectOverride(m_spawnId))
1341  return goOverride;
1342  }
1343 
1344  return m_goTemplateAddon;
1345 }
Definition: GameObjectData.h:1079
#define sObjectMgr
Definition: ObjectMgr.h:1967
GameObjectTemplateAddon const * m_goTemplateAddon
Definition: GameObject.h:422
ObjectGuid::LowType m_spawnId
For new or temporary gameobjects is 0 for saved it is lowguid.
Definition: GameObject.h:420
+ Here is the caller graph for this function:

◆ GetGoAnimProgress()

uint8 GameObject::GetGoAnimProgress ( ) const
inline
243 { return m_gameObjectData->PercentHealth; }
UF::UpdateField< UF::GameObjectData, 0, TYPEID_GAMEOBJECT > m_gameObjectData
Definition: GameObject.h:393
+ Here is the caller graph for this function:

◆ GetGoArtKit()

uint32 GameObject::GetGoArtKit ( ) const
inline
241 { return m_gameObjectData->ArtKit; }
UF::UpdateField< UF::GameObjectData, 0, TYPEID_GAMEOBJECT > m_gameObjectData
Definition: GameObject.h:393
+ Here is the caller graph for this function:

◆ GetGOInfo()

GameObjectTemplate const* GameObject::GetGOInfo ( ) const
inline
162 { return m_goInfo; }
GameObjectTemplate const * m_goInfo
Definition: GameObject.h:421
+ Here is the caller graph for this function:

◆ GetGoState()

GOState GameObject::GetGoState ( ) const
inline
239 { return GOState(*m_gameObjectData->State); }
UF::UpdateField< UF::GameObjectData, 0, TYPEID_GAMEOBJECT > m_gameObjectData
Definition: GameObject.h:393
GOState
Definition: SharedDefines.h:2838
+ Here is the caller graph for this function:

◆ GetGoType()

GameobjectTypes GameObject::GetGoType ( ) const
inline
237 { return GameobjectTypes(*m_gameObjectData->TypeID); }
GameobjectTypes
Definition: SharedDefines.h:2730
UF::UpdateField< UF::GameObjectData, 0, TYPEID_GAMEOBJECT > m_gameObjectData
Definition: GameObject.h:393
+ Here is the caller graph for this function:

◆ GetGOValue()

GameObjectValue const* GameObject::GetGOValue ( ) const
inline
166 { return &m_goValue; }
GameObjectValue m_goValue
Definition: GameObject.h:425
+ Here is the caller graph for this function:

◆ GetInteractionDistance()

float GameObject::GetInteractionDistance ( ) const
3380 {
3381  switch (GetGoType())
3382  {
3384  return 0.0f;
3386  case GAMEOBJECT_TYPE_TEXT:
3390  return 5.5555553f;
3392  return 10.0f;
3393  case GAMEOBJECT_TYPE_CHAIR:
3395  return 3.0f;
3397  return 100.0f;
3399  return 20.0f + CONTACT_DISTANCE; // max spell range
3404  case GAMEOBJECT_TYPE_DOOR:
3405  return 5.0f;
3406  // Following values are not blizzlike
3409  // Successful mailbox interaction is rather critical to the client, failing it will start a minute-long cooldown until the next mail query may be executed.
3410  // And since movement info update is not sent with mailbox interaction query, server may find the player outside of interaction range. Thus we increase it.
3411  return 10.0f; // 5.0f is blizzlike
3412  default:
3413  return INTERACTION_DISTANCE;
3414  }
3415 }
Definition: SharedDefines.h:2763
Definition: SharedDefines.h:2741
Definition: SharedDefines.h:2758
Definition: SharedDefines.h:2746
Definition: SharedDefines.h:2749
#define CONTACT_DISTANCE
Definition: ObjectDefines.h:23
Definition: SharedDefines.h:2766
Definition: SharedDefines.h:2736
Definition: SharedDefines.h:2745
GameobjectTypes GetGoType() const
Definition: GameObject.h:237
Definition: SharedDefines.h:2751
Definition: SharedDefines.h:2756
Definition: SharedDefines.h:2757
Definition: SharedDefines.h:2734
Definition: SharedDefines.h:2739
#define INTERACTION_DISTANCE
Definition: ObjectDefines.h:24
Definition: SharedDefines.h:2764
Definition: SharedDefines.h:2744
Definition: SharedDefines.h:2765
Definition: SharedDefines.h:2759
Definition: SharedDefines.h:2732
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetLevelForTarget()

uint8 GameObject::GetLevelForTarget ( WorldObject const *  target) const
overridevirtual

Reimplemented from WorldObject.

1804 {
1805  if (Unit* owner = GetOwner())
1806  return owner->GetLevelForTarget(target);
1807 
1809  {
1810  if (Player const* player = target->ToPlayer())
1811  if (Optional<ContentTuningLevels> userLevels = sDB2Manager.GetContentTuningData(GetGOInfo()->ContentTuningId, player->m_playerData->CtrOptions->ContentTuningConditionMask))
1812  return uint8(std::clamp<int16>(player->GetLevel(), userLevels->MinLevel, userLevels->MaxLevel));
1813 
1814  if (Unit const* targetUnit = target->ToUnit())
1815  return targetUnit->GetLevel();
1816  }
1817 
1818  return 1;
1819 }
static Player * ToPlayer(Object *o)
Definition: Object.h:198
#define sDB2Manager
Definition: DB2Stores.h:479
Unit * GetOwner() const
Definition: Object.cpp:2105
GameobjectTypes GetGoType() const
Definition: GameObject.h:237
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:162
uint8_t uint8
Definition: Define.h:145
static Unit * ToUnit(Object *o)
Definition: Object.h:210
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
Definition: Unit.h:746
Definition: Player.h:1131
Definition: SharedDefines.h:2738
+ Here is the call graph for this function:

◆ GetLinkedTrap()

GameObject * GameObject::GetLinkedTrap ( )
3236 {
3238 }
ObjectGuid m_linkedTrap
Definition: GameObject.h:436
TC_GAME_API GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:176
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetLocalRotation()

QuaternionData const& GameObject::GetLocalRotation ( ) const
inline
178 { return m_localRotation; }
QuaternionData m_localRotation
Definition: GameObject.h:428
+ Here is the caller graph for this function:

◆ GetLootGenerationTime()

uint32 GameObject::GetLootGenerationTime ( ) const
inline
265 { return m_lootGenerationTime; }
uint32 m_lootGenerationTime
Definition: GameObject.h:434
+ Here is the caller graph for this function:

◆ GetLootMode()

uint16 GameObject::GetLootMode ( ) const
inline
258 { return m_LootMode; }
uint16 m_LootMode
Definition: GameObject.h:433
+ Here is the caller graph for this function:

◆ GetLootRecipient()

Player * GameObject::GetLootRecipient ( ) const
3178 {
3179  if (!m_lootRecipient)
3180  return nullptr;
3182 }
ObjectGuid m_lootRecipient
Definition: GameObject.h:431
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:273
+ Here is the call graph for this function:

◆ GetLootRecipientGroup()

Group * GameObject::GetLootRecipientGroup ( ) const
3185 {
3186  if (!m_lootRecipientGroup)
3187  return nullptr;
3188  return sGroupMgr->GetGroupByGUID(m_lootRecipientGroup);
3189 }
#define sGroupMgr
Definition: GroupMgr.h:58
ObjectGuid m_lootRecipientGroup
Definition: GameObject.h:432
+ Here is the caller graph for this function:

◆ getLootState()

LootState GameObject::getLootState ( ) const
inline
254 { return m_lootState; }
LootState m_lootState
Definition: GameObject.h:403
+ Here is the caller graph for this function:

◆ GetNameForLocaleIdx()

std::string GameObject::GetNameForLocaleIdx ( LocaleConstant  locale) const
overridevirtual

Implements Object.

2849 {
2850  if (locale != DEFAULT_LOCALE)
2851  if (GameObjectLocale const* cl = sObjectMgr->GetGameObjectLocale(GetEntry()))
2852  if (cl->Name.size() > locale && !cl->Name[locale].empty())
2853  return cl->Name[locale];
2854 
2855  return GetName();
2856 }
#define sObjectMgr
Definition: ObjectMgr.h:1967
std::string const & GetName() const
Definition: Object.h:488
Definition: GameObjectData.h:1095
uint32 GetEntry() const
Definition: Object.h:158
#define DEFAULT_LOCALE
Definition: Common.h:99
+ Here is the call graph for this function:

◆ GetNameSetId()

uint8 GameObject::GetNameSetId ( ) const
3119 {
3120  switch (GetGoType())
3121  {
3123  if (DestructibleModelDataEntry const* modelData = sDestructibleModelDataStore.LookupEntry(m_goInfo->destructibleBuilding.DestructibleModelRec))
3124  {
3125  switch (GetDestructibleState())
3126  {
3128  return modelData->State0NameSet;
3130  return modelData->State1NameSet;
3132  return modelData->State2NameSet;
3134  return modelData->State3NameSet;
3135  default:
3136  break;
3137  }
3138  }
3139  break;
3143  return ((*m_gameObjectData->Flags) >> 8) & 0xF;
3144  default:
3145  break;
3146  }
3147 
3148  return 0;
3149 }
Definition: SharedDefines.h:2770
GameObjectDestructibleState GetDestructibleState() const
Definition: GameObject.h:319
GameObjectTemplate const * m_goInfo
Definition: GameObject.h:421
Definition: DB2Structure.h:1297
Definition: SharedDefines.h:2853
Definition: SharedDefines.h:2775
Definition: SharedDefines.h:2852
struct GameObjectTemplate::@212::@247 destructibleBuilding
DB2Storage< DestructibleModelDataEntry > sDestructibleModelDataStore("DestructibleModelData.db2", DestructibleModelDataLoadInfo::Instance())
GameobjectTypes GetGoType() const
Definition: GameObject.h:237
Definition: SharedDefines.h:2854
UF::UpdateField< UF::GameObjectData, 0, TYPEID_GAMEOBJECT > m_gameObjectData
Definition: GameObject.h:393
Definition: SharedDefines.h:2771
Definition: SharedDefines.h:2765
Definition: SharedDefines.h:2855
+ Here is the call graph for this function:

◆ GetOwnerGUID()

ObjectGuid GameObject::GetOwnerGUID ( ) const
inlineoverridevirtual

Implements WorldObject.

201 { return m_gameObjectData->CreatedBy; }
UF::UpdateField< UF::GameObjectData, 0, TYPEID_GAMEOBJECT > m_gameObjectData
Definition: GameObject.h:393
+ Here is the caller graph for this function:

◆ GetPackedLocalRotation()

int64 GameObject::GetPackedLocalRotation ( ) const
inline
179 { return m_packedRotation; }
int64 m_packedRotation
Definition: GameObject.h:427
+ Here is the call graph for this function:

◆ GetPauseTimes()

std::vector< uint32 > const * GameObject::GetPauseTimes ( ) const
3311 {
3312  if (GameObjectType::Transport const* transport = dynamic_cast<GameObjectType::Transport const*>(m_goTypeImpl.get()))
3313  return transport->GetPauseTimes();
3314 
3315  return nullptr;
3316 }
std::unique_ptr< GameObjectTypeBase > m_goTypeImpl
Definition: GameObject.h:424
Definition: GameObject.cpp:125

◆ GetRespawnCompatibilityMode()

bool GameObject::GetRespawnCompatibilityMode ( )
inline
bool m_respawnCompatibilityMode
Definition: GameObject.h:451
+ Here is the caller graph for this function:

◆ GetRespawnDelay()

uint32 GameObject::GetRespawnDelay ( ) const
inline
223 { return m_respawnDelayTime; }
uint32 m_respawnDelayTime
Definition: GameObject.h:400
+ Here is the caller graph for this function:

◆ GetRespawnPosition()

void GameObject::GetRespawnPosition ( float &  x,
float &  y,
float &  z,
float *  ori = nullptr 
) const
3337 {
3338  if (m_goData)
3339  {
3340  if (ori)
3341  m_goData->spawnPoint.GetPosition(x, y, z, *ori);
3342  else
3343  m_goData->spawnPoint.GetPosition(x, y, z);
3344  }
3345  else
3346  {
3347  if (ori)
3348  GetPosition(x, y, z, *ori);
3349  else
3350  GetPosition(x, y, z);
3351  }
3352 }
Position GetPosition() const
Definition: Position.h:85
GameObjectData const * m_goData
Definition: GameObject.h:423
Position spawnPoint
Definition: SpawnData.h:105
void GetPosition(float &x, float &y) const
Definition: Position.h:82
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetRespawnTime()

time_t GameObject::GetRespawnTime ( ) const
inline
210 { return m_respawnTime; }
time_t m_respawnTime
Definition: GameObject.h:399
+ Here is the caller graph for this function:

◆ GetRespawnTimeEx()

time_t GameObject::GetRespawnTimeEx ( ) const
1822 {
1823  time_t now = GameTime::GetGameTime();
1824  if (m_respawnTime > now)
1825  return m_respawnTime;
1826  else
1827  return now;
1828 }
time_t m_respawnTime
Definition: GameObject.h:399
time_t GetGameTime()
Definition: GameTime.cpp:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetScriptId()

uint32 GameObject::GetScriptId ( ) const
2839 {
2841  if (uint32 scriptId = gameObjectData->scriptId)
2842  return scriptId;
2843 
2844  return GetGOInfo()->ScriptId;
2845 }
ObjectData const gameObjectData[]
Definition: instance_blackwing_lair.cpp:55
GameObjectData const * GetGameObjectData() const
Definition: GameObject.h:165
uint32_t uint32
Definition: Define.h:143
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:162
uint32 ScriptId
Definition: GameObjectData.h:810
Definition: GameObjectData.h:1113
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSpawnId()

ObjectGuid::LowType GameObject::GetSpawnId ( ) const
inline
172 { return m_spawnId; }
ObjectGuid::LowType m_spawnId
For new or temporary gameobjects is 0 for saved it is lowguid.
Definition: GameObject.h:420
+ Here is the caller graph for this function:

◆ GetSpellForLock()

SpellInfo const * GameObject::GetSpellForLock ( Player const *  player) const
3714 {
3715  if (!player)
3716  return nullptr;
3717 
3718  uint32 lockId = GetGOInfo()->GetLockId();
3719  if (!lockId)
3720  return nullptr;
3721 
3722  LockEntry const* lock = sLockStore.LookupEntry(lockId);
3723  if (!lock)
3724  return nullptr;
3725 
3726  for (uint8 i = 0; i < MAX_LOCK_CASE; ++i)
3727  {
3728  if (!lock->Type[i])
3729  continue;
3730 
3731  if (lock->Type[i] == LOCK_KEY_SPELL)
3732  if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(lock->Index[i], GetMap()->GetDifficultyID()))
3733  return spell;
3734 
3735  if (lock->Type[i] != LOCK_KEY_SKILL)
3736  break;
3737 
3738  for (auto&& playerSpell : player->GetSpellMap())
3739  if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(playerSpell.first, GetMap()->GetDifficultyID()))
3740  for (auto&& effect : spell->GetEffects())
3741  if (effect.Effect == SPELL_EFFECT_OPEN_LOCK && effect.MiscValue == lock->Index[i])
3742  if (effect.CalcValue(player) >= int32(lock->Skill[i]))
3743  return spell;
3744  }
3745 
3746  return nullptr;
3747 }
Difficulty GetDifficultyID() const
Definition: Map.h:401
Definition: SpellInfo.h:342
Definition: SharedDefines.h:4373
std::array< int32, MAX_LOCK_CASE > Index
Definition: DB2Structure.h:2476
Definition: DB2Structure.h:2472
std::array< uint16, MAX_LOCK_CASE > Skill
Definition: DB2Structure.h:2477
uint32 GetLockId() const
Definition: GameObjectData.h:855
DB2Storage< LockEntry > sLockStore("Lock.db2", LockLoadInfo::Instance())
Map * GetMap() const
Definition: Object.h:555
Definition: SharedDefines.h:4372
#define sSpellMgr
Definition: SpellMgr.h:825
int32_t int32
Definition: Define.h:139
uint32_t uint32
Definition: Define.h:143
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:162
Definition: SharedDefines.h:1181
uint8_t uint8
Definition: Define.h:145
std::array< uint8, MAX_LOCK_CASE > Type
Definition: DB2Structure.h:2478
#define MAX_LOCK_CASE
Definition: DB2Structure.h:2470
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSpellId()

uint32 GameObject::GetSpellId ( ) const
inline
208 { return m_spellId;}
uint32 m_spellId
Definition: GameObject.h:398
+ Here is the caller graph for this function:

◆ GetStationaryO()

float GameObject::GetStationaryO ( ) const
inlineoverridevirtual

Reimplemented from WorldObject.

Position m_stationaryPosition
Definition: GameObject.h:429
float GetOrientation() const
Definition: Position.h:80

◆ GetStationaryPosition()

Position const& GameObject::GetStationaryPosition ( ) const
inline
356 { return m_stationaryPosition; }
Position m_stationaryPosition
Definition: GameObject.h:429

◆ GetStationaryX()

float GameObject::GetStationaryX ( ) const
inlineoverridevirtual

Reimplemented from WorldObject.

Position m_stationaryPosition
Definition: GameObject.h:429
float GetPositionX() const
Definition: Position.h:77

◆ GetStationaryY()

float GameObject::GetStationaryY ( ) const
inlineoverridevirtual

Reimplemented from WorldObject.

Position m_stationaryPosition
Definition: GameObject.h:429
float GetPositionY() const
Definition: Position.h:78

◆ GetStationaryZ()

float GameObject::GetStationaryZ ( ) const
inlineoverridevirtual

Reimplemented from WorldObject.

Position m_stationaryPosition
Definition: GameObject.h:429
float GetPositionZ() const
Definition: Position.h:79

◆ GetTemplateAddon()

GameObjectTemplateAddon const* GameObject::GetTemplateAddon ( ) const
inline
163 { return m_goTemplateAddon; }
GameObjectTemplateAddon const * m_goTemplateAddon
Definition: GameObject.h:422
+ Here is the caller graph for this function:

◆ GetUniqueUseCount()

uint32 GameObject::GetUniqueUseCount ( ) const
inline
278 { return uint32(m_unique_users.size()); }
GuidSet m_unique_users
Definition: GameObject.h:414
uint32_t uint32
Definition: Define.h:143
+ Here is the caller graph for this function:

◆ GetUseCount()

uint32 GameObject::GetUseCount ( ) const
inline
277 { return m_usetimes; }
uint32 m_usetimes
Definition: GameObject.h:415
+ Here is the caller graph for this function:

◆ GetWorldEffectID()

uint32 GameObject::GetWorldEffectID ( ) const
inline
376 { return _worldEffectID; }
uint32 _worldEffectID
Definition: GameObject.h:453
+ Here is the caller graph for this function:

◆ GetWorldRotation()

QuaternionData GameObject::GetWorldRotation ( ) const
2896 {
2897  QuaternionData localRotation = GetLocalRotation();
2898  if (Transport* transport = dynamic_cast<Transport*>(GetTransport()))
2899  {
2900  QuaternionData worldRotation = transport->GetWorldRotation();
2901 
2902  G3D::Quat worldRotationQuat(worldRotation.x, worldRotation.y, worldRotation.z, worldRotation.w);
2903  G3D::Quat localRotationQuat(localRotation.x, localRotation.y, localRotation.z, localRotation.w);
2904 
2905  G3D::Quat resultRotation = localRotationQuat * worldRotationQuat;
2906 
2907  return QuaternionData(resultRotation.x, resultRotation.y, resultRotation.z, resultRotation.w);
2908  }
2909  return localRotation;
2910 }
float y
Definition: QuaternionData.h:25
QuaternionData const & GetLocalRotation() const
Definition: GameObject.h:178
Definition: Transport.h:29
float z
Definition: QuaternionData.h:25
float w
Definition: QuaternionData.h:25
Definition: QuaternionData.h:23
float x
Definition: QuaternionData.h:25
TransportBase * GetTransport() const
Definition: Object.h:679
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleCustomTypeCommand()

void GameObject::HandleCustomTypeCommand ( GameObjectTypeBase::CustomCommand const &  command) const
3648 {
3649  if (m_goTypeImpl)
3650  command.Execute(*m_goTypeImpl);
3651 }
std::unique_ptr< GameObjectTypeBase > m_goTypeImpl
Definition: GameObject.h:424
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasFlag()

bool GameObject::HasFlag ( GameObjectFlags  flags) const
inline
231 { return (*m_gameObjectData->Flags & flags) != 0; }
uint16 flags
Definition: DisableMgr.cpp:49
UF::UpdateField< UF::GameObjectData, 0, TYPEID_GAMEOBJECT > m_gameObjectData
Definition: GameObject.h:393
+ Here is the caller graph for this function:

◆ hasInvolvedQuest()

bool GameObject::hasInvolvedQuest ( uint32  quest_id) const
overridevirtual

Reimplemented from Object.

1698 {
1699  return sObjectMgr->GetGOQuestInvolvedRelations(GetEntry()).HasQuest(quest_id);
1700 }
#define sObjectMgr
Definition: ObjectMgr.h:1967
uint32 GetEntry() const
Definition: Object.h:158
+ Here is the call graph for this function:

◆ HasLootMode()

bool GameObject::HasLootMode ( uint16  lootMode) const
inline
259 { return (m_LootMode & lootMode) != 0; }
uint16 m_LootMode
Definition: GameObject.h:433

◆ HasLootRecipient()

bool GameObject::HasLootRecipient ( ) const
inline
bool IsEmpty() const
Definition: ObjectGuid.h:310
ObjectGuid m_lootRecipientGroup
Definition: GameObject.h:432
ObjectGuid m_lootRecipient
Definition: GameObject.h:431

◆ hasQuest()

bool GameObject::hasQuest ( uint32  quest_id) const
overridevirtual

Reimplemented from Object.

1693 {
1694  return sObjectMgr->GetGOQuestRelations(GetEntry()).HasQuest(quest_id);
1695 }
#define sObjectMgr
Definition: ObjectMgr.h:1967
uint32 GetEntry() const
Definition: Object.h:158
+ Here is the call graph for this function:

◆ IsAlwaysVisibleFor()

bool GameObject::IsAlwaysVisibleFor ( WorldObject const *  seer) const
overridevirtual

Reimplemented from WorldObject.

1766 {
1768  return true;
1769 
1771  return true;
1772 
1773  if (!seer)
1774  return false;
1775 
1776  // Always seen by owner and friendly units
1777  if (!GetOwnerGUID().IsEmpty())
1778  {
1779  if (seer->GetGUID() == GetOwnerGUID())
1780  return true;
1781 
1782  Unit* owner = GetOwner();
1783  if (Unit const* unitSeer = seer->ToUnit())
1784  if (owner && owner->IsFriendlyTo(unitSeer))
1785  return true;
1786  }
1787 
1788  return false;
1789 }
bool IsTransport() const
Definition: GameObject.cpp:1702
virtual bool IsAlwaysVisibleFor(WorldObject const *) const
Definition: Object.h:749
ObjectGuid GetOwnerGUID() const override
Definition: GameObject.h:201
Unit * GetOwner() const
Definition: Object.cpp:2105
bool IsFriendlyTo(WorldObject const *target) const
Definition: Object.cpp:2699
static Unit * ToUnit(Object *o)
Definition: Object.h:210
Definition: Unit.h:746
bool IsDestructibleBuilding() const
Definition: GameObject.cpp:1723
+ Here is the call graph for this function:

◆ IsAtInteractDistance() [1/2]

bool GameObject::IsAtInteractDistance ( Position const &  pos,
float  radius 
) const
3685 {
3686  if (GameObjectDisplayInfoEntry const* displayInfo = sGameObjectDisplayInfoStore.LookupEntry(GetGOInfo()->displayId))
3687  {
3688  float scale = GetObjectScale();
3689 
3690  float minX = displayInfo->GeoBoxMin.X * scale - radius;
3691  float minY = displayInfo->GeoBoxMin.Y * scale - radius;
3692  float minZ = displayInfo->GeoBoxMin.Z * scale - radius;
3693  float maxX = displayInfo->GeoBoxMax.X * scale + radius;
3694  float maxY = displayInfo->GeoBoxMax.Y * scale + radius;
3695  float maxZ = displayInfo->GeoBoxMax.Z * scale + radius;
3696 
3697  QuaternionData worldRotation = GetWorldRotation();
3698  G3D::Quat worldRotationQuat(worldRotation.x, worldRotation.y, worldRotation.z, worldRotation.w);
3699 
3700  return G3D::CoordinateFrame { { worldRotationQuat }, { GetPositionX(), GetPositionY(), GetPositionZ() } }
3701  .toWorldSpace(G3D::Box { { minX, minY, minZ }, { maxX, maxY, maxZ } })
3702  .contains({ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ() });
3703  }
3704 
3705  return GetExactDist(&pos) <= radius;
3706 }
float y
Definition: QuaternionData.h:25
float GetPositionY() const
Definition: Position.h:78
float z
Definition: QuaternionData.h:25
DB2Storage< GameObjectDisplayInfoEntry > sGameObjectDisplayInfoStore("GameObjectDisplayInfo.db2", GameobjectDisplayInfoLoadInfo::Instance())
Definition: DB2Structure.h:1543
QuaternionData GetWorldRotation() const
Definition: GameObject.cpp:2895
float w
Definition: QuaternionData.h:25
float GetPositionZ() const
Definition: Position.h:79
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:162
float GetObjectScale() const
Definition: Object.h:161
float GetPositionX() const
Definition: Position.h:77
Definition: QuaternionData.h:23
float x
Definition: QuaternionData.h:25
float GetExactDist(float x, float y, float z) const
Definition: Position.h:119
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsAtInteractDistance() [2/2]

bool GameObject::IsAtInteractDistance ( Player const *  player,
SpellInfo const *  spell = nullptr 
) const
3669 {
3670  if (spell || (spell = GetSpellForLock(player)))
3671  {
3672  float maxRange = spell->GetMaxRange(spell->IsPositive());
3673 
3675  return maxRange * maxRange >= GetExactDistSq(player);
3676 
3677  if (sGameObjectDisplayInfoStore.LookupEntry(GetGOInfo()->displayId))
3678  return IsAtInteractDistance(*player, maxRange);
3679  }
3680 
3681  return IsAtInteractDistance(*player, GetInteractionDistance());
3682 }
float GetInteractionDistance() const
Definition: GameObject.cpp:3379
float GetExactDistSq(float x, float y, float z) const
Definition: Position.h:111
bool IsAtInteractDistance(Position const &pos, float radius) const
Definition: GameObject.cpp:3684
Definition: SharedDefines.h:2740
GameobjectTypes GetGoType() const
Definition: GameObject.h:237
DB2Storage< GameObjectDisplayInfoEntry > sGameObjectDisplayInfoStore("GameObjectDisplayInfo.db2", GameobjectDisplayInfoLoadInfo::Instance())
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:162
SpellInfo const * GetSpellForLock(Player const *player) const
Definition: GameObject.cpp:3713
+ Here is the call graph for this function:

◆ IsDestructibleBuilding()

bool GameObject::IsDestructibleBuilding ( ) const
1724 {
1725  GameObjectTemplate const* gInfo = GetGOInfo();
1726  if (!gInfo)
1727  return false;
1728 
1730 }
Definition: GameObjectData.h:30
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:162
Definition: SharedDefines.h:2765
uint32 type
Definition: GameObjectData.h:33
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsDynTransport()

bool GameObject::IsDynTransport ( ) const
1714 {
1715  // If something is marked as a transport, don't transmit an out of range packet for it.
1716  GameObjectTemplate const* gInfo = GetGOInfo();
1717  if (!gInfo)
1718  return false;
1719 
1721 }
Definition: GameObjectData.h:30
Definition: SharedDefines.h:2747
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:162
Definition: SharedDefines.h:2743
uint32 type
Definition: GameObjectData.h:33
+ Here is the call graph for this function:

◆ IsInRange()

bool GameObject::IsInRange ( float  x,
float  y,
float  z,
float  radius 
) const

Check if the distance between the 2 objects is 0, can happen if both objects are on the same position. The code below this check wont crash if dist is 0 because 0/0 in float operations is valid, and returns infinite

2813 {
2815  if (!info)
2816  return IsWithinDist3d(x, y, z, radius);
2817 
2818  float sinA = std::sin(GetOrientation());
2819  float cosA = std::cos(GetOrientation());
2820  float dx = x - GetPositionX();
2821  float dy = y - GetPositionY();
2822  float dz = z - GetPositionZ();
2823  float dist = std::sqrt(dx*dx + dy*dy);
2826  if (G3D::fuzzyEq(dist, 0.0f))
2827  return true;
2828 
2829  float sinB = dx / dist;
2830  float cosB = dy / dist;
2831  dx = dist * (cosA * cosB + sinA * sinB);
2832  dy = dist * (cosA * sinB - sinA * cosB);
2833  return dx < info->GeoBoxMax.X + radius && dx > info->GeoBoxMin.X - radius
2834  && dy < info->GeoBoxMax.Y + radius && dy > info->GeoBoxMin.Y - radius
2835  && dz < info->GeoBoxMax.Z + radius && dz > info->GeoBoxMin.Z - radius;
2836 }
DBCPosition3D GeoBoxMin
Definition: DB2Structure.h:1546
float Z
Definition: DBCEnums.h:37
float Y
Definition: DBCEnums.h:36
float GetOrientation() const
Definition: Position.h:80
uint32 displayId
Definition: GameObjectData.h:34
GameObjectTemplate const * m_goInfo
Definition: GameObject.h:421
float GetPositionY() const
Definition: Position.h:78
DB2Storage< GameObjectDisplayInfoEntry > sGameObjectDisplayInfoStore("GameObjectDisplayInfo.db2", GameobjectDisplayInfoLoadInfo::Instance())
Definition: DB2Structure.h:1543
float GetPositionZ() const
Definition: Position.h:79
float X
Definition: DBCEnums.h:35
float GetPositionX() const
Definition: Position.h:77
DBCPosition3D GeoBoxMax
Definition: DB2Structure.h:1547
bool IsWithinDist3d(float x, float y, float z, float dist) const
Definition: Object.cpp:1030
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsInSkillupList()

bool GameObject::IsInSkillupList ( ObjectGuid const &  playerGuid) const
inline
269  {
270  return m_SkillupList.count(playerGuid) > 0;
271  }
GuidSet m_SkillupList
Definition: GameObject.h:411
+ Here is the caller graph for this function:

◆ IsInvisibleDueToDespawn()

bool GameObject::IsInvisibleDueToDespawn ( ) const
overridevirtual

Reimplemented from WorldObject.

1792 {
1794  return true;
1795 
1796  // Despawned
1797  if (!isSpawned())
1798  return true;
1799 
1800  return false;
1801 }
bool isSpawned() const
Definition: GameObject.h:215
virtual bool IsInvisibleDueToDespawn() const
Definition: Object.h:750
+ Here is the call graph for this function:

◆ IsLootAllowedFor()

bool GameObject::IsLootAllowedFor ( Player const *  player) const
3221 {
3223  return true;
3224 
3225  if (player->GetGUID() == m_lootRecipient)
3226  return true;
3227 
3228  Group const* playerGroup = player->GetGroup();
3229  if (!playerGroup || playerGroup != GetLootRecipientGroup()) // if we dont have a group we arent the recipient
3230  return false; // if go doesnt have group bound it means it was solo killed by someone else
3231 
3232  return true;
3233 }
Group * GetLootRecipientGroup() const
Definition: GameObject.cpp:3184
ObjectGuid m_lootRecipientGroup
Definition: GameObject.h:432
ObjectGuid m_lootRecipient
Definition: GameObject.h:431
Definition: Group.h:221
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsNeverVisibleFor()

bool GameObject::IsNeverVisibleFor ( WorldObject const *  seer) const
overridevirtual

Reimplemented from WorldObject.

1752 {
1754  return true;
1755 
1756  if (GetGoType() == GAMEOBJECT_TYPE_SPELL_FOCUS && GetGOInfo()->spellFocus.serverOnly == 1)
1757  return true;
1758 
1759  if (!GetDisplayId())
1760  return true;
1761 
1762  return false;
1763 }
Definition: SharedDefines.h:2740
uint32 serverOnly
Definition: GameObjectData.h:141
GameobjectTypes GetGoType() const
Definition: GameObject.h:237
uint32 GetDisplayId() const
Definition: GameObject.h:337
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:162
virtual bool IsNeverVisibleFor(WorldObject const *) const
Definition: Object.h:748
+ Here is the call graph for this function:

◆ isSpawned()

bool GameObject::isSpawned ( ) const
inline
216  {
217  return m_respawnDelayTime == 0 ||
218  (m_respawnTime > 0 && !m_spawnedByDefault) ||
220  }
uint32 m_respawnDelayTime
Definition: GameObject.h:400
time_t m_respawnTime
Definition: GameObject.h:399
bool m_spawnedByDefault
Definition: GameObject.h:405
+ Here is the caller graph for this function:

◆ isSpawnedByDefault()

bool GameObject::isSpawnedByDefault ( ) const
inline
221 { return m_spawnedByDefault; }
bool m_spawnedByDefault
Definition: GameObject.h:405
+ Here is the caller graph for this function:

◆ IsTransport()

bool GameObject::IsTransport ( ) const
1703 {
1704  // If something is marked as a transport, don't transmit an out of range packet for it.
1705  GameObjectTemplate const* gInfo = GetGOInfo();
1706  if (!gInfo)
1707  return false;
1708 
1710 }
Definition: GameObjectData.h:30
Definition: SharedDefines.h:2747
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:162
Definition: SharedDefines.h:2743
uint32 type
Definition: GameObjectData.h:33
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsWithinDistInMap()

bool GameObject::IsWithinDistInMap ( Player const *  player) const
3709 {
3710  return IsInMap(player) && IsInPhase(player) && IsAtInteractDistance(player);
3711 }
bool IsInPhase(WorldObject const *obj) const
Definition: Object.h:461
bool IsInMap(WorldObject const *obj) const
Definition: Object.cpp:1023
bool IsAtInteractDistance(Position const &pos, float radius) const
Definition: GameObject.cpp:3684
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LoadFromDB()

bool GameObject::LoadFromDB ( ObjectGuid::LowType  spawnId,
Map map,
bool  addToMap,
bool  = true 
)
1551 {
1552  GameObjectData const* data = sObjectMgr->GetGameObjectData(spawnId);
1553  if (!data)
1554  {
1555  TC_LOG_ERROR("sql.sql", "Gameobject (GUID: " UI64FMTD ") not found in table `gameobject`, can't load. ", spawnId);
1556  return false;
1557  }
1558 
1559  uint32 entry = data->id;
1560  //uint32 map_id = data->mapid; // already used before call
1561 
1562  uint32 animprogress = data->animprogress;
1563  GOState go_state = data->goState;
1564  uint32 artKit = data->artKit;
1565 
1566  m_spawnId = spawnId;
1568  if (!Create(entry, map, data->spawnPoint, data->rotation, animprogress, go_state, artKit, !m_respawnCompatibilityMode, spawnId))
1569  return false;
1570 
1573 
1574  if (data->spawntimesecs >= 0)
1575  {
1576  m_spawnedByDefault = true;
1577 
1578  if (!GetGOInfo()->GetDespawnPossibility() && !GetGOInfo()->IsDespawnAtAction())
1579  {
1581  m_respawnDelayTime = 0;
1582  m_respawnTime = 0;
1583  }
1584  else
1585  {
1588 
1589  // ready to respawn
1591  {
1592  m_respawnTime = 0;
1594  }
1595  }
1596  }
1597  else
1598  {
1600  {
1601  TC_LOG_WARN("sql.sql", "GameObject %u (SpawnID " UI64FMTD ") is not spawned by default, but tries to use a non-hack spawn system. This will not work. Defaulting to compatibility mode.", entry, spawnId);
1603  }
1604 
1605  m_spawnedByDefault = false;
1607  m_respawnTime = 0;
1608  }
1609 
1610  m_goData = data;
1611 
1612  if (addToMap && !GetMap()->AddToMap(this))
1613  return false;
1614 
1615  return true;
1616 }
QuaternionData rotation
Definition: GameObjectData.h:1116
void SetFlag(GameObjectFlags flags)
Definition: GameObject.h:232
#define TC_LOG_WARN(filterType__,...)
Definition: Log.h:182
uint32 phaseId
Definition: SpawnData.h:107
uint32 m_respawnDelayTime
Definition: GameObject.h:400
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:185
Definition: SpawnData.h:35
int32 spawntimesecs
Definition: SpawnData.h:111
GOState goState
Definition: GameObjectData.h:1118
GameObjectData const * m_goData
Definition: GameObject.h:423
uint8 phaseUseFlags
Definition: SpawnData.h:106
#define sObjectMgr
Definition: ObjectMgr.h:1967
Map * GetMap() const
Definition: Object.h:555
uint32 id
Definition: SpawnData.h:104
bool m_respawnCompatibilityMode
Definition: GameObject.h:451
time_t m_respawnTime
Definition: GameObject.h:399
PhaseShift & GetPhaseShift()
Definition: Object.h:470
time_t GetGameTime()
Definition: GameTime.cpp:39
bool AddToMap(T *)
Definition: Map.cpp:745
#define UI64FMTD
Definition: Define.h:127
Definition: SharedDefines.h:2805
uint32_t uint32
Definition: Define.h:143
void RemoveRespawnTime(SpawnObjectType type, ObjectGuid::LowType spawnId, CharacterDatabaseTransaction dbTrans=nullptr, bool alwaysDeleteFromDB=false)
Definition: Map.h:784
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:162
uint32 artKit
Definition: GameObjectData.h:1119
static void InitDbPhaseShift(PhaseShift &phaseShift, uint8 phaseUseFlags, uint16 phaseId, uint32 phaseGroupId)
Definition: PhasingHandler.cpp:516
Definition: GameObjectData.h:1113
bool m_spawnedByDefault
Definition: GameObject.h:405
Definition: SpawnData.h:55
uint32 animprogress
Definition: GameObjectData.h:1117
uint32 phaseGroup
Definition: SpawnData.h:108
bool Create(uint32 entry, Map *map, Position const &pos, QuaternionData const &rotation, uint32 animProgress, GOState goState, uint32 artKit, bool dynamic, ObjectGuid::LowType spawnid)
Definition: GameObject.cpp:632
static void InitDbVisibleMapId(PhaseShift &phaseShift, int32 visibleMapId)
Definition: PhasingHandler.cpp:551
Position spawnPoint
Definition: SpawnData.h:105
SpawnGroupTemplateData const * spawnGroupData
Definition: SpawnData.h:96
time_t GetGORespawnTime(ObjectGuid::LowType spawnId) const
Definition: Map.h:567
SpawnGroupFlags flags
Definition: SpawnData.h:70
int32 terrainSwapMap
Definition: SpawnData.h:109
ObjectGuid::LowType m_spawnId
For new or temporary gameobjects is 0 for saved it is lowguid.
Definition: GameObject.h:420
GOState
Definition: SharedDefines.h:2838
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LookupFishingHoleAround()

GameObject * GameObject::LookupFishingHoleAround ( float  range)
1914 {
1915  GameObject* ok = nullptr;
1916  Trinity::NearestGameObjectFishingHole u_check(*this, range);
1918  Cell::VisitGridObjects(this, checker, range);
1919  return ok;
1920 }
Definition: GridNotifiers.h:404
static void VisitGridObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:179
Definition: GameObject.h:125
Definition: GridNotifiers.h:746
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ModifyHealth()

void GameObject::ModifyHealth ( int32  change,
WorldObject attackerOrHealer = nullptr,
uint32  spellId = 0 
)
2913 {
2914  if (!m_goValue.Building.MaxHealth || !change)
2915  return;
2916 
2917  // prevent double destructions of the same object
2918  if (change < 0 && !m_goValue.Building.Health)
2919  return;
2920 
2921  if (int32(m_goValue.Building.Health) + change <= 0)
2925  else
2926  m_goValue.Building.Health += change;
2927 
2928  // Set the health bar, value = 255 * healthPct;
2930 
2931  // dealing damage, send packet
2932  if (Player* player = attackerOrHealer ? attackerOrHealer->GetCharmerOrOwnerPlayerOrPlayerItself() : nullptr)
2933  {
2935  packet.Caster = attackerOrHealer->GetGUID(); // todo: this can be a GameObject
2936  packet.Target = GetGUID();
2937  packet.Damage = -change;
2938  packet.Owner = player->GetGUID();
2939  packet.SpellID = spellId;
2940  player->SendDirectMessage(packet.Write());
2941  }
2942 
2943  if (change < 0 && GetGOInfo()->destructibleBuilding.DamageEvent)
2944  GameEvents::Trigger(GetGOInfo()->destructibleBuilding.DamageEvent, attackerOrHealer, this);
2945 
2947 
2948  if (!m_goValue.Building.Health)
2949  newState = GO_DESTRUCTIBLE_DESTROYED;
2950  else if (m_goValue.Building.Health <= 10000/*GetGOInfo()->destructibleBuilding.damagedNumHits*/) // TODO: Get health somewhere
2951  newState = GO_DESTRUCTIBLE_DAMAGED;
2953  newState = GO_DESTRUCTIBLE_INTACT;
2954 </