TrinityCore
GameObject Class Reference

#include <GameObject.h>

Classes

struct  PerPlayerState
 
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)
 
ObjectGuid GetCreatorGUID () const override
 
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 DespawnForPlayer (Player *seer, Seconds respawnTime)
 
void Delete ()
 
void SendGameObjectDespawn ()
 
LootGetFishLoot (Player *lootOwner)
 
LootGetFishLootJunk (Player *lootOwner)
 
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)
 
GOState GetGoStateFor (ObjectGuid const &viewer) const
 
void SetGoStateFor (GOState state, Player const *viewer)
 
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 ClearLoot ()
 
bool IsFullyLooted () const
 
void OnLootRelease (Player *looter)
 
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)
 
GuidUnorderedSet const & GetTapList () const
 
void SetTapList (GuidUnorderedSet tapList)
 
bool IsLootAllowedFor (Player const *player) const
 
bool HasLootRecipient () const
 
LootGetLootForPlayer (Player const *) const override
 
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, bool allowServersideObjects=false) const override
 
bool IsAlwaysVisibleFor (WorldObject const *seer) const override
 
bool IsInvisibleDueToDespawn (WorldObject const *seer) 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 ()
 
std::string const & GetAIName () const
 
uint32 GetScriptId () const
 
GameObjectAIAI () const
 
bool HasStringId (std::string_view id) const
 
void SetScriptStringId (std::string id)
 
std::array< std::string_view, 3 > const & GetStringIds () 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
 
FlagState GetFlagState () const
 
ObjectGuid const & GetFlagCarrierGUID () const
 
time_t GetFlagTakenFromBaseTime () const
 
GuidUnorderedSet const * GetInsidePlayers () const
 
bool MeetsInteractCondition (Player const *user) const
 
void AIM_Destroy ()
 
bool AIM_Initialize ()
 
std::string GetDebugInfo () const override
 
void UpdateDynamicFlagsForNearbyPlayers ()
 
void HandleCustomTypeCommand (GameObjectTypeBase::CustomCommand const &command) const
 
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
 
- Public Member Functions inherited from WorldObject
virtual ~WorldObject ()
 
virtual void Update (uint32 diff)
 
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
 
PhaseShiftGetPhaseShift ()
 
PhaseShift const & GetPhaseShift () const
 
PhaseShiftGetSuppressedPhaseShift ()
 
PhaseShift const & GetSuppressedPhaseShift () const
 
bool InSamePhase (PhaseShift const &phaseShift) const
 
bool InSamePhase (WorldObject const *obj) 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, bool incOwnRadius=true, bool incTargetRadius=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 CleanupsBeforeDelete (bool finalCleanup=true)
 
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
 
virtual uint8 GetLevelForTarget (WorldObject const *) 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 PlayObjectSound (int32 soundKitId, ObjectGuid targetObject, Player *target=nullptr, int32 broadcastTextId=0)
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
float GetSightRange (WorldObject const *target=nullptr) const
 
bool CanSeeOrDetect (WorldObject const *obj, bool implicitDetect=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
 
CreatureFindNearestCreatureWithOptions (float range, FindCreatureOptions const &options) const
 
GameObjectFindNearestGameObject (uint32 entry, float range, bool spawnedOnly=true) const
 
GameObjectFindNearestGameObjectWithOptions (float range, FindGameObjectOptions const &options) const
 
GameObjectFindNearestUnspawnedGameObject (uint32 entry, float range) const
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
PlayerSelectNearestPlayer (float range) const
 
virtual ObjectGuid GetCreatorGUID () const =0
 
virtual ObjectGuid GetOwnerGUID () const =0
 
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
 
double ApplyEffectModifiers (SpellInfo const *spellInfo, uint8 effIndex, double value) const
 
int32 CalcSpellDuration (SpellInfo const *spellInfo, std::vector< SpellPowerCost > const *powerCosts) 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)
 
virtual uint32 GetFaction () const =0
 
virtual void SetFaction (uint32)
 
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)
 
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 GetGameObjectListWithOptionsInGrid (Container &gameObjectContainer, float maxSearchRange, FindGameObjectOptions const &options) const
 
template<typename Container >
void GetCreatureListWithEntryInGrid (Container &creatureContainer, uint32 entry, float maxSearchRange=250.0f) const
 
template<typename Container >
void GetCreatureListWithOptionsInGrid (Container &creatureContainer, float maxSearchRange, FindCreatureOptions const &options) 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)
 
virtual float GetStationaryX () const
 
virtual float GetStationaryY () const
 
virtual float GetStationaryZ () const
 
virtual float GetStationaryO () const
 
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 GetAIAnimKitId () const
 
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
 
virtual void AddToWorld ()
 
virtual void RemoveFromWorld ()
 
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
 
ByteBufferPrepareValuesUpdateBuffer (UpdateData *data) const
 
virtual void DestroyForPlayer (Player *target) const
 
void SendOutOfRangeForPlayer (Player *target) const
 
virtual void ClearUpdateMask (bool remove)
 
virtual std::string GetNameForLocaleIdx (LocaleConstant locale) const =0
 
virtual bool hasQuest (uint32) const
 
virtual bool hasInvolvedQuest (uint32) const
 
void SetIsNewObject (bool enable)
 
bool IsDestroyedObject () const
 
void SetDestroyedObject (bool destroyed)
 
virtual void BuildUpdate (UpdateDataMapType &)
 
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 std::string GetDebugInfo () const
 
virtual LootGetLootForPlayer (Player const *player) 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
 
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

std::unique_ptr< Lootm_loot
 
std::unordered_map< ObjectGuid, std::unique_ptr< Loot > > m_personalLoot
 
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, uint64, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibility
 
FlaggedValuesArray32< int32, uint64, 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 CanAlwaysSee (WorldObject const *) const
 
virtual bool IsNeverVisibleFor (WorldObject const *seer, bool allowServersideObjects=false) const
 
virtual bool IsAlwaysVisibleFor (WorldObject const *seer) const
 
virtual bool IsInvisibleDueToDespawn (WorldObject const *seer) const
 
virtual bool IsAlwaysDetectableFor (WorldObject const *seer) 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
 
virtual void BuildValuesCreate (ByteBuffer *data, Player const *target) const =0
 
virtual void BuildValuesUpdate (ByteBuffer *data, Player const *target) const =0
 
virtual bool AddToObjectUpdate ()=0
 
virtual void RemoveFromObjectUpdate ()=0
 
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
 
std::array< std::string_view, 3 > m_stringIds
 
Optional< std::string > m_scriptStringId
 
int64 m_packedRotation
 
QuaternionData m_localRotation
 
Position m_stationaryPosition
 
GuidUnorderedSet m_tapList
 
uint16 m_LootMode
 
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...
 
std::unordered_map< ObjectGuid, PerPlayerState > & GetOrCreatePerPlayerStates ()
 

Private Attributes

GameObjectAIm_AI
 
bool m_respawnCompatibilityMode
 
uint16 _animKitId
 
uint32 _worldEffectID
 
std::unique_ptr< std::unordered_map< ObjectGuid, PerPlayerState > > m_perPlayerState
 

Detailed Description

Definition at line 160 of file GameObject.h.

Member Typedef Documentation

◆ ChairSlotAndUser

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

Definition at line 467 of file GameObject.h.

Constructor & Destructor Documentation

◆ GameObject()

GameObject::GameObject ( )
explicit

Definition at line 814 of file GameObject.cpp.

814 : WorldObject(false), MapObject(),
815 m_model(nullptr), m_goValue(), m_AI(nullptr), m_respawnCompatibilityMode(false), _animKitId(0), _worldEffectID(0)
816{
819
821 m_updateFlag.Rotation = true;
822
823 m_respawnTime = 0;
824 m_respawnDelayTime = 300;
825 m_despawnDelay = 0;
827 m_restockTime = 0;
829 m_spawnedByDefault = true;
830 m_usetimes = 0;
831 m_spellId = 0;
832 m_cooldownTime = 0;
834 m_goInfo = nullptr;
835 m_goData = nullptr;
837 m_goTemplateAddon = nullptr;
838
839 m_spawnId = UI64LIT(0);
840
841 ResetLootMode(); // restore default loot mode
842 m_stationaryPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
843}
#define UI64LIT(N)
Definition: Define.h:128
@ GO_NOT_READY
Definition: GameObject.h:151
@ TYPEID_GAMEOBJECT
Definition: ObjectGuid.h:43
@ TYPEMASK_GAMEOBJECT
Definition: ObjectGuid.h:63
@ GO_STATE_ACTIVE
uint32 _worldEffectID
Definition: GameObject.h:503
GameObjectValue m_goValue
Definition: GameObject.h:475
time_t m_respawnTime
Definition: GameObject.h:449
time_t m_cooldownTime
Definition: GameObject.h:457
GameObjectData const * m_goData
Definition: GameObject.h:473
int64 m_packedRotation
Definition: GameObject.h:479
Position m_stationaryPosition
Definition: GameObject.h:481
time_t m_restockTime
Definition: GameObject.h:456
uint32 m_spellId
Definition: GameObject.h:448
uint32 m_respawnDelayTime
Definition: GameObject.h:450
void ResetLootMode()
Definition: GameObject.h:302
uint32 m_despawnDelay
Definition: GameObject.h:451
Seconds m_despawnRespawnTime
Definition: GameObject.h:452
bool m_respawnCompatibilityMode
Definition: GameObject.h:501
GameObjectTemplateAddon const * m_goTemplateAddon
Definition: GameObject.h:472
GameObjectAI * m_AI
Definition: GameObject.h:500
GameObjectModel * m_model
Definition: GameObject.h:386
uint16 _animKitId
Definition: GameObject.h:502
GameObjectTemplate const * m_goInfo
Definition: GameObject.h:471
ObjectGuid::LowType m_spawnId
For new or temporary gameobjects is 0 for saved it is lowguid.
Definition: GameObject.h:470
bool m_spawnedByDefault
Definition: GameObject.h:455
LootState m_lootState
Definition: GameObject.h:453
uint32 m_usetimes
Definition: GameObject.h:465
GOState m_prevGoState
Definition: GameObject.h:459
MapObject()
Definition: MapObject.h:41
uint16 m_objectType
Definition: Object.h:386
CreateObjectBits m_updateFlag
Definition: Object.h:389
TypeID m_objectTypeId
Definition: Object.h:388
WorldObject(bool isWorldObject)
Definition: Object.cpp:867
bool Rotation
Definition: Object.h:92
bool Stationary
Definition: Object.h:87
void Relocate(float x, float y)
Definition: Position.h:63
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ~GameObject()

GameObject::~GameObject ( )

Definition at line 845 of file GameObject.cpp.

846{
847 delete m_AI;
848 delete m_model;
849}

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.

Definition at line 494 of file GameObject.h.

495 {
497 return IsInRange(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), dist2compare);
498 }
bool IsInRange(float x, float y, float z, float radius) const
+ 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 
)

Definition at line 2326 of file GameObject.cpp.

2327{
2328 Unit* unitCaster = spellCaster ? spellCaster->ToUnit() : nullptr;
2329
2330 switch (action)
2331 {
2333 TC_LOG_FATAL("spell", "Spell {} has action type NONE in effect {}", spellId, effectIndex);
2334 break;
2340 break;
2341 case GameObjectActions::Disturb: // What's the difference with Open?
2342 if (unitCaster)
2343 Use(unitCaster);
2344 break;
2347 break;
2350 break;
2352 if (unitCaster)
2353 Use(unitCaster);
2354 break;
2356 if (unitCaster)
2357 UseDoorOrButton(0, false, unitCaster);
2359 break;
2362 break;
2364 // No use cases, implementation unknown
2365 break;
2367 if (unitCaster)
2368 UseDoorOrButton(0, true, unitCaster);
2369 break;
2372 break;
2374 // No use cases, implementation unknown
2375 break;
2378 break;
2381 break;
2384 break;
2388 break;
2394 {
2395 GameObjectTemplateAddon const* templateAddon = GetTemplateAddon();
2396
2397 uint32 artKitIndex = action != GameObjectActions::UseArtKit4 ? uint32(action) - uint32(GameObjectActions::UseArtKit0) : 4;
2398
2399 uint32 artKitValue = 0;
2400 if (templateAddon != nullptr)
2401 artKitValue = templateAddon->ArtKits[artKitIndex];
2402
2403 if (artKitValue == 0)
2404 TC_LOG_ERROR("sql.sql", "GameObject {} hit by spell {} needs `artkit{}` in `gameobject_template_addon`", GetEntry(), spellId, artKitIndex);
2405 else
2406 SetGoArtKit(artKitValue);
2407
2408 break;
2409 }
2422 SetGoState(GOState(action));
2423 else
2424 TC_LOG_ERROR("spell", "Spell {} targeted non-transport gameobject for transport only action \"Go to Floor\" {} in effect {}", spellId, int32(action), effectIndex);
2425 break;
2427 SetAnimKitId(param, false);
2428 break;
2430 if (unitCaster)
2431 UseDoorOrButton(0, false, unitCaster);
2432 SetAnimKitId(param, false);
2433 break;
2436 SetAnimKitId(param, false);
2437 break;
2439 SetAnimKitId(param, true);
2440 break;
2442 SetAnimKitId(0, false);
2443 break;
2445 if (unitCaster)
2446 UseDoorOrButton(0, false, unitCaster);
2447 SetAnimKitId(0, false);
2448 break;
2451 SetAnimKitId(0, false);
2452 break;
2454 SetSpellVisualId(param, Object::GetGUID(spellCaster));
2455 break;
2458 break;
2459 default:
2460 TC_LOG_ERROR("spell", "Spell {} has unhandled action {} in effect {}", spellId, int32(action), effectIndex);
2461 break;
2462 }
2463
2464 // Apply side effects of type
2465 if (m_goTypeImpl)
2466 m_goTypeImpl->ActivateObject(action, param, spellCaster, spellId, effectIndex);
2467}
int32_t int32
Definition: Define.h:139
uint32_t uint32
Definition: Define.h:143
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:165
#define TC_LOG_FATAL(filterType__,...)
Definition: Log.h:168
@ GAMEOBJECT_TYPE_TRANSPORT
@ GO_FLAG_NOT_SELECTABLE
@ GO_FLAG_LOCKED
GOState
@ GO_STATE_TRANSPORT_ACTIVE
void SetGoState(GOState state)
void UseDoorOrButton(uint32 time_to_restore=0, bool alternative=false, Unit *user=nullptr)
void RemoveFlag(GameObjectFlags flags)
Definition: GameObject.h:270
void SetSpellVisualId(int32 spellVisualId, ObjectGuid activatorGuid=ObjectGuid::Empty)
void DespawnOrUnsummon(Milliseconds delay=0ms, Seconds forceRespawnTime=0s)
void SetFlag(GameObjectFlags flags)
Definition: GameObject.h:269
GameobjectTypes GetGoType() const
Definition: GameObject.h:274
void SendCustomAnim(uint32 anim)
void ResetDoorOrButton()
GameObjectTemplateAddon const * GetTemplateAddon() const
Definition: GameObject.h:198
void Use(Unit *user)
void SetAnimKitId(uint16 animKitId, bool oneshot)
void SetGoArtKit(uint32 artkit)
std::unique_ptr< GameObjectTypeBase > m_goTypeImpl
Definition: GameObject.h:474
static Unit * ToUnit(Object *o)
Definition: Object.h:212
ObjectGuid const & GetGUID() const
Definition: Object.h:159
uint32 GetEntry() const
Definition: Object.h:160
Definition: Unit.h:622
std::array< uint32, 5 > ArtKits
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ActivateToQuest()

bool GameObject::ActivateToQuest ( Player const *  target) const

Definition at line 2222 of file GameObject.cpp.

2223{
2224 if (target->HasQuestForGO(GetEntry()))
2225 return true;
2226
2227 if (!sObjectMgr->IsGameObjectForQuests(GetEntry()))
2228 return false;
2229
2230 switch (GetGoType())
2231 {
2233 {
2234 GameObject* go = const_cast<GameObject*>(this);
2235 QuestGiverStatus questStatus = const_cast<Player*>(target)->GetQuestDialogStatus(go);
2236 if (questStatus != QuestGiverStatus::None && questStatus != QuestGiverStatus::Future)
2237 return true;
2238 break;
2239 }
2241 {
2242 // Chests become inactive while not ready to be looted
2243 if (getLootState() == GO_NOT_READY)
2244 return false;
2245
2246 // scan GO chest with loot including quest items
2247 if (target->GetQuestStatus(GetGOInfo()->chest.questID) == QUEST_STATUS_INCOMPLETE
2251 {
2252 if (Battleground const* bg = target->GetBattleground())
2253 return bg->CanActivateGO(GetEntry(), bg->GetPlayerTeam(target->GetGUID()));
2254 return true;
2255 }
2256 break;
2257 }
2259 {
2260 if (target->GetQuestStatus(GetGOInfo()->generic.questID) == QUEST_STATUS_INCOMPLETE)
2261 return true;
2262 break;
2263 }
2265 {
2266 if (target->GetQuestStatus(GetGOInfo()->goober.questID) == QUEST_STATUS_INCOMPLETE)
2267 return true;
2268 break;
2269 }
2270 default:
2271 break;
2272 }
2273
2274 return false;
2275}
LootStore LootTemplates_Gameobject("gameobject_loot_template", "gameobject entry", true)
#define sObjectMgr
Definition: ObjectMgr.h:1945
QuestGiverStatus
Definition: QuestDef.h:152
@ QUEST_STATUS_INCOMPLETE
Definition: QuestDef.h:144
@ GAMEOBJECT_TYPE_GENERIC
@ GAMEOBJECT_TYPE_CHEST
@ GAMEOBJECT_TYPE_QUESTGIVER
@ GAMEOBJECT_TYPE_GOOBER
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:197
LootState getLootState() const
Definition: GameObject.h:293
bool HaveQuestLootForPlayer(uint32 loot_id, Player const *player) const
Definition: LootMgr.cpp:209
struct GameObjectTemplate::@211::@223 goober
struct GameObjectTemplate::@211::@216 chest
struct GameObjectTemplate::@211::@218 generic
+ Here is the call graph for this function:

◆ AddLootMode()

void GameObject::AddLootMode ( uint16  lootMode)
inline

Definition at line 300 of file GameObject.h.

300{ m_LootMode |= lootMode; }
uint16 m_LootMode
Definition: GameObject.h:484

◆ AddToSkillupList()

void GameObject::AddToSkillupList ( ObjectGuid const &  PlayerGuidLow)
inline

Definition at line 307 of file GameObject.h.

307{ m_SkillupList.insert(PlayerGuidLow); }
GuidSet m_SkillupList
Definition: GameObject.h:461
+ Here is the caller graph for this function:

◆ AddToWorld()

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

Reimplemented from Object.

Definition at line 901 of file GameObject.cpp.

902{
904 if (!IsInWorld())
905 {
906 if (m_zoneScript)
908
910 if (m_spawnId)
911 GetMap()->GetGameObjectBySpawnIdStore().insert(std::make_pair(m_spawnId, this));
912
913 // The state can be changed after GameObject::Create but before GameObject::AddToWorld
914 bool toggledState = GetGoType() == GAMEOBJECT_TYPE_CHEST ? getLootState() == GO_READY : (GetGoState() == GO_STATE_READY || IsTransport());
915 if (m_model)
916 {
917 if (Transport* trans = ToTransport())
918 trans->SetDelayedAddModelToMap();
919 else
921 }
922
923 EnableCollision(toggledState);
925 }
926}
@ GO_READY
Definition: GameObject.h:152
@ GO_STATE_READY
GOState GetGoState() const
Definition: GameObject.h:276
void EnableCollision(bool enable)
Transport * ToTransport()
Definition: GameObject.h:392
bool IsTransport() const
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:418
GameObjectBySpawnIdContainer & GetGameObjectBySpawnIdStore()
Definition: Map.h:425
void InsertGameObjectModel(GameObjectModel const &model)
Definition: Map.h:459
bool IsInWorld() const
Definition: Object.h:153
bool Insert(KEY_TYPE const &handle, SPECIFIC_TYPE *obj)
Map * GetMap() const
Definition: Object.h:604
void AddToWorld() override
Definition: Object.cpp:1003
ZoneScript * m_zoneScript
Definition: Object.h:780
virtual void OnGameObjectCreate(GameObject *)
Definition: ZoneScript.h:74
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddUniqueUse()

void GameObject::AddUniqueUse ( Player player)

Definition at line 1707 of file GameObject.cpp.

1708{
1709 AddUse();
1710 m_unique_users.insert(player->GetGUID());
1711}
void AddUse()
Definition: GameObject.h:315
GuidSet m_unique_users
Definition: GameObject.h:464
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:158
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddUse()

void GameObject::AddUse ( )
inline

Definition at line 315 of file GameObject.h.

315{ ++m_usetimes; }
+ Here is the caller graph for this function:

◆ AfterRelocation()

void GameObject::AfterRelocation ( )

Definition at line 4086 of file GameObject.cpp.

4087{
4090 if (m_goTypeImpl)
4091 m_goTypeImpl->OnRelocated();
4092
4094}
void UpdateModelPosition()
void UpdatePositionData()
Definition: Object.cpp:985
virtual void UpdateObjectVisibility(bool forced=true)
Definition: Object.cpp:3630
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AI()

GameObjectAI * GameObject::AI ( ) const
inline

Definition at line 373 of file GameObject.h.

373{ return m_AI; }
+ Here is the caller graph for this function:

◆ AIM_Destroy()

void GameObject::AIM_Destroy ( )

Definition at line 851 of file GameObject.cpp.

852{
853 delete m_AI;
854 m_AI = nullptr;
855}
+ Here is the caller graph for this function:

◆ AIM_Initialize()

bool GameObject::AIM_Initialize ( )

Definition at line 857 of file GameObject.cpp.

858{
859 AIM_Destroy();
860
862
863 if (!m_AI)
864 return false;
865
867 return true;
868}
virtual void InitializeAI()
Definition: GameObjectAI.h:61
void AIM_Destroy()
Definition: GameObject.cpp:851
GameObjectAI * SelectGameObjectAI(GameObject *go)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AssaultCapturePoint()

void GameObject::AssaultCapturePoint ( Player player)

Definition at line 4181 of file GameObject.cpp.

4182{
4183 if (!CanInteractWithCapturePoint(player))
4184 return;
4185
4186 if (GameObjectAI* ai = AI())
4187 if (ai->OnCapturePointAssaulted(player))
4188 return;
4189
4190 // only supported in battlegrounds
4191 Battleground* battleground = nullptr;
4192 if (BattlegroundMap* map = GetMap()->ToBattlegroundMap())
4193 if (Battleground* bg = map->GetBG())
4194 battleground = bg;
4195
4196 if (!battleground)
4197 return;
4198
4199 // Cancel current timer
4201
4202 if (player->GetBGTeam() == HORDE)
4203 {
4205 {
4206 // defended. capture instantly.
4208 battleground->SendBroadcastText(GetGOInfo()->capturePoint.DefendedBroadcastHorde, CHAT_MSG_BG_SYSTEM_HORDE, player);
4210 if (GetGOInfo()->capturePoint.DefendedEventHorde)
4211 GameEvents::Trigger(GetGOInfo()->capturePoint.DefendedEventHorde, player, this);
4212 return;
4213 }
4214
4216 {
4221 battleground->SendBroadcastText(GetGOInfo()->capturePoint.AssaultBroadcastHorde, CHAT_MSG_BG_SYSTEM_HORDE, player);
4223 if (GetGOInfo()->capturePoint.ContestedEventHorde)
4224 GameEvents::Trigger(GetGOInfo()->capturePoint.ContestedEventHorde, player, this);
4226 break;
4227 default:
4228 break;
4229 }
4230 }
4231 else
4232 {
4234 {
4235 // defended. capture instantly.
4239 if (GetGOInfo()->capturePoint.DefendedEventAlliance)
4240 GameEvents::Trigger(GetGOInfo()->capturePoint.DefendedEventAlliance, player, this);
4241 return;
4242 }
4243
4245 {
4252 if (GetGOInfo()->capturePoint.ContestedEventAlliance)
4253 GameEvents::Trigger(GetGOInfo()->capturePoint.ContestedEventAlliance, player, this);
4255 break;
4256 default:
4257 break;
4258 }
4259 }
4260}
@ TEAM_ALLIANCE
@ TEAM_HORDE
@ HORDE
@ CHAT_MSG_BG_SYSTEM_ALLIANCE
@ CHAT_MSG_BG_SYSTEM_HORDE
void SendBroadcastText(uint32 id, ChatMsg msgType, WorldObject const *target=nullptr)
void UpdateCapturePoint()
GameObjectAI * AI() const
Definition: GameObject.h:373
bool CanInteractWithCapturePoint(Player const *target) const
Team GetBGTeam() const
Definition: Player.cpp:23586
TC_GAME_API void Trigger(uint32 gameEventId, WorldObject *source, WorldObject *target)
struct GameObjectTemplate::@211::@255 capturePoint
uint32 DefendedBroadcastAlliance
uint32 AssaultBroadcastAlliance
TeamId LastTeamCapture
Definition: GameObject.h:139
uint32 AssaultTimer
Definition: GameObject.h:141
WorldPackets::Battleground::BattlegroundCapturePointState State
Definition: GameObject.h:140
struct GameObjectValue::@210 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.

Definition at line 3957 of file GameObject.cpp.

3958{
3960 std::size_t sizePos = data->wpos();
3961 *data << uint32(0);
3962 *data << uint8(flags);
3963 m_objectData->WriteCreate(*data, flags, this, target);
3964 m_gameObjectData->WriteCreate(*data, flags, this, target);
3965 data->put<uint32>(sizePos, data->wpos() - sizePos - 4);
3966}
uint8_t uint8
Definition: Define.h:145
uint16 flags
Definition: DisableMgr.cpp:49
size_t wpos() const
Definition: ByteBuffer.h:412
void put(std::size_t pos, T value)
Definition: ByteBuffer.h:220
UF::UpdateField< UF::GameObjectData, 0, TYPEID_GAMEOBJECT > m_gameObjectData
Definition: GameObject.h:443
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECT > m_objectData
Definition: Object.h:254
virtual UF::UpdateFieldFlag GetUpdateFieldFlagsFor(Player const *target) const
Definition: Object.cpp:763
UpdateFieldFlag
Definition: UpdateField.h:34
+ Here is the call graph for this function:

◆ BuildValuesUpdate()

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

Implements Object.

Definition at line 3968 of file GameObject.cpp.

3969{
3971 std::size_t sizePos = data->wpos();
3972 *data << uint32(0);
3974
3976 m_objectData->WriteUpdate(*data, flags, this, target);
3977
3979 m_gameObjectData->WriteUpdate(*data, flags, this, target);
3980
3981 data->put<uint32>(sizePos, data->wpos() - sizePos - 4);
3982}
@ TYPEID_OBJECT
Definition: ObjectGuid.h:35
UF::UpdateFieldHolder m_values
Definition: Object.h:253
bool HasChanged(uint32 index) const
Definition: UpdateField.h:701
uint32 GetChangedObjectTypeMask() const
Definition: UpdateField.h:696
+ 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

Definition at line 3984 of file GameObject.cpp.

3986{
3988 if (requestedObjectMask.IsAnySet())
3989 valuesMask.Set(TYPEID_OBJECT);
3990
3991 if (requestedGameObjectMask.IsAnySet())
3992 valuesMask.Set(TYPEID_GAMEOBJECT);
3993
3994 ByteBuffer& buffer = PrepareValuesUpdateBuffer(data);
3995 std::size_t sizePos = buffer.wpos();
3996 buffer << uint32(0);
3997 buffer << uint32(valuesMask.GetBlock(0));
3998
3999 if (valuesMask[TYPEID_OBJECT])
4000 m_objectData->WriteUpdate(buffer, requestedObjectMask, true, this, target);
4001
4002 if (valuesMask[TYPEID_GAMEOBJECT])
4003 m_gameObjectData->WriteUpdate(buffer, requestedGameObjectMask, true, this, target);
4004
4005 buffer.put<uint32>(sizePos, buffer.wpos() - sizePos - 4);
4006
4007 data->AddUpdateBlock();
4008}
ByteBuffer & PrepareValuesUpdateBuffer(UpdateData *data) const
Definition: Object.cpp:218
void AddUpdateBlock()
Definition: UpdateData.h:49
uint32 GetBlock(uint32 index) const
Definition: UpdateMask.h:53
void Set(uint32 index)
Definition: UpdateMask.h:84
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanInteractWithCapturePoint()

bool GameObject::CanInteractWithCapturePoint ( Player const *  target) const

Definition at line 4323 of file GameObject.cpp.

+ 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.

Definition at line 875 of file GameObject.cpp.

876{
878
880}
void RemoveFromOwner()
Definition: GameObject.cpp:882
virtual void CleanupsBeforeDelete(bool finalCleanup=true)
Definition: Object.cpp:974
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClearLoot()

void GameObject::ClearLoot ( )

Definition at line 3754 of file GameObject.cpp.

3755{
3756 // Unlink loot objects from this GameObject before destroying to avoid accessing freed memory from Loot destructor
3757 std::unique_ptr<Loot> loot(std::move(m_loot));
3758 std::unordered_map<ObjectGuid, std::unique_ptr<Loot>> personalLoot(std::move(m_personalLoot));
3759
3760 loot.reset();
3761 personalLoot.clear();
3762 m_unique_users.clear();
3763 m_usetimes = 0;
3764}
std::unordered_map< ObjectGuid, std::unique_ptr< Loot > > m_personalLoot
Definition: GameObject.h:323
std::unique_ptr< Loot > m_loot
Definition: GameObject.h:322
+ Here is the caller graph for this function:

◆ ClearSkillupList()

void GameObject::ClearSkillupList ( )
inline

Definition at line 312 of file GameObject.h.

312{ m_SkillupList.clear(); }

◆ ClearUpdateMask()

void GameObject::ClearUpdateMask ( bool  remove)
overrideprotectedvirtual

Reimplemented from Object.

Definition at line 4021 of file GameObject.cpp.

4022{
4025}
virtual void ClearUpdateMask(bool remove)
Definition: Object.cpp:783
void ClearChangesMask(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:690
+ 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

Definition at line 953 of file GameObject.cpp.

954{
955 ASSERT(map);
956 SetMap(map);
957
958 Relocate(pos);
960 if (!IsPositionValid())
961 {
962 TC_LOG_ERROR("misc", "Gameobject (Spawn id: {} Entry: {}) not created. Suggested coordinates isn't valid (X: {} Y: {})", GetSpawnId(), entry, pos.GetPositionX(), pos.GetPositionY());
963 return false;
964 }
965
966 // Set if this object can handle dynamic spawns
967 if (!dynamic)
969
971
973 if (m_zoneScript)
974 {
976 if (!entry)
977 return false;
978 }
979
980 GameObjectTemplate const* goInfo = sObjectMgr->GetGameObjectTemplate(entry);
981 if (!goInfo)
982 {
983 TC_LOG_ERROR("sql.sql", "Gameobject (Spawn id: {} Entry: {}) not created: non-existing entry in `gameobject_template`. Map: {} (X: {} Y: {} Z: {})", GetSpawnId(), entry, map->GetId(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
984 return false;
985 }
986
988 {
989 TC_LOG_ERROR("sql.sql", "Gameobject (Spawn id: {} Entry: {}) not created: gameobject type GAMEOBJECT_TYPE_MAP_OBJ_TRANSPORT cannot be manually created.", GetSpawnId(), entry);
990 return false;
991 }
992
993 ObjectGuid guid;
994 if (goInfo->type != GAMEOBJECT_TYPE_TRANSPORT)
995 guid = ObjectGuid::Create<HighGuid::GameObject>(map->GetId(), goInfo->entry, map->GenerateLowGuid<HighGuid::GameObject>());
996 else
997 {
998 guid = ObjectGuid::Create<HighGuid::Transport>(map->GenerateLowGuid<HighGuid::Transport>());
1000 }
1001
1002 Object::_Create(guid);
1003
1004 m_goInfo = goInfo;
1005 m_goTemplateAddon = sObjectMgr->GetGameObjectTemplateAddon(entry);
1006
1007 if (goInfo->type >= MAX_GAMEOBJECT_TYPE)
1008 {
1009 TC_LOG_ERROR("sql.sql", "Gameobject ({} Spawn id: {} Entry: {}) not created: non-existing GO type '{}' in `gameobject_template`. It will crash client if created.", guid.ToString(), GetSpawnId(), entry, goInfo->type);
1010 return false;
1011 }
1012
1013 SetLocalRotation(rotation.x, rotation.y, rotation.z, rotation.w);
1014 GameObjectAddon const* gameObjectAddon = sObjectMgr->GetGameObjectAddon(GetSpawnId());
1015
1016 // For most of gameobjects is (0, 0, 0, 1) quaternion, there are only some transports with not standard rotation
1017 QuaternionData parentRotation;
1018 if (gameObjectAddon)
1019 parentRotation = gameObjectAddon->ParentRotation;
1020
1021 SetParentRotation(parentRotation);
1022
1023 SetObjectScale(goInfo->size);
1024
1025 if (GameObjectOverride const* goOverride = GetGameObjectOverride())
1026 {
1027 SetFaction(goOverride->Faction);
1028 ReplaceAllFlags(GameObjectFlags(goOverride->Flags));
1029 }
1030
1032 {
1034 {
1035 m_updateFlag.GameObject = true;
1037 }
1038
1041 }
1042
1043 SetEntry(goInfo->entry);
1044
1045 // set name for logs usage, doesn't affect anything ingame
1046 SetName(goInfo->name);
1047
1048 SetDisplayId(goInfo->displayId);
1049
1050 CreateModel();
1051 // GAMEOBJECT_BYTES_1, index at 0, 1, 2 and 3
1052 SetGoType(GameobjectTypes(goInfo->type));
1053 m_prevGoState = goState;
1054 SetGoState(goState);
1055 SetGoArtKit(artKit);
1056
1058
1059 switch (goInfo->type)
1060 {
1062 SetGoAnimProgress(animProgress);
1063 m_goValue.FishingHole.MaxOpens = urand(GetGOInfo()->fishingHole.minRestock, GetGOInfo()->fishingHole.maxRestock);
1064 break;
1066 {
1067 // TODO: Get the values somehow, no longer in gameobject_template
1068 m_goValue.Building.Health = 20000/*goinfo->destructibleBuilding.intactNumHits + goinfo->destructibleBuilding.damagedNumHits*/;
1070 SetGoAnimProgress(255);
1071 // yes, even after the updatefield rewrite this garbage hack is still in client
1072 QuaternionData reinterpretId;
1073 memcpy(&reinterpretId.x, &m_goInfo->destructibleBuilding.DestructibleModelRec, sizeof(float));
1075 break;
1076 }
1078 {
1079 m_goTypeImpl = std::make_unique<GameObjectType::Transport>(*this);
1080 if (goInfo->transport.startOpen)
1082 else
1084
1085 SetGoAnimProgress(animProgress);
1086 setActive(true);
1087 break;
1088 }
1090 SetLevel(0);
1091 SetGoAnimProgress(255);
1092 break;
1094 if (GetGOInfo()->trap.stealthed)
1095 {
1098 }
1099
1100 if (GetGOInfo()->trap.stealthAffected)
1101 {
1104 }
1105 break;
1107 m_goTypeImpl = std::make_unique<GameObjectType::ControlZone>(*this);
1108 setActive(true);
1109 break;
1111 m_goTypeImpl = std::make_unique<GameObjectType::NewFlag>(*this);
1112 if (map->Instanceable())
1113 setActive(true);
1114 break;
1116 if (map->Instanceable())
1117 setActive(true);
1118 break;
1122 break;
1129 if (map->Instanceable())
1130 setActive(true);
1131 break;
1132 default:
1133 SetGoAnimProgress(animProgress);
1134 break;
1135 }
1136
1137 if (gameObjectAddon)
1138 {
1139 if (gameObjectAddon->InvisibilityValue)
1140 {
1141 m_invisibility.AddFlag(gameObjectAddon->invisibilityType);
1142 m_invisibility.AddValue(gameObjectAddon->invisibilityType, gameObjectAddon->InvisibilityValue);
1143 }
1144
1145 if (gameObjectAddon->WorldEffectID)
1146 {
1147 m_updateFlag.GameObject = true;
1148 SetWorldEffectID(gameObjectAddon->WorldEffectID);
1149 }
1150
1151 if (gameObjectAddon->AIAnimKitID)
1152 _animKitId = gameObjectAddon->AIAnimKitID;
1153 }
1154
1156
1157 m_stringIds[0] = goInfo->StringId;
1158
1160
1161 if (spawnid)
1162 m_spawnId = spawnid;
1163
1164 if (uint32 linkedEntry = GetGOInfo()->GetLinkedGameObjectEntry())
1165 {
1166 if (GameObject* linkedGo = GameObject::CreateGameObject(linkedEntry, map, pos, rotation, 255, GO_STATE_READY))
1167 {
1168 SetLinkedTrap(linkedGo);
1169 if (!map->AddToMap(linkedGo))
1170 delete linkedGo;
1171 }
1172 }
1173
1174 // Check if GameObject is Infinite
1175 if (goInfo->IsInfiniteGameObject())
1177
1178 // Check if GameObject is Gigantic
1179 if (goInfo->IsGiganticGameObject())
1181
1182 // Check if GameObject is Large
1183 if (goInfo->IsLargeGameObject())
1185
1186 return true;
1187}
#define sDB2Manager
Definition: DB2Stores.h:537
#define ASSERT
Definition: Errors.h:68
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
@ STEALTH_TRAP
GameobjectTypes
@ GAMEOBJECT_TYPE_TRAP
@ GAMEOBJECT_TYPE_FISHINGHOLE
@ GAMEOBJECT_TYPE_CONTROL_ZONE
@ GAMEOBJECT_TYPE_NEW_FLAG_DROP
@ GAMEOBJECT_TYPE_PHASEABLE_MO
@ GAMEOBJECT_TYPE_NEW_FLAG
@ GAMEOBJECT_TYPE_FISHINGNODE
@ GAMEOBJECT_TYPE_MAP_OBJ_TRANSPORT
@ GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING
@ INVISIBILITY_TRAP
#define MAX_GAMEOBJECT_TYPE
@ TEAM_NEUTRAL
GameObjectFlags
@ GO_STATE_TRANSPORT_STOPPED
void AddFlag(FLAG_TYPE flag)
Definition: Object.h:424
void AddValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:429
void CreateModel()
void ReplaceAllFlags(GameObjectFlags flags)
Definition: GameObject.h:271
void SetGoAnimProgress(uint8 animprogress)
Definition: GameObject.h:283
static GameObject * CreateGameObject(uint32 entry, Map *map, Position const &pos, QuaternionData const &rotation, uint32 animProgress, GOState goState, uint32 artKit=0)
void SetWorldEffectID(uint32 worldEffectID)
Definition: GameObject.h:420
void SetRespawnCompatibilityMode(bool mode=true)
Definition: GameObject.h:368
void SetGoType(GameobjectTypes type)
Definition: GameObject.h:275
void SetLinkedTrap(GameObject *linkedTrap)
Definition: GameObject.h:332
void SetLocalRotation(float qx, float qy, float qz, float qw)
ObjectGuid::LowType GetSpawnId() const
Definition: GameObject.h:207
bool AIM_Initialize()
Definition: GameObject.cpp:857
void SetLevel(uint32 level)
Definition: GameObject.h:273
void SetDisplayId(uint32 displayid)
std::array< std::string_view, 3 > m_stringIds
Definition: GameObject.h:476
GameObjectOverride const * GetGameObjectOverride() const
void SetParentRotation(QuaternionData const &rotation)
void SetFaction(uint32 faction) override
Definition: GameObject.h:384
bool AddToMap(T *)
Definition: Map.cpp:530
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:515
bool Instanceable() const
Definition: Map.cpp:3200
uint32 GetId() const
Definition: Map.cpp:3195
std::string ToString() const
Definition: ObjectGuid.cpp:554
void SetUpdateFieldValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
Definition: Object.h:272
void _Create(ObjectGuid const &guid)
Definition: Object.cpp:101
void SetEntry(uint32 entry)
Definition: Object.h:161
virtual void SetObjectScale(float scale)
Definition: Object.h:164
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:683
uint32 LastUsedScriptID
Definition: Object.h:727
FlaggedValuesArray32< int32, uint64, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibility
Definition: Object.h:596
void SetZoneScript()
Definition: Object.cpp:1999
void setActive(bool isActiveObject)
Definition: Object.cpp:915
virtual void SetMap(Map *map)
Definition: Object.cpp:1782
void SetName(std::string newname)
Definition: Object.h:537
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealth
Definition: Object.h:593
void SetVisibilityDistanceOverride(VisibilityDistanceType type)
Definition: Object.cpp:938
virtual uint32 GetGameObjectEntry(ObjectGuid::LowType, uint32 entry)
Definition: ZoneScript.h:69
bool GameObject
Definition: Object.h:94
bool ServerTime
Definition: Object.h:89
QuaternionData ParentRotation
InvisibilityType invisibilityType
struct GameObjectTemplate::@211::@224 transport
struct GameObjectTemplate::@211::@256 phaseableMO
std::string StringId
bool IsLargeGameObject() const
bool IsGiganticGameObject() const
bool IsInfiniteGameObject() const
struct GameObjectTemplate::@211::@246 destructibleBuilding
bool IsPositionValid() const
Definition: Position.cpp:42
UpdateField< QuaternionData, 0, 13 > ParentRotation
UpdateField< uint32, 0, 7 > SpawnTrackingStateAnimID
UpdateField< uint32, 0, 5 > SpellVisualID
struct GameObjectValue::@209 Building
uint32 MaxHealth
Definition: GameObject.h:134
struct GameObjectValue::@207 FishingHole
+ 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

Definition at line 1189 of file GameObject.cpp.

1190{
1191 GameObjectTemplate const* goInfo = sObjectMgr->GetGameObjectTemplate(entry);
1192 if (!goInfo)
1193 return nullptr;
1194
1195 GameObject* go = new GameObject();
1196 if (!go->Create(entry, map, pos, rotation, animProgress, goState, artKit, false, 0))
1197 {
1198 delete go;
1199 return nullptr;
1200 }
1201
1202 return go;
1203}
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:953
+ 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

Definition at line 1205 of file GameObject.cpp.

1206{
1207 GameObject* go = new GameObject();
1208 if (!go->LoadFromDB(spawnId, map, addToMap))
1209 {
1210 delete go;
1211 return nullptr;
1212 }
1213
1214 return go;
1215}
bool LoadFromDB(ObjectGuid::LowType spawnId, Map *map, bool addToMap, bool=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateModel()

void GameObject::CreateModel ( )
protected

Definition at line 4437 of file GameObject.cpp.

4438{
4439 m_model = GameObjectModel::Create(std::make_unique<GameObjectModelOwnerImpl>(this), sWorld->GetDataPath());
4440 if (m_model && m_model->isMapObject())
4442}
@ GO_FLAG_MAP_OBJECT
static GameObjectModel * Create(std::unique_ptr< GameObjectModelOwnerBase > modelOwner, std::string const &dataPath)
bool isMapObject() const
#define sWorld
Definition: World.h:931
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Delete()

void GameObject::Delete ( )

Definition at line 1742 of file GameObject.cpp.

1743{
1746
1748 {
1750 SendMessageToSet(packet.Write(), true);
1751 }
1752
1754
1757
1758 if (GameObjectOverride const* goOverride = GetGameObjectOverride())
1759 ReplaceAllFlags(GameObjectFlags(goOverride->Flags));
1760
1762 if (m_respawnCompatibilityMode && poolid)
1763 sPoolMgr->UpdatePool<GameObject>(GetMap()->GetPoolData(), poolid, GetSpawnId());
1764 else
1766}
#define sPoolMgr
Definition: PoolMgr.h:179
void SetLootState(LootState s, Unit *unit=nullptr)
void SendGameObjectDespawn()
GameObjectData const * GetGameObjectData() const
Definition: GameObject.h:200
SpawnedPoolData & GetPoolData()
Definition: Map.h:710
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition: Object.cpp:1732
void AddObjectToRemoveList()
Definition: Object.cpp:1812
uint32 poolId
Definition: SpawnData.h:110
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DeleteFromDB()

bool GameObject::DeleteFromDB ( ObjectGuid::LowType  spawnId)
static

Definition at line 1985 of file GameObject.cpp.

1986{
1987 GameObjectData const* data = sObjectMgr->GetGameObjectData(spawnId);
1988 if (!data)
1989 return false;
1990
1991 CharacterDatabaseTransaction charTrans = CharacterDatabase.BeginTransaction();
1992
1993 sMapMgr->DoForAllMapsWithMapId(data->mapId,
1994 [spawnId, charTrans](Map* map) -> void
1995 {
1996 // despawn all active objects, and remove their respawns
1997 std::vector<GameObject*> toUnload;
1998 for (auto const& pair : Trinity::Containers::MapEqualRange(map->GetGameObjectBySpawnIdStore(), spawnId))
1999 toUnload.push_back(pair.second);
2000 for (GameObject* obj : toUnload)
2001 map->AddObjectToRemoveList(obj);
2002 map->RemoveRespawnTime(SPAWN_TYPE_GAMEOBJECT, spawnId, charTrans);
2003 }
2004 );
2005
2006 // delete data from memory
2007 sObjectMgr->DeleteGameObjectData(spawnId);
2008
2009 CharacterDatabase.CommitTransaction(charTrans);
2010
2011 WorldDatabaseTransaction trans = WorldDatabase.BeginTransaction();
2012
2013 // ... and the database
2015 stmt->setUInt64(0, spawnId);
2016 trans->Append(stmt);
2017
2018 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_SPAWNGROUP_MEMBER);
2020 stmt->setUInt64(1, spawnId);
2021 trans->Append(stmt);
2022
2023 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_EVENT_GAMEOBJECT);
2024 stmt->setUInt64(0, spawnId);
2025 trans->Append(stmt);
2026
2027 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_LINKED_RESPAWN);
2028 stmt->setUInt64(0, spawnId);
2030 trans->Append(stmt);
2031
2032 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_LINKED_RESPAWN);
2033 stmt->setUInt64(0, spawnId);
2035 trans->Append(stmt);
2036
2037 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_LINKED_RESPAWN_MASTER);
2038 stmt->setUInt64(0, spawnId);
2040 trans->Append(stmt);
2041
2042 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_LINKED_RESPAWN_MASTER);
2043 stmt->setUInt64(0, spawnId);
2045 trans->Append(stmt);
2046
2047 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAMEOBJECT_ADDON);
2048 stmt->setUInt64(0, spawnId);
2049 trans->Append(stmt);
2050
2051 WorldDatabase.CommitTransaction(trans);
2052
2053 return true;
2054}
SQLTransaction< WorldDatabaseConnection > WorldDatabaseTransaction
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
#define sMapMgr
Definition: MapManager.h:183
@ LINKED_RESPAWN_CREATURE_TO_GO
Definition: SpawnData.h:123
@ LINKED_RESPAWN_GO_TO_GO
Definition: SpawnData.h:124
@ LINKED_RESPAWN_GO_TO_CREATURE
Definition: SpawnData.h:125
@ SPAWN_TYPE_GAMEOBJECT
Definition: SpawnData.h:35
@ WORLD_DEL_EVENT_GAMEOBJECT
Definition: WorldDatabase.h:37
@ WORLD_DEL_SPAWNGROUP_MEMBER
Definition: WorldDatabase.h:84
@ WORLD_DEL_GAMEOBJECT
Definition: WorldDatabase.h:36
@ WORLD_DEL_LINKED_RESPAWN
Definition: WorldDatabase.h:31
@ WORLD_DEL_GAMEOBJECT_ADDON
Definition: WorldDatabase.h:85
@ WORLD_DEL_LINKED_RESPAWN_MASTER
Definition: WorldDatabase.h:32
Definition: Map.h:187
void setUInt8(const uint8 index, const uint8 value)
void setUInt32(const uint8 index, const uint32 value)
void setUInt64(const uint8 index, const uint64 value)
uint32 mapId
Definition: SpawnData.h:94
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DespawnForPlayer()

void GameObject::DespawnForPlayer ( Player seer,
Seconds  respawnTime 
)

Definition at line 1734 of file GameObject.cpp.

1735{
1736 PerPlayerState& perPlayerState = GetOrCreatePerPlayerStates()[seer->GetGUID()];
1737 perPlayerState.ValidUntil = GameTime::GetSystemTime() + respawnTime;
1738 perPlayerState.Despawned = true;
1739 seer->UpdateVisibilityOf(this);
1740}
std::unordered_map< ObjectGuid, PerPlayerState > & GetOrCreatePerPlayerStates()
void UpdateVisibilityOf(WorldObject *target)
Definition: Player.cpp:23861
SystemTimePoint GetSystemTime()
Current chrono system_clock time point.
Definition: GameTime.cpp:54
+ 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 
)

Definition at line 1713 of file GameObject.cpp.

1714{
1715 if (delay > 0ms)
1716 {
1717 if (!m_despawnDelay || m_despawnDelay > delay.count())
1718 {
1719 m_despawnDelay = delay.count();
1720 m_despawnRespawnTime = forceRespawnTime;
1721 }
1722 }
1723 else
1724 {
1725 if (m_goData)
1726 {
1727 uint32 const respawnDelay = (forceRespawnTime > 0s) ? forceRespawnTime.count() : m_goData->spawntimesecs;
1728 SaveRespawnTime(respawnDelay);
1729 }
1730 Delete();
1731 }
1732}
void Delete()
void SaveRespawnTime(uint32 forceDelay=0)
int32 spawntimesecs
Definition: SpawnData.h:111
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EnableCollision()

void GameObject::EnableCollision ( bool  enable)

Definition at line 3899 of file GameObject.cpp.

3900{
3901 if (!m_model)
3902 return;
3903
3904 /*if (enable && !GetMap()->ContainsGameObjectModel(*m_model))
3905 GetMap()->InsertGameObjectModel(*m_model);*/
3906
3907 m_model->enableCollision(enable);
3908}
void enableCollision(bool enable)
+ 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.

Definition at line 416 of file GameObject.h.

416{ return _animKitId; }

◆ GetAIName()

std::string const & GameObject::GetAIName ( ) const

Definition at line 870 of file GameObject.cpp.

871{
872 return sObjectMgr->GetGameObjectTemplate(GetEntry())->AIName;
873}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetCreatorGUID()

ObjectGuid GameObject::GetCreatorGUID ( ) const
inlineoverridevirtual

Implements WorldObject.

Definition at line 226 of file GameObject.h.

226{ return m_gameObjectData->CreatedBy; }

◆ GetDebugInfo()

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

Reimplemented from Object.

Reimplemented in Transport.

Definition at line 4444 of file GameObject.cpp.

4445{
4446 std::stringstream sstr;
4447 sstr << WorldObject::GetDebugInfo() << "\n"
4448 << "SpawnId: " << GetSpawnId() << " GoState: " << std::to_string(GetGoState()) << " ScriptId: " << GetScriptId() << " AIName: " << GetAIName();
4449 return sstr.str();
4450}
uint32 GetScriptId() const
std::string const & GetAIName() const
Definition: GameObject.cpp:870
std::string GetDebugInfo() const override
Definition: Object.cpp:3757
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDestructibleState()

GameObjectDestructibleState GameObject::GetDestructibleState ( ) const
inline

Definition at line 358 of file GameObject.h.

359 {
360 if ((*m_gameObjectData->Flags & GO_FLAG_DESTROYED))
362 if ((*m_gameObjectData->Flags & GO_FLAG_DAMAGED))
365 }
@ GO_DESTRUCTIBLE_DESTROYED
@ GO_DESTRUCTIBLE_INTACT
@ GO_DESTRUCTIBLE_DAMAGED
@ GO_FLAG_DESTROYED
@ GO_FLAG_DAMAGED
+ Here is the caller graph for this function:

◆ GetDisplayId()

uint32 GameObject::GetDisplayId ( ) const
inline

Definition at line 380 of file GameObject.h.

380{ return m_gameObjectData->DisplayID; }
+ Here is the caller graph for this function:

◆ GetFaction()

uint32 GameObject::GetFaction ( ) const
inlineoverridevirtual

Implements WorldObject.

Definition at line 383 of file GameObject.h.

383{ return m_gameObjectData->FactionTemplate; }
+ Here is the caller graph for this function:

◆ GetFishLoot()

Loot * GameObject::GetFishLoot ( Player lootOwner)

Definition at line 1775 of file GameObject.cpp.

1776{
1777 uint32 defaultzone = 1;
1778
1779 Loot* fishLoot = new Loot(GetMap(), GetGUID(), LOOT_FISHING, nullptr);
1780
1781 uint32 areaId = GetAreaId();
1782 ItemContext itemContext = ItemBonusMgr::GetContextForPlayer(GetMap()->GetMapDifficulty(), lootOwner);
1783 while (AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaId))
1784 {
1785 fishLoot->FillLoot(areaId, LootTemplates_Fishing, lootOwner, true, true, LOOT_MODE_DEFAULT, itemContext);
1786 if (!fishLoot->isLooted())
1787 break;
1788
1789 areaId = areaEntry->ParentAreaID;
1790 }
1791
1792 if (fishLoot->isLooted())
1793 fishLoot->FillLoot(defaultzone, LootTemplates_Fishing, lootOwner, true, true, LOOT_MODE_DEFAULT, itemContext);
1794
1795 return fishLoot;
1796}
DB2Storage< AreaTableEntry > sAreaTableStore("AreaTable.db2", &AreaTableLoadInfo::Instance)
ItemContext
Definition: DBCEnums.h:1063
LootStore LootTemplates_Fishing("fishing_loot_template", "area id", true)
@ LOOT_FISHING
Definition: Loot.h:103
@ LOOT_MODE_DEFAULT
Definition: SharedDefines.h:77
uint32 GetAreaId() const
Definition: Object.h:528
ItemContext GetContextForPlayer(MapDifficultyEntry const *mapDifficulty, Player const *player)
Definition: Loot.h:281
bool isLooted() const
Definition: Loot.h:307
bool FillLoot(uint32 lootId, LootStore const &store, Player *lootOwner, bool personal, bool noEmptyError=false, uint16 lootMode=LOOT_MODE_DEFAULT, ItemContext context=ItemContext::NONE)
Definition: Loot.cpp:759
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetFishLootJunk()

Loot * GameObject::GetFishLootJunk ( Player lootOwner)

Definition at line 1798 of file GameObject.cpp.

1799{
1800 uint32 defaultzone = 1;
1801
1802 Loot* fishLoot = new Loot(GetMap(), GetGUID(), LOOT_FISHING_JUNK, nullptr);
1803
1804 uint32 areaId = GetAreaId();
1805 ItemContext itemContext = ItemBonusMgr::GetContextForPlayer(GetMap()->GetMapDifficulty(), lootOwner);
1806 while (AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaId))
1807 {
1808 fishLoot->FillLoot(areaId, LootTemplates_Fishing, lootOwner, true, true, LOOT_MODE_JUNK_FISH, itemContext);
1809 if (!fishLoot->isLooted())
1810 break;
1811
1812 areaId = areaEntry->ParentAreaID;
1813 }
1814
1815 if (fishLoot->isLooted())
1816 fishLoot->FillLoot(defaultzone, LootTemplates_Fishing, lootOwner, true, true, LOOT_MODE_JUNK_FISH, itemContext);
1817
1818 return fishLoot;
1819}
@ LOOT_FISHING_JUNK
Definition: Loot.h:113
@ LOOT_MODE_JUNK_FISH
Definition: SharedDefines.h:82
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetFlagCarrierGUID()

ObjectGuid const & GameObject::GetFlagCarrierGUID ( ) const

Definition at line 4354 of file GameObject.cpp.

4355{
4357 return ObjectGuid::Empty;
4358
4359 GameObjectType::NewFlag const* newFlag = dynamic_cast<GameObjectType::NewFlag const*>(m_goTypeImpl.get());
4360 if (!newFlag)
4361 return ObjectGuid::Empty;
4362
4363 return newFlag->GetCarrierGUID();
4364}
ObjectGuid const & GetCarrierGUID() const
Definition: GameObject.cpp:554
static ObjectGuid const Empty
Definition: ObjectGuid.h:272
+ Here is the call graph for this function:

◆ GetFlagState()

FlagState GameObject::GetFlagState ( ) const

Definition at line 4342 of file GameObject.cpp.

4343{
4345 return FlagState(0);
4346
4347 GameObjectType::NewFlag const* newFlag = dynamic_cast<GameObjectType::NewFlag const*>(m_goTypeImpl.get());
4348 if (!newFlag)
4349 return FlagState(0);
4350
4351 return newFlag->GetState();
4352}
FlagState
Definition: GameObject.h:41
FlagState GetState() const
Definition: GameObject.cpp:553
+ Here is the call graph for this function:

◆ GetFlagTakenFromBaseTime()

time_t GameObject::GetFlagTakenFromBaseTime ( ) const

Definition at line 4366 of file GameObject.cpp.

4367{
4369 return time_t(0);
4370
4371 GameObjectType::NewFlag const* newFlag = dynamic_cast<GameObjectType::NewFlag const*>(m_goTypeImpl.get());
4372 if (!newFlag)
4373 return time_t(0);
4374
4375 return newFlag->GetTakenFromBaseTime();
4376}
time_t GetTakenFromBaseTime() const
Definition: GameObject.cpp:555
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetGameObjectData()

GameObjectData const * GameObject::GetGameObjectData ( ) const
inline

Definition at line 200 of file GameObject.h.

200{ return m_goData; }
+ Here is the caller graph for this function:

◆ GetGameObjectOverride()

GameObjectOverride const * GameObject::GetGameObjectOverride ( ) const

Definition at line 1686 of file GameObject.cpp.

1687{
1688 if (m_spawnId)
1689 {
1690 if (GameObjectOverride const* goOverride = sObjectMgr->GetGameObjectOverride(m_spawnId))
1691 return goOverride;
1692 }
1693
1694 return m_goTemplateAddon;
1695}
+ Here is the caller graph for this function:

◆ GetGoAnimProgress()

uint8 GameObject::GetGoAnimProgress ( ) const
inline

Definition at line 282 of file GameObject.h.

282{ return m_gameObjectData->PercentHealth; }
+ Here is the caller graph for this function:

◆ GetGoArtKit()

uint32 GameObject::GetGoArtKit ( ) const
inline

Definition at line 280 of file GameObject.h.

280{ return m_gameObjectData->ArtKit; }
+ Here is the caller graph for this function:

◆ GetGOInfo()

GameObjectTemplate const * GameObject::GetGOInfo ( ) const
inline

Definition at line 197 of file GameObject.h.

197{ return m_goInfo; }
+ Here is the caller graph for this function:

◆ GetGoState()

GOState GameObject::GetGoState ( ) const
inline

Definition at line 276 of file GameObject.h.

276{ return GOState(*m_gameObjectData->State); }
+ Here is the caller graph for this function:

◆ GetGoStateFor()

GOState GameObject::GetGoStateFor ( ObjectGuid const &  viewer) const

Definition at line 3838 of file GameObject.cpp.

3839{
3840 if (m_perPlayerState)
3841 if (PerPlayerState const* state = Trinity::Containers::MapGetValuePtr(*m_perPlayerState, viewer))
3842 if (state->State)
3843 return *state->State;
3844
3845 return GetGoState();
3846}
std::unique_ptr< std::unordered_map< ObjectGuid, PerPlayerState > > m_perPlayerState
Definition: GameObject.h:512
auto MapGetValuePtr(M &map, typename M::key_type const &key)
Definition: MapUtils.h:29
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetGoType()

GameobjectTypes GameObject::GetGoType ( ) const
inline

Definition at line 274 of file GameObject.h.

274{ return GameobjectTypes(*m_gameObjectData->TypeID); }
+ Here is the caller graph for this function:

◆ GetGOValue()

GameObjectValue const * GameObject::GetGOValue ( ) const
inline

Definition at line 201 of file GameObject.h.

201{ return &m_goValue; }
+ Here is the caller graph for this function:

◆ GetInsidePlayers()

GuidUnorderedSet const * GameObject::GetInsidePlayers ( ) const

Definition at line 4378 of file GameObject.cpp.

4379{
4380 if (GameObjectType::ControlZone const* controlZone = dynamic_cast<GameObjectType::ControlZone const*>(m_goTypeImpl.get()))
4381 return controlZone->GetInsidePlayers();
4382
4383 return nullptr;
4384}
+ Here is the caller graph for this function:

◆ GetInteractionDistance()

float GameObject::GetInteractionDistance ( ) const

Definition at line 4096 of file GameObject.cpp.

4097{
4098 if (GetGOInfo()->GetInteractRadiusOverride())
4099 return float(GetGOInfo()->GetInteractRadiusOverride()) / 100.0f;
4100
4101 switch (GetGoType())
4102 {
4104 return 0.0f;
4110 return 5.5555553f;
4112 return 10.0f;
4115 return 3.0f;
4117 return 100.0f;
4119 return 20.0f + CONTACT_DISTANCE; // max spell range
4125 return 5.0f;
4126 // Following values are not blizzlike
4129 // 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.
4130 // 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.
4131 return 10.0f; // 5.0f is blizzlike
4132 default:
4133 return INTERACTION_DISTANCE;
4134 }
4135}
#define INTERACTION_DISTANCE
Definition: ObjectDefines.h:24
#define CONTACT_DISTANCE
Definition: ObjectDefines.h:23
@ GAMEOBJECT_TYPE_GUILD_BANK
@ GAMEOBJECT_TYPE_MINI_GAME
@ GAMEOBJECT_TYPE_CAMERA
@ GAMEOBJECT_TYPE_MAP_OBJECT
@ GAMEOBJECT_TYPE_FLAGDROP
@ GAMEOBJECT_TYPE_MAILBOX
@ GAMEOBJECT_TYPE_FLAGSTAND
@ GAMEOBJECT_TYPE_CHAIR
@ GAMEOBJECT_TYPE_TEXT
@ GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY
@ GAMEOBJECT_TYPE_AREADAMAGE
@ GAMEOBJECT_TYPE_BARBER_CHAIR
@ GAMEOBJECT_TYPE_DOOR
@ GAMEOBJECT_TYPE_BINDER
+ 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.

Definition at line 2178 of file GameObject.cpp.

2179{
2180 if (Unit* owner = GetOwner())
2181 return owner->GetLevelForTarget(target);
2182
2184 {
2185 if (Player const* player = target->ToPlayer())
2186 if (Optional<ContentTuningLevels> userLevels = sDB2Manager.GetContentTuningData(GetGOInfo()->ContentTuningId, player->m_playerData->CtrOptions->ContentTuningConditionMask))
2187 return uint8(std::clamp<int16>(player->GetLevel(), userLevels->MinLevel, userLevels->MaxLevel));
2188
2189 if (Unit const* targetUnit = target->ToUnit())
2190 return targetUnit->GetLevel();
2191 }
2192
2193 return 1;
2194}
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
static Player * ToPlayer(Object *o)
Definition: Object.h:200
Unit * GetOwner() const
Definition: Object.cpp:2217
+ Here is the call graph for this function:

◆ GetLinkedTrap()

GameObject * GameObject::GetLinkedTrap ( )

Definition at line 3952 of file GameObject.cpp.

3953{
3955}
ObjectGuid m_linkedTrap
Definition: GameObject.h:486
TC_GAME_API GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetLocalRotation()

QuaternionData const & GameObject::GetLocalRotation ( ) const
inline

Definition at line 213 of file GameObject.h.

213{ return m_localRotation; }
QuaternionData m_localRotation
Definition: GameObject.h:480
+ Here is the caller graph for this function:

◆ GetLootForPlayer()

Loot * GameObject::GetLootForPlayer ( Player const *  player) const
overridevirtual

Reimplemented from Object.

Definition at line 3941 of file GameObject.cpp.

3942{
3943 if (m_personalLoot.empty())
3944 return m_loot.get();
3945
3946 if (std::unique_ptr<Loot> const* loot = Trinity::Containers::MapGetValuePtr(m_personalLoot, player->GetGUID()))
3947 return loot->get();
3948
3949 return nullptr;
3950}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetLootMode()

uint16 GameObject::GetLootMode ( ) const
inline

Definition at line 297 of file GameObject.h.

297{ return m_LootMode; }
+ Here is the caller graph for this function:

◆ getLootState()

LootState GameObject::getLootState ( ) const
inline

Definition at line 293 of file GameObject.h.

293{ return m_lootState; }
+ Here is the caller graph for this function:

◆ GetNameForLocaleIdx()

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

Implements Object.

Definition at line 3519 of file GameObject.cpp.

3520{
3521 if (locale != DEFAULT_LOCALE)
3522 if (GameObjectLocale const* cl = sObjectMgr->GetGameObjectLocale(GetEntry()))
3523 if (cl->Name.size() > locale && !cl->Name[locale].empty())
3524 return cl->Name[locale];
3525
3526 return GetName();
3527}
#define DEFAULT_LOCALE
Definition: Common.h:66
std::string const & GetName() const
Definition: Object.h:536
+ Here is the call graph for this function:

◆ GetNameSetId()

uint8 GameObject::GetNameSetId ( ) const

Definition at line 3866 of file GameObject.cpp.

3867{
3868 switch (GetGoType())
3869 {
3872 {
3873 switch (GetDestructibleState())
3874 {
3876 return modelData->State0NameSet;
3878 return modelData->State1NameSet;
3880 return modelData->State2NameSet;
3882 return modelData->State3NameSet;
3883 default:
3884 break;
3885 }
3886 }
3887 break;
3891 return ((*m_gameObjectData->Flags) >> 8) & 0xF;
3892 default:
3893 break;
3894 }
3895
3896 return 0;
3897}
DB2Storage< DestructibleModelDataEntry > sDestructibleModelDataStore("DestructibleModelData.db2", &DestructibleModelDataLoadInfo::Instance)
@ GAMEOBJECT_TYPE_GARRISON_PLOT
@ GAMEOBJECT_TYPE_GARRISON_BUILDING
@ GO_DESTRUCTIBLE_REBUILDING
GameObjectDestructibleState GetDestructibleState() const
Definition: GameObject.h:358
+ Here is the call graph for this function:

◆ GetOrCreatePerPlayerStates()

std::unordered_map< ObjectGuid, GameObject::PerPlayerState > & GameObject::GetOrCreatePerPlayerStates ( )
private

Definition at line 4398 of file GameObject.cpp.

4399{
4400 if (!m_perPlayerState)
4401 m_perPlayerState = std::make_unique<std::unordered_map<ObjectGuid, PerPlayerState>>();
4402
4403 return *m_perPlayerState;
4404}
+ Here is the caller graph for this function:

◆ GetOwnerGUID()

ObjectGuid GameObject::GetOwnerGUID ( ) const
inlineoverridevirtual

Implements WorldObject.

Definition at line 237 of file GameObject.h.

237{ return m_gameObjectData->CreatedBy; }
+ Here is the caller graph for this function:

◆ GetPackedLocalRotation()

int64 GameObject::GetPackedLocalRotation ( ) const
inline

Definition at line 214 of file GameObject.h.

214{ return m_packedRotation; }

◆ GetPauseTimes()

std::vector< uint32 > const * GameObject::GetPauseTimes ( ) const

Definition at line 4027 of file GameObject.cpp.

4028{
4029 if (GameObjectType::Transport const* transport = dynamic_cast<GameObjectType::Transport const*>(m_goTypeImpl.get()))
4030 return transport->GetPauseTimes();
4031
4032 return nullptr;
4033}

◆ GetRespawnCompatibilityMode()

bool GameObject::GetRespawnCompatibilityMode ( )
inline

Definition at line 369 of file GameObject.h.

+ Here is the caller graph for this function:

◆ GetRespawnDelay()

uint32 GameObject::GetRespawnDelay ( ) const
inline

Definition at line 259 of file GameObject.h.

259{ return m_respawnDelayTime; }
+ Here is the caller graph for this function:

◆ GetRespawnPosition()

void GameObject::GetRespawnPosition ( float &  x,
float &  y,
float &  z,
float *  ori = nullptr 
) const

Definition at line 4053 of file GameObject.cpp.

4054{
4055 if (m_goData)
4056 {
4057 if (ori)
4058 m_goData->spawnPoint.GetPosition(x, y, z, *ori);
4059 else
4061 }
4062 else
4063 {
4064 if (ori)
4065 GetPosition(x, y, z, *ori);
4066 else
4067 GetPosition(x, y, z);
4068 }
4069}
Position GetPosition() const
Definition: Position.h:84
void GetPosition(float &x, float &y) const
Definition: Position.h:81
Position spawnPoint
Definition: SpawnData.h:105
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetRespawnTime()

time_t GameObject::GetRespawnTime ( ) const
inline

Definition at line 246 of file GameObject.h.

246{ return m_respawnTime; }

◆ GetRespawnTimeEx()

time_t GameObject::GetRespawnTimeEx ( ) const

Definition at line 2196 of file GameObject.cpp.

2197{
2198 time_t now = GameTime::GetGameTime();
2199 if (m_respawnTime > now)
2200 return m_respawnTime;
2201 else
2202 return now;
2203}
time_t GetGameTime()
Definition: GameTime.cpp:44
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetScriptId()

uint32 GameObject::GetScriptId ( ) const

Definition at line 3490 of file GameObject.cpp.

3491{
3493 if (uint32 scriptId = gameObjectData->scriptId)
3494 return scriptId;
3495
3496 return GetGOInfo()->ScriptId;
3497}
ObjectData const gameObjectData[]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSpawnId()

ObjectGuid::LowType GameObject::GetSpawnId ( ) const
inline

Definition at line 207 of file GameObject.h.

207{ return m_spawnId; }
+ Here is the caller graph for this function:

◆ GetSpellForLock()

SpellInfo const * GameObject::GetSpellForLock ( Player const *  player) const

Definition at line 4497 of file GameObject.cpp.

4498{
4499 if (!player)
4500 return nullptr;
4501
4502 uint32 lockId = GetGOInfo()->GetLockId();
4503 if (!lockId)
4504 return nullptr;
4505
4506 LockEntry const* lock = sLockStore.LookupEntry(lockId);
4507 if (!lock)
4508 return nullptr;
4509
4510 for (uint8 i = 0; i < MAX_LOCK_CASE; ++i)
4511 {
4512 if (!lock->Type[i])
4513 continue;
4514
4515 if (lock->Type[i] == LOCK_KEY_SPELL)
4516 if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(lock->Index[i], GetMap()->GetDifficultyID()))
4517 return spell;
4518
4519 if (lock->Type[i] != LOCK_KEY_SKILL)
4520 break;
4521
4522 for (auto&& playerSpell : player->GetSpellMap())
4523 if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(playerSpell.first, GetMap()->GetDifficultyID()))
4524 for (auto&& effect : spell->GetEffects())
4525 if (effect.Effect == SPELL_EFFECT_OPEN_LOCK && effect.MiscValue == lock->Index[i])
4526 if (effect.CalcValue(player) >= int32(lock->Skill[i]))
4527 return spell;
4528 }
4529
4530 return nullptr;
4531}
DB2Storage< LockEntry > sLockStore("Lock.db2", &LockLoadInfo::Instance)
#define MAX_LOCK_CASE
@ LOCK_KEY_SKILL
@ LOCK_KEY_SPELL
@ SPELL_EFFECT_OPEN_LOCK
#define sSpellMgr
Definition: SpellMgr.h:849
uint32 GetLockId() const
std::array< uint8, MAX_LOCK_CASE > Type
std::array< uint16, MAX_LOCK_CASE > Skill
std::array< int32, MAX_LOCK_CASE > Index
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSpellId()

uint32 GameObject::GetSpellId ( ) const
inline

Definition at line 244 of file GameObject.h.

244{ return m_spellId;}
+ Here is the caller graph for this function:

◆ GetStationaryO()

float GameObject::GetStationaryO ( ) const
inlineoverridevirtual

Reimplemented from WorldObject.

Definition at line 398 of file GameObject.h.

float GetOrientation() const
Definition: Position.h:79

◆ GetStationaryPosition()

Position const & GameObject::GetStationaryPosition ( ) const
inline

Definition at line 399 of file GameObject.h.

399{ return m_stationaryPosition; }
+ Here is the caller graph for this function:

◆ GetStationaryX()

float GameObject::GetStationaryX ( ) const
inlineoverridevirtual

Reimplemented from WorldObject.

Definition at line 395 of file GameObject.h.

float GetPositionX() const
Definition: Position.h:76

◆ GetStationaryY()

float GameObject::GetStationaryY ( ) const
inlineoverridevirtual

Reimplemented from WorldObject.

Definition at line 396 of file GameObject.h.

float GetPositionY() const
Definition: Position.h:77

◆ GetStationaryZ()

float GameObject::GetStationaryZ ( ) const
inlineoverridevirtual

Reimplemented from WorldObject.

Definition at line 397 of file GameObject.h.

float GetPositionZ() const
Definition: Position.h:78

◆ GetStringIds()

std::array< std::string_view, 3 > const & GameObject::GetStringIds ( ) const
inline

Definition at line 377 of file GameObject.h.

377{ return m_stringIds; }

◆ GetTapList()

GuidUnorderedSet const & GameObject::GetTapList ( ) const
inline

Definition at line 325 of file GameObject.h.

325{ return m_tapList; }
GuidUnorderedSet m_tapList
Definition: GameObject.h:483
+ Here is the caller graph for this function:

◆ GetTemplateAddon()

GameObjectTemplateAddon const * GameObject::GetTemplateAddon ( ) const
inline

Definition at line 198 of file GameObject.h.

198{ return m_goTemplateAddon; }
+ Here is the caller graph for this function:

◆ GetUniqueUseCount()

uint32 GameObject::GetUniqueUseCount ( ) const
inline

Definition at line 318 of file GameObject.h.

318{ return uint32(m_unique_users.size()); }
+ Here is the caller graph for this function:

◆ GetUseCount()

uint32 GameObject::GetUseCount ( ) const
inline

Definition at line 317 of file GameObject.h.

317{ return m_usetimes; }
+ Here is the caller graph for this function:

◆ GetWorldEffectID()

uint32 GameObject::GetWorldEffectID ( ) const
inline

Definition at line 419 of file GameObject.h.

419{ return _worldEffectID; }

◆ GetWorldRotation()

QuaternionData GameObject::GetWorldRotation ( ) const

Definition at line 3566 of file GameObject.cpp.

3567{
3568 QuaternionData localRotation = GetLocalRotation();
3569 if (Transport* transport = dynamic_cast<Transport*>(GetTransport()))
3570 {
3571 QuaternionData worldRotation = transport->GetWorldRotation();
3572
3573 G3D::Quat worldRotationQuat(worldRotation.x, worldRotation.y, worldRotation.z, worldRotation.w);
3574 G3D::Quat localRotationQuat(localRotation.x, localRotation.y, localRotation.z, localRotation.w);
3575
3576 G3D::Quat resultRotation = localRotationQuat * worldRotationQuat;
3577
3578 return QuaternionData(resultRotation.x, resultRotation.y, resultRotation.z, resultRotation.w);
3579 }
3580 return localRotation;
3581}
QuaternionData const & GetLocalRotation() const
Definition: GameObject.h:213
TransportBase * GetTransport() const
Definition: Object.h:730
+ 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

Definition at line 4431 of file GameObject.cpp.

4432{
4433 if (m_goTypeImpl)
4434 command.Execute(*m_goTypeImpl);
4435}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasFlag()

bool GameObject::HasFlag ( GameObjectFlags  flags) const
inline

Definition at line 268 of file GameObject.h.

268{ return (*m_gameObjectData->Flags & flags) != 0; }
+ Here is the caller graph for this function:

◆ hasInvolvedQuest()

bool GameObject::hasInvolvedQuest ( uint32  quest_id) const
overridevirtual

Reimplemented from Object.

Definition at line 2064 of file GameObject.cpp.

2065{
2066 return sObjectMgr->GetGOQuestInvolvedRelations(GetEntry()).HasQuest(quest_id);
2067}
+ Here is the call graph for this function:

◆ HasLootMode()

bool GameObject::HasLootMode ( uint16  lootMode) const
inline

Definition at line 298 of file GameObject.h.

298{ return (m_LootMode & lootMode) != 0; }

◆ HasLootRecipient()

bool GameObject::HasLootRecipient ( ) const
inline

Definition at line 328 of file GameObject.h.

328{ return !m_tapList.empty(); }
+ Here is the caller graph for this function:

◆ hasQuest()

bool GameObject::hasQuest ( uint32  quest_id) const
overridevirtual

Reimplemented from Object.

Definition at line 2059 of file GameObject.cpp.

2060{
2061 return sObjectMgr->GetGOQuestRelations(GetEntry()).HasQuest(quest_id);
2062}
+ Here is the call graph for this function:

◆ HasStringId()

bool GameObject::HasStringId ( std::string_view  id) const

Definition at line 3499 of file GameObject.cpp.

3500{
3501 return std::find(m_stringIds.begin(), m_stringIds.end(), id) != m_stringIds.end();
3502}
+ Here is the caller graph for this function:

◆ IsAlwaysVisibleFor()

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

Reimplemented from WorldObject.

Definition at line 2135 of file GameObject.cpp.

2136{
2138 return true;
2139
2141 return true;
2142
2143 if (!seer)
2144 return false;
2145
2146 // Always seen by owner and friendly units
2147 if (!GetOwnerGUID().IsEmpty())
2148 {
2149 if (seer->GetGUID() == GetOwnerGUID())
2150 return true;
2151
2152 Unit* owner = GetOwner();
2153 if (Unit const* unitSeer = seer->ToUnit())
2154 if (owner && owner->IsFriendlyTo(unitSeer))
2155 return true;
2156 }
2157
2158 return false;
2159}
ObjectGuid GetOwnerGUID() const override
Definition: GameObject.h:237
bool IsDestructibleBuilding() const
virtual bool IsAlwaysVisibleFor(WorldObject const *seer) const
Definition: Object.h:801
bool IsFriendlyTo(WorldObject const *target) const
Definition: Object.cpp:2853
+ Here is the call graph for this function:

◆ IsAtInteractDistance() [1/2]

bool GameObject::IsAtInteractDistance ( Player const *  player,
SpellInfo const *  spell = nullptr 
) const

Definition at line 4452 of file GameObject.cpp.

4453{
4454 if (spell || (spell = GetSpellForLock(player)))
4455 {
4456 float maxRange = spell->GetMaxRange(spell->IsPositive());
4457
4459 return maxRange * maxRange >= GetExactDistSq(player);
4460
4461 if (sGameObjectDisplayInfoStore.LookupEntry(GetGOInfo()->displayId))
4462 return IsAtInteractDistance(*player, maxRange);
4463 }
4464
4466}
DB2Storage< GameObjectDisplayInfoEntry > sGameObjectDisplayInfoStore("GameObjectDisplayInfo.db2", &GameobjectDisplayInfoLoadInfo::Instance)
@ GAMEOBJECT_TYPE_SPELL_FOCUS
bool IsAtInteractDistance(Position const &pos, float radius) const
SpellInfo const * GetSpellForLock(Player const *player) const
float GetInteractionDistance() const
float GetExactDistSq(float x, float y, float z) const
Definition: Position.h:110
+ Here is the call graph for this function:

◆ IsAtInteractDistance() [2/2]

bool GameObject::IsAtInteractDistance ( Position const &  pos,
float  radius 
) const

Definition at line 4468 of file GameObject.cpp.

4469{
4470 if (GameObjectDisplayInfoEntry const* displayInfo = sGameObjectDisplayInfoStore.LookupEntry(GetGOInfo()->displayId))
4471 {
4472 float scale = GetObjectScale();
4473
4474 float minX = displayInfo->GeoBoxMin.X * scale - radius;
4475 float minY = displayInfo->GeoBoxMin.Y * scale - radius;
4476 float minZ = displayInfo->GeoBoxMin.Z * scale - radius;
4477 float maxX = displayInfo->GeoBoxMax.X * scale + radius;
4478 float maxY = displayInfo->GeoBoxMax.Y * scale + radius;
4479 float maxZ = displayInfo->GeoBoxMax.Z * scale + radius;
4480
4481 QuaternionData worldRotation = GetWorldRotation();
4482 G3D::Quat worldRotationQuat(worldRotation.x, worldRotation.y, worldRotation.z, worldRotation.w);
4483
4484 return G3D::CoordinateFrame { { worldRotationQuat }, { GetPositionX(), GetPositionY(), GetPositionZ() } }
4485 .toWorldSpace(G3D::Box { { minX, minY, minZ }, { maxX, maxY, maxZ } })
4486 .contains({ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ() });
4487 }
4488
4489 return GetExactDist(&pos) <= radius;
4490}
QuaternionData GetWorldRotation() const
float GetObjectScale() const
Definition: Object.h:163
float GetExactDist(float x, float y, float z) const
Definition: Position.h:118
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsDestructibleBuilding()

bool GameObject::IsDestructibleBuilding ( ) const

Definition at line 2090 of file GameObject.cpp.

2091{
2092 GameObjectTemplate const* gInfo = GetGOInfo();
2093 if (!gInfo)
2094 return false;
2095
2097}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsDynTransport()

bool GameObject::IsDynTransport ( ) const

Definition at line 2080 of file GameObject.cpp.

2081{
2082 // If something is marked as a transport, don't transmit an out of range packet for it.
2083 GameObjectTemplate const* gInfo = GetGOInfo();
2084 if (!gInfo)
2085 return false;
2086
2088}
+ Here is the call graph for this function:

◆ IsFullyLooted()

bool GameObject::IsFullyLooted ( ) const

Definition at line 3766 of file GameObject.cpp.

3767{
3768 if (m_loot && !m_loot->isLooted())
3769 return false;
3770
3771 for (auto const& [_, loot] : m_personalLoot)
3772 if (!loot->isLooted())
3773 return false;
3774
3775 return true;
3776}
+ Here is the caller 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

Definition at line 3464 of file GameObject.cpp.

3465{
3467 if (!info)
3468 return IsWithinDist3d(x, y, z, radius);
3469
3470 float sinA = std::sin(GetOrientation());
3471 float cosA = std::cos(GetOrientation());
3472 float dx = x - GetPositionX();
3473 float dy = y - GetPositionY();
3474 float dz = z - GetPositionZ();
3475 float dist = std::sqrt(dx*dx + dy*dy);
3478 if (G3D::fuzzyEq(dist, 0.0f))
3479 return true;
3480
3481 float sinB = dx / dist;
3482 float cosB = dy / dist;
3483 dx = dist * (cosA * cosB + sinA * sinB);
3484 dy = dist * (cosA * sinB - sinA * cosB);
3485 return dx < info->GeoBoxMax.X + radius && dx > info->GeoBoxMin.X - radius
3486 && dy < info->GeoBoxMax.Y + radius && dy > info->GeoBoxMin.Y - radius
3487 && dz < info->GeoBoxMax.Z + radius && dz > info->GeoBoxMin.Z - radius;
3488}
bool IsWithinDist3d(float x, float y, float z, float dist) const
Definition: Object.cpp:1114
+ 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

Definition at line 308 of file GameObject.h.

309 {
310 return m_SkillupList.count(playerGuid) > 0;
311 }
+ Here is the caller graph for this function:

◆ IsInvisibleDueToDespawn()

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

Reimplemented from WorldObject.

Definition at line 2161 of file GameObject.cpp.

2162{
2164 return true;
2165
2166 // Despawned
2167 if (!isSpawned())
2168 return true;
2169
2170 if (m_perPlayerState)
2171 if (PerPlayerState const* state = Trinity::Containers::MapGetValuePtr(*m_perPlayerState, seer->GetGUID()))
2172 if (state->Despawned)
2173 return true;
2174
2175 return false;
2176}
bool isSpawned() const
Definition: GameObject.h:251
virtual bool IsInvisibleDueToDespawn(WorldObject const *seer) const
Definition: Object.h:802
+ Here is the call graph for this function:

◆ IsLootAllowedFor()

bool GameObject::IsLootAllowedFor ( Player const *  player) const

Definition at line 3925 of file GameObject.cpp.

3926{
3927 if (Loot const* loot = GetLootForPlayer(player)) // check only if loot was already generated
3928 {
3929 if (loot->isLooted()) // nothing to loot or everything looted.
3930 return false;
3931 if (!loot->HasAllowedLooter(GetGUID()) || (!loot->hasItemForAll() && !loot->hasItemFor(player))) // no loot in chest for this player
3932 return false;
3933 }
3934
3935 if (HasLootRecipient())
3936 return m_tapList.find(player->GetGUID()) != m_tapList.end();
3937
3938 return true;
3939}
bool HasLootRecipient() const
Definition: GameObject.h:328
Loot * GetLootForPlayer(Player const *) const override
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsNeverVisibleFor()

bool GameObject::IsNeverVisibleFor ( WorldObject const *  seer,
bool  allowServersideObjects = false 
) const
overridevirtual

Reimplemented from WorldObject.

Definition at line 2118 of file GameObject.cpp.

2119{
2121 return true;
2122
2123 if (GetGOInfo()->GetServerOnly() && !allowServersideObjects)
2124 return true;
2125
2126 if (!GetDisplayId() && GetGOInfo()->IsDisplayMandatory())
2127 return true;
2128
2129 if (m_goTypeImpl)
2130 return m_goTypeImpl->IsNeverVisibleFor(seer, allowServersideObjects);
2131
2132 return false;
2133}
uint32 GetDisplayId() const
Definition: GameObject.h:380
virtual bool IsNeverVisibleFor(WorldObject const *seer, bool allowServersideObjects=false) const
Definition: Object.h:800
+ Here is the call graph for this function:

◆ isSpawned()

bool GameObject::isSpawned ( ) const
inline

Definition at line 251 of file GameObject.h.

252 {
253 return m_respawnDelayTime == 0 ||
256 }
+ Here is the caller graph for this function:

◆ isSpawnedByDefault()

bool GameObject::isSpawnedByDefault ( ) const
inline

Definition at line 257 of file GameObject.h.

257{ return m_spawnedByDefault; }

◆ IsTransport()

bool GameObject::IsTransport ( ) const

Definition at line 2069 of file GameObject.cpp.

2070{
2071 // If something is marked as a transport, don't transmit an out of range packet for it.
2072 GameObjectTemplate const* gInfo = GetGOInfo();
2073 if (!gInfo)
2074 return false;
2075
2077}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsWithinDistInMap() [1/2]

bool GameObject::IsWithinDistInMap ( Player const *  player) const

Definition at line 4492 of file GameObject.cpp.

4493{
4494 return IsInMap(player) && InSamePhase(player) && IsAtInteractDistance(player);
4495}
bool InSamePhase(PhaseShift const &phaseShift) const
Definition: Object.h:509
bool IsInMap(WorldObject const *obj) const
Definition: Object.cpp:1107
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsWithinDistInMap() [2/2]

bool WorldObject::IsWithinDistInMap ( WorldObject const *  obj,
float  dist2compare,
bool  is3D = true,
bool  incOwnRadius = true,
bool  incTargetRadius = true 
) const

Definition at line 556 of file Object.cpp.

1140{
1141 return obj && IsInMap(obj) && InSamePhase(obj) && _IsWithinDist(obj, dist2compare, is3D, incOwnRadius, incTargetRadius);
1142}
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...
Definition: GameObject.h:494

◆ LoadFromDB()

bool GameObject::LoadFromDB ( ObjectGuid::LowType  spawnId,
Map map,
bool  addToMap,
bool  = true 
)

Definition at line 1915 of file GameObject.cpp.

1916{
1917 GameObjectData const* data = sObjectMgr->GetGameObjectData(spawnId);
1918 if (!data)
1919 {
1920 TC_LOG_ERROR("sql.sql", "Gameobject (GUID: {}) not found in table `gameobject`, can't load. ", spawnId);
1921 return false;
1922 }
1923
1924 uint32 entry = data->id;
1925 //uint32 map_id = data->mapid; // already used before call
1926
1927 uint32 animprogress = data->animprogress;
1928 GOState go_state = data->goState;
1929 uint32 artKit = data->artKit;
1930
1931 m_spawnId = spawnId;
1933 if (!Create(entry, map, data->spawnPoint, data->rotation, animprogress, go_state, artKit, !m_respawnCompatibilityMode, spawnId))
1934 return false;
1935
1938
1939 if (data->spawntimesecs >= 0)
1940 {
1941 m_spawnedByDefault = true;
1942
1943 if (!GetGOInfo()->GetDespawnPossibility() && !GetGOInfo()->IsDespawnAtAction())
1944 {
1947 m_respawnTime = 0;
1948 }
1949 else
1950 {
1953
1954 // ready to respawn
1956 {
1957 m_respawnTime = 0;
1959 }
1960 }
1961 }
1962 else
1963 {
1965 {
1966 TC_LOG_WARN("sql.sql", "GameObject {} (SpawnID {}) is not spawned by default, but tries to use a non-hack spawn system. This will not work. Defaulting to compatibility mode.", entry, spawnId);
1968 }
1969
1970 m_spawnedByDefault = false;
1972 m_respawnTime = 0;
1973 }
1974
1975 m_goData = data;
1976
1977 m_stringIds[1] = data->StringId;
1978
1979 if (addToMap && !GetMap()->AddToMap(this))
1980 return false;
1981
1982 return true;
1983}
#define TC_LOG_WARN(filterType__,...)
Definition: Log.h:162
@ GO_FLAG_NODESPAWN
@ SPAWNGROUP_FLAG_COMPATIBILITY_MODE
Definition: SpawnData.h:55
void RemoveRespawnTime(SpawnObjectType type, ObjectGuid::LowType spawnId, CharacterDatabaseTransaction dbTrans=nullptr, bool alwaysDeleteFromDB=false)
Definition: Map.h:682
time_t GetGORespawnTime(ObjectGuid::LowType spawnId) const
Definition: Map.h:482
static void InitDbVisibleMapId(PhaseShift &phaseShift, int32 visibleMapId)
static void InitDbPhaseShift(PhaseShift &phaseShift, uint8 phaseUseFlags, uint16 phaseId, uint32 phaseGroupId)
PhaseShift & GetPhaseShift()
Definition: Object.h:505
QuaternionData rotation
uint8 phaseUseFlags
Definition: SpawnData.h:106
uint32 id
Definition: SpawnData.h:104
uint32 phaseId
Definition: SpawnData.h:107
int32 terrainSwapMap
Definition: SpawnData.h:109
uint32 phaseGroup
Definition: SpawnData.h:108
std::string StringId
Definition: SpawnData.h:114
SpawnGroupFlags flags
Definition: SpawnData.h:70
SpawnGroupTemplateData const * spawnGroupData
Definition: SpawnData.h:96
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LookupFishingHoleAround()

GameObject * GameObject::LookupFishingHoleAround ( float  range)

Definition at line 2291 of file GameObject.cpp.

2292{
2293 GameObject* ok = nullptr;
2294 Trinity::NearestGameObjectFishingHole u_check(*this, range);
2296 Cell::VisitGridObjects(this, checker, range);
2297 return ok;
2298}
static void VisitGridObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:179
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MeetsInteractCondition()

bool GameObject::MeetsInteractCondition ( Player const *  user) const

Definition at line 4386 of file GameObject.cpp.

4387{
4388 if (!m_goInfo->GetConditionID1())
4389 return true;
4390
4391 if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(m_goInfo->GetConditionID1()))
4392 if (!ConditionMgr::IsPlayerMeetingCondition(user, playerCondition))
4393 return false;
4394
4395 return true;
4396}
DB2Storage< PlayerConditionEntry > sPlayerConditionStore("PlayerCondition.db2", &PlayerConditionLoadInfo::Instance)
static bool IsPlayerMeetingCondition(Player const *player, PlayerConditionEntry const *condition)
uint32 GetConditionID1() const
+ Here is the call graph for this function:

◆ ModifyHealth()

void GameObject::ModifyHealth ( int32  change,
WorldObject attackerOrHealer = nullptr,
uint32  spellId = 0 
)

Definition at line 3583 of file GameObject.cpp.

3584{
3585 if (!m_goValue.Building.MaxHealth || !change)
3586 return;
3587
3588 // prevent double destructions of the same object
3589 if (change < 0 && !m_goValue.Building.Health)
3590 return;
3591
3592 if (int32(m_goValue.Building.Health) + change <= 0)
3596 else
3597 m_goValue.Building.Health += change;
3598
3599 // Set the health bar, value = 255 * healthPct;
3601
3602 // dealing damage, send packet
3603 if (Player* player = attackerOrHealer ? attackerOrHealer->GetCharmerOrOwnerPlayerOrPlayerItself() : nullptr)
3604 {
3606 packet.Caster = attackerOrHealer->GetGUID(); // todo: this can be a GameObject
3607 packet.Target = GetGUID();
3608 packet.Damage = -change;
3609 packet.Owner = player->GetGUID();
3610 packet.SpellID = spellId;
3611 player->SendDirectMessage(packet.Write());
3612 }
3613
3614 if (change < 0 && GetGOInfo()->destructibleBuilding.DamageEvent)
3615 GameEvents::Trigger(GetGOInfo()->destructibleBuilding.DamageEvent, attackerOrHealer, this);
3616
3618
3620 newState = GO_DESTRUCTIBLE_DESTROYED;
3621 else if (m_goValue.Building.Health <= 10000/*GetGOInfo()->destructibleBuilding.damagedNumHits*/) // TODO: Get health somewhere
3622 newState = GO_DESTRUCTIBLE_DAMAGED;
3624 newState = GO_DESTRUCTIBLE_INTACT;
3625
3626 if (newState == GetDestructibleState())
3627 return;
3628
3629 SetDestructibleState(newState, attackerOrHealer, false);
3630}
GameObjectDestructibleState
void SetDestructibleState(GameObjectDestructibleState state, WorldObject *attackerOrHealer=nullptr, bool setHealth=false)
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition: Object.cpp:2240
+ Here is the call graph for this function: