TrinityCore
Loading...
Searching...
No Matches
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)
 
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
 
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 distance) const
 
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.
 
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.
 
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 147 of file GameObject.h.

Member Typedef Documentation

◆ ChairSlotAndUser

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

Definition at line 451 of file GameObject.h.

Constructor & Destructor Documentation

◆ GameObject()

GameObject::GameObject ( )
explicit

Definition at line 574 of file GameObject.cpp.

574 : WorldObject(false), MapObject(),
575 m_model(nullptr), m_goValue(), m_AI(nullptr), m_respawnCompatibilityMode(false), _animKitId(0), _worldEffectID(0)
576{
579
581 m_updateFlag.Rotation = true;
582
583 m_respawnTime = 0;
584 m_respawnDelayTime = 300;
585 m_despawnDelay = 0;
587 m_restockTime = 0;
589 m_spawnedByDefault = true;
590 m_usetimes = 0;
591 m_spellId = 0;
592 m_cooldownTime = 0;
594 m_goInfo = nullptr;
595 m_goData = nullptr;
597 m_goTemplateAddon = nullptr;
598
599 m_spawnId = UI64LIT(0);
600
601 ResetLootMode(); // restore default loot mode
602 m_stationaryPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
603}
#define UI64LIT(N)
Definition: Define.h:128
@ GO_NOT_READY
Definition: GameObject.h:138
@ TYPEID_GAMEOBJECT
Definition: ObjectGuid.h:43
@ TYPEMASK_GAMEOBJECT
Definition: ObjectGuid.h:63
@ GO_STATE_ACTIVE
uint32 _worldEffectID
Definition: GameObject.h:487
GameObjectValue m_goValue
Definition: GameObject.h:459
time_t m_respawnTime
Definition: GameObject.h:433
time_t m_cooldownTime
Definition: GameObject.h:441
GameObjectData const * m_goData
Definition: GameObject.h:457
int64 m_packedRotation
Definition: GameObject.h:463
Position m_stationaryPosition
Definition: GameObject.h:465
time_t m_restockTime
Definition: GameObject.h:440
uint32 m_spellId
Definition: GameObject.h:432
uint32 m_respawnDelayTime
Definition: GameObject.h:434
void ResetLootMode()
Definition: GameObject.h:288
uint32 m_despawnDelay
Definition: GameObject.h:435
Seconds m_despawnRespawnTime
Definition: GameObject.h:436
bool m_respawnCompatibilityMode
Definition: GameObject.h:485
GameObjectTemplateAddon const * m_goTemplateAddon
Definition: GameObject.h:456
GameObjectAI * m_AI
Definition: GameObject.h:484
GameObjectModel * m_model
Definition: GameObject.h:372
uint16 _animKitId
Definition: GameObject.h:486
GameObjectTemplate const * m_goInfo
Definition: GameObject.h:455
ObjectGuid::LowType m_spawnId
For new or temporary gameobjects is 0 for saved it is lowguid.
Definition: GameObject.h:454
bool m_spawnedByDefault
Definition: GameObject.h:439
LootState m_lootState
Definition: GameObject.h:437
uint32 m_usetimes
Definition: GameObject.h:449
GOState m_prevGoState
Definition: GameObject.h:443
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
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 605 of file GameObject.cpp.

606{
607 delete m_AI;
608 delete m_model;
609}

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 478 of file GameObject.h.

479 {
481 return IsInRange(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), dist2compare);
482 }
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 2082 of file GameObject.cpp.

2083{
2084 Unit* unitCaster = spellCaster ? spellCaster->ToUnit() : nullptr;
2085
2086 switch (action)
2087 {
2088 case GameObjectActions::None:
2089 TC_LOG_FATAL("spell", "Spell {} has action type NONE in effect {}", spellId, effectIndex);
2090 break;
2091 case GameObjectActions::AnimateCustom0:
2092 case GameObjectActions::AnimateCustom1:
2093 case GameObjectActions::AnimateCustom2:
2094 case GameObjectActions::AnimateCustom3:
2095 SendCustomAnim(uint32(action) - uint32(GameObjectActions::AnimateCustom0));
2096 break;
2097 case GameObjectActions::Disturb: // What's the difference with Open?
2098 if (unitCaster)
2099 Use(unitCaster);
2100 break;
2101 case GameObjectActions::Unlock:
2103 break;
2104 case GameObjectActions::Lock:
2106 break;
2107 case GameObjectActions::Open:
2108 if (unitCaster)
2109 Use(unitCaster);
2110 break;
2111 case GameObjectActions::OpenAndUnlock:
2112 if (unitCaster)
2113 UseDoorOrButton(0, false, unitCaster);
2115 break;
2116 case GameObjectActions::Close:
2118 break;
2119 case GameObjectActions::ToggleOpen:
2120 // No use cases, implementation unknown
2121 break;
2122 case GameObjectActions::Destroy:
2123 if (unitCaster)
2124 UseDoorOrButton(0, true, unitCaster);
2125 break;
2126 case GameObjectActions::Rebuild:
2128 break;
2129 case GameObjectActions::Creation:
2130 // No use cases, implementation unknown
2131 break;
2132 case GameObjectActions::Despawn:
2134 break;
2135 case GameObjectActions::MakeInert:
2137 break;
2138 case GameObjectActions::MakeActive:
2140 break;
2141 case GameObjectActions::CloseAndLock:
2144 break;
2145 case GameObjectActions::UseArtKit0:
2146 case GameObjectActions::UseArtKit1:
2147 case GameObjectActions::UseArtKit2:
2148 case GameObjectActions::UseArtKit3:
2149 case GameObjectActions::UseArtKit4:
2150 {
2151 GameObjectTemplateAddon const* templateAddon = GetTemplateAddon();
2152
2153 uint32 artKitIndex = action != GameObjectActions::UseArtKit4 ? uint32(action) - uint32(GameObjectActions::UseArtKit0) : 4;
2154
2155 uint32 artKitValue = 0;
2156 if (templateAddon != nullptr)
2157 artKitValue = templateAddon->ArtKits[artKitIndex];
2158
2159 if (artKitValue == 0)
2160 TC_LOG_ERROR("sql.sql", "GameObject {} hit by spell {} needs `artkit{}` in `gameobject_template_addon`", GetEntry(), spellId, artKitIndex);
2161 else
2162 SetGoArtKit(artKitValue);
2163
2164 break;
2165 }
2166 case GameObjectActions::GoTo1stFloor:
2167 case GameObjectActions::GoTo2ndFloor:
2168 case GameObjectActions::GoTo3rdFloor:
2169 case GameObjectActions::GoTo4thFloor:
2170 case GameObjectActions::GoTo5thFloor:
2171 case GameObjectActions::GoTo6thFloor:
2172 case GameObjectActions::GoTo7thFloor:
2173 case GameObjectActions::GoTo8thFloor:
2174 case GameObjectActions::GoTo9thFloor:
2175 case GameObjectActions::GoTo10thFloor:
2176 static_assert(int32(GO_STATE_TRANSPORT_ACTIVE) == int32(GameObjectActions::GoTo1stFloor));
2178 SetGoState(GOState(action));
2179 else
2180 TC_LOG_ERROR("spell", "Spell {} targeted non-transport gameobject for transport only action \"Go to Floor\" {} in effect {}", spellId, int32(action), effectIndex);
2181 break;
2182 case GameObjectActions::PlayAnimKit:
2183 SetAnimKitId(param, false);
2184 break;
2185 case GameObjectActions::OpenAndPlayAnimKit:
2186 if (unitCaster)
2187 UseDoorOrButton(0, false, unitCaster);
2188 SetAnimKitId(param, false);
2189 break;
2190 case GameObjectActions::CloseAndPlayAnimKit:
2192 SetAnimKitId(param, false);
2193 break;
2194 case GameObjectActions::PlayOneShotAnimKit:
2195 SetAnimKitId(param, true);
2196 break;
2197 case GameObjectActions::StopAnimKit:
2198 SetAnimKitId(0, false);
2199 break;
2200 case GameObjectActions::OpenAndStopAnimKit:
2201 if (unitCaster)
2202 UseDoorOrButton(0, false, unitCaster);
2203 SetAnimKitId(0, false);
2204 break;
2205 case GameObjectActions::CloseAndStopAnimKit:
2207 SetAnimKitId(0, false);
2208 break;
2209 case GameObjectActions::PlaySpellVisual:
2210 SetSpellVisualId(param, Object::GetGUID(spellCaster));
2211 break;
2212 case GameObjectActions::StopSpellVisual:
2214 break;
2215 default:
2216 TC_LOG_ERROR("spell", "Spell {} has unhandled action {} in effect {}", spellId, int32(action), effectIndex);
2217 break;
2218 }
2219}
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:256
void SetSpellVisualId(int32 spellVisualId, ObjectGuid activatorGuid=ObjectGuid::Empty)
void DespawnOrUnsummon(Milliseconds delay=0ms, Seconds forceRespawnTime=0s)
void SetFlag(GameObjectFlags flags)
Definition: GameObject.h:255
GameobjectTypes GetGoType() const
Definition: GameObject.h:260
void SendCustomAnim(uint32 anim)
void ResetDoorOrButton()
GameObjectTemplateAddon const * GetTemplateAddon() const
Definition: GameObject.h:185
void Use(Unit *user)
void SetAnimKitId(uint16 animKitId, bool oneshot)
void SetGoArtKit(uint32 artkit)
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:747
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 1978 of file GameObject.cpp.

1979{
1980 if (target->HasQuestForGO(GetEntry()))
1981 return true;
1982
1983 if (!sObjectMgr->IsGameObjectForQuests(GetEntry()))
1984 return false;
1985
1986 switch (GetGoType())
1987 {
1989 {
1990 GameObject* go = const_cast<GameObject*>(this);
1991 QuestGiverStatus questStatus = const_cast<Player*>(target)->GetQuestDialogStatus(go);
1992 if (questStatus != QuestGiverStatus::None && questStatus != QuestGiverStatus::Future)
1993 return true;
1994 break;
1995 }
1997 {
1998 // Chests become inactive while not ready to be looted
1999 if (getLootState() == GO_NOT_READY)
2000 return false;
2001
2002 // scan GO chest with loot including quest items
2003 if (target->GetQuestStatus(GetGOInfo()->chest.questID) == QUEST_STATUS_INCOMPLETE
2007 {
2008 if (Battleground const* bg = target->GetBattleground())
2009 return bg->CanActivateGO(GetEntry(), bg->GetPlayerTeam(target->GetGUID()));
2010 return true;
2011 }
2012 break;
2013 }
2015 {
2016 if (target->GetQuestStatus(GetGOInfo()->generic.questID) == QUEST_STATUS_INCOMPLETE)
2017 return true;
2018 break;
2019 }
2021 {
2022 if (target->GetQuestStatus(GetGOInfo()->goober.questID) == QUEST_STATUS_INCOMPLETE)
2023 return true;
2024 break;
2025 }
2026 default:
2027 break;
2028 }
2029
2030 return false;
2031}
LootStore LootTemplates_Gameobject("gameobject_loot_template", "gameobject entry", true)
#define sObjectMgr
Definition: ObjectMgr.h:1952
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:184
LootState getLootState() const
Definition: GameObject.h:279
bool HaveQuestLootForPlayer(uint32 loot_id, Player const *player) const
Definition: LootMgr.cpp:210
struct GameObjectTemplate::@210::@222 goober
struct GameObjectTemplate::@210::@217 generic
struct GameObjectTemplate::@210::@215 chest
+ Here is the call graph for this function:

◆ AddLootMode()

void GameObject::AddLootMode ( uint16  lootMode)
inline

Definition at line 286 of file GameObject.h.

286{ m_LootMode |= lootMode; }
uint16 m_LootMode
Definition: GameObject.h:468

◆ AddToSkillupList()

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

Definition at line 293 of file GameObject.h.

293{ m_SkillupList.insert(PlayerGuidLow); }
GuidSet m_SkillupList
Definition: GameObject.h:445
+ 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 661 of file GameObject.cpp.

662{
664 if (!IsInWorld())
665 {
666 if (m_zoneScript)
668
670 if (m_spawnId)
671 GetMap()->GetGameObjectBySpawnIdStore().insert(std::make_pair(m_spawnId, this));
672
673 // The state can be changed after GameObject::Create but before GameObject::AddToWorld
674 bool toggledState = GetGoType() == GAMEOBJECT_TYPE_CHEST ? getLootState() == GO_READY : (GetGoState() == GO_STATE_READY || IsTransport());
675 if (m_model)
676 {
677 if (Transport* trans = ToTransport())
678 trans->SetDelayedAddModelToMap();
679 else
681 }
682
683 EnableCollision(toggledState);
685 }
686}
@ GO_READY
Definition: GameObject.h:139
@ GO_STATE_READY
GOState GetGoState() const
Definition: GameObject.h:262
void EnableCollision(bool enable)
Transport * ToTransport()
Definition: GameObject.h:378
bool IsTransport() const
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:399
GameObjectBySpawnIdContainer & GetGameObjectBySpawnIdStore()
Definition: Map.h:406
void InsertGameObjectModel(GameObjectModel const &model)
Definition: Map.h:440
bool IsInWorld() const
Definition: Object.h:153
bool Insert(KEY_TYPE const &handle, SPECIFIC_TYPE *obj)
Map * GetMap() const
Definition: Object.h:603
void AddToWorld() override
Definition: Object.cpp:1002
ZoneScript * m_zoneScript
Definition: Object.h:778
virtual void OnGameObjectCreate(GameObject *)
Definition: ZoneScript.h:57
+ 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 1463 of file GameObject.cpp.

1464{
1465 AddUse();
1466 m_unique_users.insert(player->GetGUID());
1467}
void AddUse()
Definition: GameObject.h:301
GuidSet m_unique_users
Definition: GameObject.h:448
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 301 of file GameObject.h.

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

◆ AfterRelocation()

void GameObject::AfterRelocation ( )

Definition at line 3829 of file GameObject.cpp.

3830{
3833 if (m_goTypeImpl)
3834 m_goTypeImpl->OnRelocated();
3835
3837}
void UpdateModelPosition()
std::unique_ptr< GameObjectTypeBase > m_goTypeImpl
Definition: GameObject.h:458
void UpdatePositionData()
Definition: Object.cpp:984
virtual void UpdateObjectVisibility(bool forced=true)
Definition: Object.cpp:3624
+ 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 359 of file GameObject.h.

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

◆ AIM_Destroy()

void GameObject::AIM_Destroy ( )

Definition at line 611 of file GameObject.cpp.

612{
613 delete m_AI;
614 m_AI = nullptr;
615}
+ Here is the caller graph for this function:

◆ AIM_Initialize()

bool GameObject::AIM_Initialize ( )

Definition at line 617 of file GameObject.cpp.

618{
619 AIM_Destroy();
620
622
623 if (!m_AI)
624 return false;
625
627 return true;
628}
virtual void InitializeAI()
Definition: GameObjectAI.h:61
void AIM_Destroy()
Definition: GameObject.cpp:611
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 3924 of file GameObject.cpp.

3925{
3926 if (!CanInteractWithCapturePoint(player))
3927 return;
3928
3929 if (GameObjectAI* ai = AI())
3930 if (ai->OnCapturePointAssaulted(player))
3931 return;
3932
3933 // only supported in battlegrounds
3934 Battleground* battleground = nullptr;
3935 if (BattlegroundMap* map = GetMap()->ToBattlegroundMap())
3936 if (Battleground* bg = map->GetBG())
3937 battleground = bg;
3938
3939 if (!battleground)
3940 return;
3941
3942 // Cancel current timer
3944
3945 if (player->GetBGTeam() == HORDE)
3946 {
3948 {
3949 // defended. capture instantly.
3951 battleground->SendBroadcastText(GetGOInfo()->capturePoint.DefendedBroadcastHorde, CHAT_MSG_BG_SYSTEM_HORDE, player);
3953 if (GetGOInfo()->capturePoint.DefendedEventHorde)
3954 GameEvents::Trigger(GetGOInfo()->capturePoint.DefendedEventHorde, player, this);
3955 return;
3956 }
3957
3959 {
3964 battleground->SendBroadcastText(GetGOInfo()->capturePoint.AssaultBroadcastHorde, CHAT_MSG_BG_SYSTEM_HORDE, player);
3966 if (GetGOInfo()->capturePoint.ContestedEventHorde)
3967 GameEvents::Trigger(GetGOInfo()->capturePoint.ContestedEventHorde, player, this);
3969 break;
3970 default:
3971 break;
3972 }
3973 }
3974 else
3975 {
3977 {
3978 // defended. capture instantly.
3982 if (GetGOInfo()->capturePoint.DefendedEventAlliance)
3983 GameEvents::Trigger(GetGOInfo()->capturePoint.DefendedEventAlliance, player, this);
3984 return;
3985 }
3986
3988 {
3995 if (GetGOInfo()->capturePoint.ContestedEventAlliance)
3996 GameEvents::Trigger(GetGOInfo()->capturePoint.ContestedEventAlliance, player, this);
3998 break;
3999 default:
4000 break;
4001 }
4002 }
4003}
@ 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:359
bool CanInteractWithCapturePoint(Player const *target) const
uint32 GetBGTeam() const
Definition: Player.cpp:23300
TC_GAME_API void Trigger(uint32 gameEventId, WorldObject *source, WorldObject *target)
struct GameObjectTemplate::@210::@254 capturePoint
uint32 DefendedBroadcastAlliance
uint32 AssaultBroadcastAlliance
TeamId LastTeamCapture
Definition: GameObject.h:126
uint32 AssaultTimer
Definition: GameObject.h:128
WorldPackets::Battleground::BattlegroundCapturePointState State
Definition: GameObject.h:127
struct GameObjectValue::@209 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 3700 of file GameObject.cpp.

3701{
3703 std::size_t sizePos = data->wpos();
3704 *data << uint32(0);
3705 *data << uint8(flags);
3706 m_objectData->WriteCreate(*data, flags, this, target);
3707 m_gameObjectData->WriteCreate(*data, flags, this, target);
3708 data->put<uint32>(sizePos, data->wpos() - sizePos - 4);
3709}
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:427
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECT > m_objectData
Definition: Object.h:254
virtual UF::UpdateFieldFlag GetUpdateFieldFlagsFor(Player const *target) const
Definition: Object.cpp:762
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 3711 of file GameObject.cpp.

3712{
3714 std::size_t sizePos = data->wpos();
3715 *data << uint32(0);
3717
3719 m_objectData->WriteUpdate(*data, flags, this, target);
3720
3722 m_gameObjectData->WriteUpdate(*data, flags, this, target);
3723
3724 data->put<uint32>(sizePos, data->wpos() - sizePos - 4);
3725}
@ TYPEID_OBJECT
Definition: ObjectGuid.h:35
UF::UpdateFieldHolder m_values
Definition: Object.h:253
bool HasChanged(uint32 index) const
Definition: UpdateField.h:691
uint32 GetChangedObjectTypeMask() const
Definition: UpdateField.h:686
+ 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 3727 of file GameObject.cpp.

3729{
3731 if (requestedObjectMask.IsAnySet())
3732 valuesMask.Set(TYPEID_OBJECT);
3733
3734 if (requestedGameObjectMask.IsAnySet())
3735 valuesMask.Set(TYPEID_GAMEOBJECT);
3736
3737 ByteBuffer& buffer = PrepareValuesUpdateBuffer(data);
3738 std::size_t sizePos = buffer.wpos();
3739 buffer << uint32(0);
3740 buffer << uint32(valuesMask.GetBlock(0));
3741
3742 if (valuesMask[TYPEID_OBJECT])
3743 m_objectData->WriteUpdate(buffer, requestedObjectMask, true, this, target);
3744
3745 if (valuesMask[TYPEID_GAMEOBJECT])
3746 m_gameObjectData->WriteUpdate(buffer, requestedGameObjectMask, true, this, target);
3747
3748 buffer.put<uint32>(sizePos, buffer.wpos() - sizePos - 4);
3749
3750 data->AddUpdateBlock();
3751}
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 4066 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 635 of file GameObject.cpp.

636{
638
640}
void RemoveFromOwner()
Definition: GameObject.cpp:642
virtual void CleanupsBeforeDelete(bool finalCleanup=true)
Definition: Object.cpp:973
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClearLoot()

void GameObject::ClearLoot ( )

Definition at line 3497 of file GameObject.cpp.

3498{
3499 // Unlink loot objects from this GameObject before destroying to avoid accessing freed memory from Loot destructor
3500 std::unique_ptr<Loot> loot(std::move(m_loot));
3501 std::unordered_map<ObjectGuid, std::unique_ptr<Loot>> personalLoot(std::move(m_personalLoot));
3502
3503 loot.reset();
3504 personalLoot.clear();
3505 m_unique_users.clear();
3506 m_usetimes = 0;
3507}
std::unordered_map< ObjectGuid, std::unique_ptr< Loot > > m_personalLoot
Definition: GameObject.h:309
std::unique_ptr< Loot > m_loot
Definition: GameObject.h:308
+ Here is the caller graph for this function:

◆ ClearSkillupList()

void GameObject::ClearSkillupList ( )
inline

Definition at line 298 of file GameObject.h.

298{ m_SkillupList.clear(); }

◆ ClearUpdateMask()

void GameObject::ClearUpdateMask ( bool  remove)
overrideprotectedvirtual

Reimplemented from Object.

Definition at line 3764 of file GameObject.cpp.

3765{
3768}
virtual void ClearUpdateMask(bool remove)
Definition: Object.cpp:782
void ClearChangesMask(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:680
+ 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 713 of file GameObject.cpp.

714{
715 ASSERT(map);
716 SetMap(map);
717
718 Relocate(pos);
720 if (!IsPositionValid())
721 {
722 TC_LOG_ERROR("misc", "Gameobject (Spawn id: {} Entry: {}) not created. Suggested coordinates isn't valid (X: {} Y: {})", GetSpawnId(), entry, pos.GetPositionX(), pos.GetPositionY());
723 return false;
724 }
725
726 // Set if this object can handle dynamic spawns
727 if (!dynamic)
729
731
733 if (m_zoneScript)
734 {
736 if (!entry)
737 return false;
738 }
739
740 GameObjectTemplate const* goInfo = sObjectMgr->GetGameObjectTemplate(entry);
741 if (!goInfo)
742 {
743 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());
744 return false;
745 }
746
748 {
749 TC_LOG_ERROR("sql.sql", "Gameobject (Spawn id: {} Entry: {}) not created: gameobject type GAMEOBJECT_TYPE_MAP_OBJ_TRANSPORT cannot be manually created.", GetSpawnId(), entry);
750 return false;
751 }
752
753 ObjectGuid guid;
754 if (goInfo->type != GAMEOBJECT_TYPE_TRANSPORT)
755 guid = ObjectGuid::Create<HighGuid::GameObject>(map->GetId(), goInfo->entry, map->GenerateLowGuid<HighGuid::GameObject>());
756 else
757 {
758 guid = ObjectGuid::Create<HighGuid::Transport>(map->GenerateLowGuid<HighGuid::Transport>());
760 }
761
762 Object::_Create(guid);
763
764 m_goInfo = goInfo;
765 m_goTemplateAddon = sObjectMgr->GetGameObjectTemplateAddon(entry);
766
767 if (goInfo->type >= MAX_GAMEOBJECT_TYPE)
768 {
769 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);
770 return false;
771 }
772
773 SetLocalRotation(rotation.x, rotation.y, rotation.z, rotation.w);
774 GameObjectAddon const* gameObjectAddon = sObjectMgr->GetGameObjectAddon(GetSpawnId());
775
776 // For most of gameobjects is (0, 0, 0, 1) quaternion, there are only some transports with not standard rotation
777 QuaternionData parentRotation;
778 if (gameObjectAddon)
779 parentRotation = gameObjectAddon->ParentRotation;
780
781 SetParentRotation(parentRotation);
782
783 SetObjectScale(goInfo->size);
784
785 if (GameObjectOverride const* goOverride = GetGameObjectOverride())
786 {
787 SetFaction(goOverride->Faction);
788 ReplaceAllFlags(GameObjectFlags(goOverride->Flags));
789 }
790
792 {
794 {
797 }
798
801 }
802
803 SetEntry(goInfo->entry);
804
805 // set name for logs usage, doesn't affect anything ingame
806 SetName(goInfo->name);
807
808 SetDisplayId(goInfo->displayId);
809
810 CreateModel();
811 // GAMEOBJECT_BYTES_1, index at 0, 1, 2 and 3
813 m_prevGoState = goState;
814 SetGoState(goState);
815 SetGoArtKit(artKit);
816
818
819 switch (goInfo->type)
820 {
822 SetGoAnimProgress(animProgress);
824 break;
826 {
827 // TODO: Get the values somehow, no longer in gameobject_template
828 m_goValue.Building.Health = 20000/*goinfo->destructibleBuilding.intactNumHits + goinfo->destructibleBuilding.damagedNumHits*/;
831 // yes, even after the updatefield rewrite this garbage hack is still in client
832 QuaternionData reinterpretId;
833 memcpy(&reinterpretId.x, &m_goInfo->destructibleBuilding.DestructibleModelRec, sizeof(float));
835 break;
836 }
838 {
839 m_goTypeImpl = std::make_unique<GameObjectType::Transport>(*this);
840 if (goInfo->transport.startOpen)
842 else
844
845 SetGoAnimProgress(animProgress);
846 setActive(true);
847 break;
848 }
850 SetLevel(0);
852 break;
854 if (GetGOInfo()->trap.stealthed)
855 {
858 }
859
860 if (GetGOInfo()->trap.stealthAffected)
861 {
864 }
865 break;
867 m_goTypeImpl = std::make_unique<GameObjectType::NewFlag>(*this);
868 if (map->Instanceable())
869 setActive(true);
870 break;
872 if (map->Instanceable())
873 setActive(true);
874 break;
878 break;
885 if (map->Instanceable())
886 setActive(true);
887 break;
888 default:
889 SetGoAnimProgress(animProgress);
890 break;
891 }
892
893 if (gameObjectAddon)
894 {
895 if (gameObjectAddon->InvisibilityValue)
896 {
897 m_invisibility.AddFlag(gameObjectAddon->invisibilityType);
898 m_invisibility.AddValue(gameObjectAddon->invisibilityType, gameObjectAddon->InvisibilityValue);
899 }
900
901 if (gameObjectAddon->WorldEffectID)
902 {
904 SetWorldEffectID(gameObjectAddon->WorldEffectID);
905 }
906
907 if (gameObjectAddon->AIAnimKitID)
908 _animKitId = gameObjectAddon->AIAnimKitID;
909 }
910
912
913 m_stringIds[0] = goInfo->StringId;
914
916
917 if (spawnid)
918 m_spawnId = spawnid;
919
920 if (uint32 linkedEntry = GetGOInfo()->GetLinkedGameObjectEntry())
921 {
922 if (GameObject* linkedGo = GameObject::CreateGameObject(linkedEntry, map, pos, rotation, 255, GO_STATE_READY))
923 {
924 SetLinkedTrap(linkedGo);
925 if (!map->AddToMap(linkedGo))
926 delete linkedGo;
927 }
928 }
929
930 // Check if GameObject is Infinite
931 if (goInfo->IsInfiniteGameObject())
932 SetVisibilityDistanceOverride(VisibilityDistanceType::Infinite);
933
934 // Check if GameObject is Gigantic
935 if (goInfo->IsGiganticGameObject())
936 SetVisibilityDistanceOverride(VisibilityDistanceType::Gigantic);
937
938 // Check if GameObject is Large
939 if (goInfo->IsLargeGameObject())
940 SetVisibilityDistanceOverride(VisibilityDistanceType::Large);
941
942 return true;
943}
#define sDB2Manager
Definition: DB2Stores.h:522
#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_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:257
void SetGoAnimProgress(uint8 animprogress)
Definition: GameObject.h:269
static GameObject * CreateGameObject(uint32 entry, Map *map, Position const &pos, QuaternionData const &rotation, uint32 animProgress, GOState goState, uint32 artKit=0)
Definition: GameObject.cpp:945
void SetWorldEffectID(uint32 worldEffectID)
Definition: GameObject.h:406
void SetRespawnCompatibilityMode(bool mode=true)
Definition: GameObject.h:354
void SetGoType(GameobjectTypes type)
Definition: GameObject.h:261
void SetLinkedTrap(GameObject *linkedTrap)
Definition: GameObject.h:318
void SetLocalRotation(float qx, float qy, float qz, float qw)
ObjectGuid::LowType GetSpawnId() const
Definition: GameObject.h:194
bool AIM_Initialize()
Definition: GameObject.cpp:617
void SetLevel(uint32 level)
Definition: GameObject.h:259
void SetDisplayId(uint32 displayid)
std::array< std::string_view, 3 > m_stringIds
Definition: GameObject.h:460
GameObjectOverride const * GetGameObjectOverride() const
void SetParentRotation(QuaternionData const &rotation)
void SetFaction(uint32 faction) override
Definition: GameObject.h:370
bool AddToMap(T *)
Definition: Map.cpp:534
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:496
bool Instanceable() const
Definition: Map.cpp:3180
uint32 GetId() const
Definition: Map.cpp:3175
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:673
uint32 LastUsedScriptID
Definition: Object.h:725
FlaggedValuesArray32< int32, uint64, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibility
Definition: Object.h:595
void SetZoneScript()
Definition: Object.cpp:1998
void setActive(bool isActiveObject)
Definition: Object.cpp:914
virtual void SetMap(Map *map)
Definition: Object.cpp:1781
void SetName(std::string newname)
Definition: Object.h:536
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealth
Definition: Object.h:592
void SetVisibilityDistanceOverride(VisibilityDistanceType type)
Definition: Object.cpp:937
virtual uint32 GetGameObjectEntry(ObjectGuid::LowType, uint32 entry)
Definition: ZoneScript.h:52
bool GameObject
Definition: Object.h:94
bool ServerTime
Definition: Object.h:89
QuaternionData ParentRotation
InvisibilityType invisibilityType
struct GameObjectTemplate::@210::@223 transport
std::string StringId
bool IsLargeGameObject() const
bool IsGiganticGameObject() const
struct GameObjectTemplate::@210::@255 phaseableMO
bool IsInfiniteGameObject() const
struct GameObjectTemplate::@210::@245 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::@208 Building
uint32 MaxHealth
Definition: GameObject.h:121
struct GameObjectValue::@206 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 945 of file GameObject.cpp.

946{
947 GameObjectTemplate const* goInfo = sObjectMgr->GetGameObjectTemplate(entry);
948 if (!goInfo)
949 return nullptr;
950
951 GameObject* go = new GameObject();
952 if (!go->Create(entry, map, pos, rotation, animProgress, goState, artKit, false, 0))
953 {
954 delete go;
955 return nullptr;
956 }
957
958 return go;
959}
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:713
+ 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 961 of file GameObject.cpp.

962{
963 GameObject* go = new GameObject();
964 if (!go->LoadFromDB(spawnId, map, addToMap))
965 {
966 delete go;
967 return nullptr;
968 }
969
970 return go;
971}
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 4172 of file GameObject.cpp.

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

◆ Delete()

void GameObject::Delete ( )

Definition at line 1498 of file GameObject.cpp.

1499{
1502
1504 {
1506 SendMessageToSet(packet.Write(), true);
1507 }
1508
1510
1513
1514 if (GameObjectOverride const* goOverride = GetGameObjectOverride())
1515 ReplaceAllFlags(GameObjectFlags(goOverride->Flags));
1516
1518 if (m_respawnCompatibilityMode && poolid)
1519 sPoolMgr->UpdatePool<GameObject>(GetMap()->GetPoolData(), poolid, GetSpawnId());
1520 else
1522}
#define sPoolMgr
Definition: PoolMgr.h:179
void SetLootState(LootState s, Unit *unit=nullptr)
void SendGameObjectDespawn()
GameObjectData const * GetGameObjectData() const
Definition: GameObject.h:187
SpawnedPoolData & GetPoolData()
Definition: Map.h:689
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition: Object.cpp:1731
void AddObjectToRemoveList()
Definition: Object.cpp:1811
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 1741 of file GameObject.cpp.

1742{
1743 GameObjectData const* data = sObjectMgr->GetGameObjectData(spawnId);
1744 if (!data)
1745 return false;
1746
1747 CharacterDatabaseTransaction charTrans = CharacterDatabase.BeginTransaction();
1748
1749 sMapMgr->DoForAllMapsWithMapId(data->mapId,
1750 [spawnId, charTrans](Map* map) -> void
1751 {
1752 // despawn all active objects, and remove their respawns
1753 std::vector<GameObject*> toUnload;
1754 for (auto const& pair : Trinity::Containers::MapEqualRange(map->GetGameObjectBySpawnIdStore(), spawnId))
1755 toUnload.push_back(pair.second);
1756 for (GameObject* obj : toUnload)
1757 map->AddObjectToRemoveList(obj);
1758 map->RemoveRespawnTime(SPAWN_TYPE_GAMEOBJECT, spawnId, charTrans);
1759 }
1760 );
1761
1762 // delete data from memory
1763 sObjectMgr->DeleteGameObjectData(spawnId);
1764
1765 CharacterDatabase.CommitTransaction(charTrans);
1766
1767 WorldDatabaseTransaction trans = WorldDatabase.BeginTransaction();
1768
1769 // ... and the database
1771 stmt->setUInt64(0, spawnId);
1772 trans->Append(stmt);
1773
1774 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_SPAWNGROUP_MEMBER);
1776 stmt->setUInt64(1, spawnId);
1777 trans->Append(stmt);
1778
1779 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_EVENT_GAMEOBJECT);
1780 stmt->setUInt64(0, spawnId);
1781 trans->Append(stmt);
1782
1783 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_LINKED_RESPAWN);
1784 stmt->setUInt64(0, spawnId);
1786 trans->Append(stmt);
1787
1788 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_LINKED_RESPAWN);
1789 stmt->setUInt64(0, spawnId);
1791 trans->Append(stmt);
1792
1793 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_LINKED_RESPAWN_MASTER);
1794 stmt->setUInt64(0, spawnId);
1796 trans->Append(stmt);
1797
1798 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_LINKED_RESPAWN_MASTER);
1799 stmt->setUInt64(0, spawnId);
1801 trans->Append(stmt);
1802
1803 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAMEOBJECT_ADDON);
1804 stmt->setUInt64(0, spawnId);
1805 trans->Append(stmt);
1806
1807 WorldDatabase.CommitTransaction(trans);
1808
1809 return true;
1810}
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:99
@ WORLD_DEL_GAMEOBJECT
Definition: WorldDatabase.h:36
@ WORLD_DEL_LINKED_RESPAWN
Definition: WorldDatabase.h:31
@ WORLD_DEL_GAMEOBJECT_ADDON
@ 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 1490 of file GameObject.cpp.

1491{
1492 PerPlayerState& perPlayerState = GetOrCreatePerPlayerStates()[seer->GetGUID()];
1493 perPlayerState.ValidUntil = GameTime::GetSystemTime() + respawnTime;
1494 perPlayerState.Despawned = true;
1495 seer->UpdateVisibilityOf(this);
1496}
std::unordered_map< ObjectGuid, PerPlayerState > & GetOrCreatePerPlayerStates()
void UpdateVisibilityOf(WorldObject *target)
Definition: Player.cpp:23575
SystemTimePoint GetSystemTime()
Current chrono system_clock time point.
Definition: GameTime.cpp:49
+ 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 1469 of file GameObject.cpp.

1470{
1471 if (delay > 0ms)
1472 {
1473 if (!m_despawnDelay || m_despawnDelay > delay.count())
1474 {
1475 m_despawnDelay = delay.count();
1476 m_despawnRespawnTime = forceRespawnTime;
1477 }
1478 }
1479 else
1480 {
1481 if (m_goData)
1482 {
1483 uint32 const respawnDelay = (forceRespawnTime > 0s) ? forceRespawnTime.count() : m_goData->spawntimesecs;
1484 SaveRespawnTime(respawnDelay);
1485 }
1486 Delete();
1487 }
1488}
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 3642 of file GameObject.cpp.

3643{
3644 if (!m_model)
3645 return;
3646
3647 /*if (enable && !GetMap()->ContainsGameObjectModel(*m_model))
3648 GetMap()->InsertGameObjectModel(*m_model);*/
3649
3650 m_model->enableCollision(enable);
3651}
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 402 of file GameObject.h.

402{ return _animKitId; }

◆ GetAIName()

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

Definition at line 630 of file GameObject.cpp.

631{
632 return sObjectMgr->GetGameObjectTemplate(GetEntry())->AIName;
633}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDebugInfo()

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

Reimplemented from Object.

Reimplemented in Transport.

Definition at line 4179 of file GameObject.cpp.

4180{
4181 std::stringstream sstr;
4182 sstr << WorldObject::GetDebugInfo() << "\n"
4183 << "SpawnId: " << GetSpawnId() << " GoState: " << std::to_string(GetGoState()) << " ScriptId: " << GetScriptId() << " AIName: " << GetAIName();
4184 return sstr.str();
4185}
uint32 GetScriptId() const
std::string const & GetAIName() const
Definition: GameObject.cpp:630
std::string GetDebugInfo() const override
Definition: Object.cpp:3751
+ 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 344 of file GameObject.h.

345 {
346 if ((*m_gameObjectData->Flags & GO_FLAG_DESTROYED))
348 if ((*m_gameObjectData->Flags & GO_FLAG_DAMAGED))
351 }
@ 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 366 of file GameObject.h.

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

◆ GetFaction()

uint32 GameObject::GetFaction ( ) const
inlineoverridevirtual

Implements WorldObject.

Definition at line 369 of file GameObject.h.

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

◆ GetFishLoot()

Loot * GameObject::GetFishLoot ( Player lootOwner)

Definition at line 1531 of file GameObject.cpp.

1532{
1533 uint32 defaultzone = 1;
1534
1535 Loot* fishLoot = new Loot(GetMap(), GetGUID(), LOOT_FISHING, nullptr);
1536
1537 uint32 areaId = GetAreaId();
1538 ItemContext itemContext = ItemBonusMgr::GetContextForPlayer(GetMap()->GetMapDifficulty(), lootOwner);
1539 while (AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaId))
1540 {
1541 fishLoot->FillLoot(areaId, LootTemplates_Fishing, lootOwner, true, true, LOOT_MODE_DEFAULT, itemContext);
1542 if (!fishLoot->isLooted())
1543 break;
1544
1545 areaId = areaEntry->ParentAreaID;
1546 }
1547
1548 if (fishLoot->isLooted())
1549 fishLoot->FillLoot(defaultzone, LootTemplates_Fishing, lootOwner, true, true, LOOT_MODE_DEFAULT, itemContext);
1550
1551 return fishLoot;
1552}
DB2Storage< AreaTableEntry > sAreaTableStore("AreaTable.db2", &AreaTableLoadInfo::Instance)
ItemContext
Definition: DBCEnums.h:1007
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:527
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 1554 of file GameObject.cpp.

1555{
1556 uint32 defaultzone = 1;
1557
1558 Loot* fishLoot = new Loot(GetMap(), GetGUID(), LOOT_FISHING_JUNK, nullptr);
1559
1560 uint32 areaId = GetAreaId();
1561 ItemContext itemContext = ItemBonusMgr::GetContextForPlayer(GetMap()->GetMapDifficulty(), lootOwner);
1562 while (AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaId))
1563 {
1564 fishLoot->FillLoot(areaId, LootTemplates_Fishing, lootOwner, true, true, LOOT_MODE_JUNK_FISH, itemContext);
1565 if (!fishLoot->isLooted())
1566 break;
1567
1568 areaId = areaEntry->ParentAreaID;
1569 }
1570
1571 if (fishLoot->isLooted())
1572 fishLoot->FillLoot(defaultzone, LootTemplates_Fishing, lootOwner, true, true, LOOT_MODE_JUNK_FISH, itemContext);
1573
1574 return fishLoot;
1575}
@ 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 4097 of file GameObject.cpp.

4098{
4100 return ObjectGuid::Empty;
4101
4102 GameObjectType::NewFlag const* newFlag = dynamic_cast<GameObjectType::NewFlag const*>(m_goTypeImpl.get());
4103 if (!newFlag)
4104 return ObjectGuid::Empty;
4105
4106 return newFlag->GetCarrierGUID();
4107}
ObjectGuid const & GetCarrierGUID() const
Definition: GameObject.cpp:553
static ObjectGuid const Empty
Definition: ObjectGuid.h:272
+ Here is the call graph for this function:

◆ GetFlagState()

FlagState GameObject::GetFlagState ( ) const

Definition at line 4085 of file GameObject.cpp.

4086{
4088 return FlagState(0);
4089
4090 GameObjectType::NewFlag const* newFlag = dynamic_cast<GameObjectType::NewFlag const*>(m_goTypeImpl.get());
4091 if (!newFlag)
4092 return FlagState(0);
4093
4094 return newFlag->GetState();
4095}
FlagState
Definition: GameObject.h:41
FlagState GetState() const
Definition: GameObject.cpp:552
+ Here is the call graph for this function:

◆ GetFlagTakenFromBaseTime()

time_t GameObject::GetFlagTakenFromBaseTime ( ) const

Definition at line 4109 of file GameObject.cpp.

4110{
4112 return time_t(0);
4113
4114 GameObjectType::NewFlag const* newFlag = dynamic_cast<GameObjectType::NewFlag const*>(m_goTypeImpl.get());
4115 if (!newFlag)
4116 return time_t(0);
4117
4118 return newFlag->GetTakenFromBaseTime();
4119}
time_t GetTakenFromBaseTime() const
Definition: GameObject.cpp:554
+ 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 187 of file GameObject.h.

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

◆ GetGameObjectOverride()

GameObjectOverride const * GameObject::GetGameObjectOverride ( ) const

Definition at line 1442 of file GameObject.cpp.

1443{
1444 if (m_spawnId)
1445 {
1446 if (GameObjectOverride const* goOverride = sObjectMgr->GetGameObjectOverride(m_spawnId))
1447 return goOverride;
1448 }
1449
1450 return m_goTemplateAddon;
1451}
+ Here is the caller graph for this function:

◆ GetGoAnimProgress()

uint8 GameObject::GetGoAnimProgress ( ) const
inline

Definition at line 268 of file GameObject.h.

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

◆ GetGoArtKit()

uint32 GameObject::GetGoArtKit ( ) const
inline

Definition at line 266 of file GameObject.h.

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

◆ GetGOInfo()

GameObjectTemplate const * GameObject::GetGOInfo ( ) const
inline

Definition at line 184 of file GameObject.h.

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

◆ GetGoState()

GOState GameObject::GetGoState ( ) const
inline

Definition at line 262 of file GameObject.h.

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

◆ GetGoStateFor()

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

Definition at line 3581 of file GameObject.cpp.

3582{
3583 if (m_perPlayerState)
3584 if (PerPlayerState const* state = Trinity::Containers::MapGetValuePtr(*m_perPlayerState, viewer))
3585 if (state->State)
3586 return *state->State;
3587
3588 return GetGoState();
3589}
std::unique_ptr< std::unordered_map< ObjectGuid, PerPlayerState > > m_perPlayerState
Definition: GameObject.h:496
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 260 of file GameObject.h.

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

◆ GetGOValue()

GameObjectValue const * GameObject::GetGOValue ( ) const
inline

Definition at line 188 of file GameObject.h.

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

◆ GetInteractionDistance()

float GameObject::GetInteractionDistance ( ) const

Definition at line 3839 of file GameObject.cpp.

3840{
3841 if (GetGOInfo()->GetInteractRadiusOverride())
3842 return float(GetGOInfo()->GetInteractRadiusOverride()) / 100.0f;
3843
3844 switch (GetGoType())
3845 {
3847 return 0.0f;
3853 return 5.5555553f;
3855 return 10.0f;
3858 return 3.0f;
3860 return 100.0f;
3862 return 20.0f + CONTACT_DISTANCE; // max spell range
3868 return 5.0f;
3869 // Following values are not blizzlike
3872 // 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.
3873 // 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.
3874 return 10.0f; // 5.0f is blizzlike
3875 default:
3876 return INTERACTION_DISTANCE;
3877 }
3878}
#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 1934 of file GameObject.cpp.

1935{
1936 if (Unit* owner = GetOwner())
1937 return owner->GetLevelForTarget(target);
1938
1940 {
1941 if (Player const* player = target->ToPlayer())
1942 if (Optional<ContentTuningLevels> userLevels = sDB2Manager.GetContentTuningData(GetGOInfo()->ContentTuningId, player->m_playerData->CtrOptions->ContentTuningConditionMask))
1943 return uint8(std::clamp<int16>(player->GetLevel(), userLevels->MinLevel, userLevels->MaxLevel));
1944
1945 if (Unit const* targetUnit = target->ToUnit())
1946 return targetUnit->GetLevel();
1947 }
1948
1949 return 1;
1950}
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:2216
+ Here is the call graph for this function:

◆ GetLinkedTrap()

GameObject * GameObject::GetLinkedTrap ( )

Definition at line 3695 of file GameObject.cpp.

3696{
3698}
ObjectGuid m_linkedTrap
Definition: GameObject.h:470
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 200 of file GameObject.h.

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

◆ GetLootForPlayer()

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

Reimplemented from Object.

Definition at line 3684 of file GameObject.cpp.

3685{
3686 if (m_personalLoot.empty())
3687 return m_loot.get();
3688
3689 if (std::unique_ptr<Loot> const* loot = Trinity::Containers::MapGetValuePtr(m_personalLoot, player->GetGUID()))
3690 return loot->get();
3691
3692 return nullptr;
3693}
+ 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 283 of file GameObject.h.

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

◆ getLootState()

LootState GameObject::getLootState ( ) const
inline

Definition at line 279 of file GameObject.h.

279{ 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 3262 of file GameObject.cpp.

3263{
3264 if (locale != DEFAULT_LOCALE)
3265 if (GameObjectLocale const* cl = sObjectMgr->GetGameObjectLocale(GetEntry()))
3266 if (cl->Name.size() > locale && !cl->Name[locale].empty())
3267 return cl->Name[locale];
3268
3269 return GetName();
3270}
#define DEFAULT_LOCALE
Definition: Common.h:66
std::string const & GetName() const
Definition: Object.h:535
+ Here is the call graph for this function:

◆ GetNameSetId()

uint8 GameObject::GetNameSetId ( ) const

Definition at line 3609 of file GameObject.cpp.

3610{
3611 switch (GetGoType())
3612 {
3615 {
3616 switch (GetDestructibleState())
3617 {
3619 return modelData->State0NameSet;
3621 return modelData->State1NameSet;
3623 return modelData->State2NameSet;
3625 return modelData->State3NameSet;
3626 default:
3627 break;
3628 }
3629 }
3630 break;
3634 return ((*m_gameObjectData->Flags) >> 8) & 0xF;
3635 default:
3636 break;
3637 }
3638
3639 return 0;
3640}
DB2Storage< DestructibleModelDataEntry > sDestructibleModelDataStore("DestructibleModelData.db2", &DestructibleModelDataLoadInfo::Instance)
@ GAMEOBJECT_TYPE_GARRISON_PLOT
@ GAMEOBJECT_TYPE_GARRISON_BUILDING
@ GO_DESTRUCTIBLE_REBUILDING
GameObjectDestructibleState GetDestructibleState() const
Definition: GameObject.h:344
+ Here is the call graph for this function:

◆ GetOrCreatePerPlayerStates()

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

Definition at line 4133 of file GameObject.cpp.

4134{
4135 if (!m_perPlayerState)
4136 m_perPlayerState = std::make_unique<std::unordered_map<ObjectGuid, PerPlayerState>>();
4137
4138 return *m_perPlayerState;
4139}
+ Here is the caller graph for this function:

◆ GetOwnerGUID()

ObjectGuid GameObject::GetOwnerGUID ( ) const
inlineoverridevirtual

Implements WorldObject.

Definition at line 223 of file GameObject.h.

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

◆ GetPackedLocalRotation()

int64 GameObject::GetPackedLocalRotation ( ) const
inline

Definition at line 201 of file GameObject.h.

201{ return m_packedRotation; }

◆ GetPauseTimes()

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

Definition at line 3770 of file GameObject.cpp.

3771{
3772 if (GameObjectType::Transport const* transport = dynamic_cast<GameObjectType::Transport const*>(m_goTypeImpl.get()))
3773 return transport->GetPauseTimes();
3774
3775 return nullptr;
3776}

◆ GetRespawnCompatibilityMode()

bool GameObject::GetRespawnCompatibilityMode ( )
inline

Definition at line 355 of file GameObject.h.

+ Here is the caller graph for this function:

◆ GetRespawnDelay()

uint32 GameObject::GetRespawnDelay ( ) const
inline

Definition at line 245 of file GameObject.h.

245{ 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 3796 of file GameObject.cpp.

3797{
3798 if (m_goData)
3799 {
3800 if (ori)
3801 m_goData->spawnPoint.GetPosition(x, y, z, *ori);
3802 else
3804 }
3805 else
3806 {
3807 if (ori)
3808 GetPosition(x, y, z, *ori);
3809 else
3810 GetPosition(x, y, z);
3811 }
3812}
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 232 of file GameObject.h.

232{ return m_respawnTime; }

◆ GetRespawnTimeEx()

time_t GameObject::GetRespawnTimeEx ( ) const

Definition at line 1952 of file GameObject.cpp.

1953{
1954 time_t now = GameTime::GetGameTime();
1955 if (m_respawnTime > now)
1956 return m_respawnTime;
1957 else
1958 return now;
1959}
time_t GetGameTime()
Definition: GameTime.cpp:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetScriptId()

uint32 GameObject::GetScriptId ( ) const

Definition at line 3233 of file GameObject.cpp.

3234{
3236 if (uint32 scriptId = gameObjectData->scriptId)
3237 return scriptId;
3238
3239 return GetGOInfo()->ScriptId;
3240}
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 194 of file GameObject.h.

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

◆ GetSpellForLock()

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

Definition at line 4232 of file GameObject.cpp.

4233{
4234 if (!player)
4235 return nullptr;
4236
4237 uint32 lockId = GetGOInfo()->GetLockId();
4238 if (!lockId)
4239 return nullptr;
4240
4241 LockEntry const* lock = sLockStore.LookupEntry(lockId);
4242 if (!lock)
4243 return nullptr;
4244
4245 for (uint8 i = 0; i < MAX_LOCK_CASE; ++i)
4246 {
4247 if (!lock->Type[i])
4248 continue;
4249
4250 if (lock->Type[i] == LOCK_KEY_SPELL)
4251 if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(lock->Index[i], GetMap()->GetDifficultyID()))
4252 return spell;
4253
4254 if (lock->Type[i] != LOCK_KEY_SKILL)
4255 break;
4256
4257 for (auto&& playerSpell : player->GetSpellMap())
4258 if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(playerSpell.first, GetMap()->GetDifficultyID()))
4259 for (auto&& effect : spell->GetEffects())
4260 if (effect.Effect == SPELL_EFFECT_OPEN_LOCK && effect.MiscValue == lock->Index[i])
4261 if (effect.CalcValue(player) >= int32(lock->Skill[i]))
4262 return spell;
4263 }
4264
4265 return nullptr;
4266}
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:825
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 230 of file GameObject.h.

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

◆ GetStationaryO()

float GameObject::GetStationaryO ( ) const
inlineoverridevirtual

Reimplemented from WorldObject.

Definition at line 384 of file GameObject.h.

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

◆ GetStationaryPosition()

Position const & GameObject::GetStationaryPosition ( ) const
inline

Definition at line 385 of file GameObject.h.

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

◆ GetStationaryX()

float GameObject::GetStationaryX ( ) const
inlineoverridevirtual

Reimplemented from WorldObject.

Definition at line 381 of file GameObject.h.

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

◆ GetStationaryY()

float GameObject::GetStationaryY ( ) const
inlineoverridevirtual

Reimplemented from WorldObject.

Definition at line 382 of file GameObject.h.

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

◆ GetStationaryZ()

float GameObject::GetStationaryZ ( ) const
inlineoverridevirtual

Reimplemented from WorldObject.

Definition at line 383 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 363 of file GameObject.h.

363{ return m_stringIds; }

◆ GetTapList()

GuidUnorderedSet const & GameObject::GetTapList ( ) const
inline

Definition at line 311 of file GameObject.h.

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

◆ GetTemplateAddon()

GameObjectTemplateAddon const * GameObject::GetTemplateAddon ( ) const
inline

Definition at line 185 of file GameObject.h.

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

◆ GetUniqueUseCount()

uint32 GameObject::GetUniqueUseCount ( ) const
inline

Definition at line 304 of file GameObject.h.

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

◆ GetUseCount()

uint32 GameObject::GetUseCount ( ) const
inline

Definition at line 303 of file GameObject.h.

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

◆ GetWorldEffectID()

uint32 GameObject::GetWorldEffectID ( ) const
inline

Definition at line 405 of file GameObject.h.

405{ return _worldEffectID; }

◆ GetWorldRotation()

QuaternionData GameObject::GetWorldRotation ( ) const

Definition at line 3309 of file GameObject.cpp.

3310{
3311 QuaternionData localRotation = GetLocalRotation();
3312 if (Transport* transport = dynamic_cast<Transport*>(GetTransport()))
3313 {
3314 QuaternionData worldRotation = transport->GetWorldRotation();
3315
3316 G3D::Quat worldRotationQuat(worldRotation.x, worldRotation.y, worldRotation.z, worldRotation.w);
3317 G3D::Quat localRotationQuat(localRotation.x, localRotation.y, localRotation.z, localRotation.w);
3318
3319 G3D::Quat resultRotation = localRotationQuat * worldRotationQuat;
3320
3321 return QuaternionData(resultRotation.x, resultRotation.y, resultRotation.z, resultRotation.w);
3322 }
3323 return localRotation;
3324}
QuaternionData const & GetLocalRotation() const
Definition: GameObject.h:200
TransportBase * GetTransport() const
Definition: Object.h:728
+ 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 4166 of file GameObject.cpp.

4167{
4168 if (m_goTypeImpl)
4169 command.Execute(*m_goTypeImpl);
4170}
+ 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 254 of file GameObject.h.

254{ 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 1820 of file GameObject.cpp.

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

◆ HasLootMode()

bool GameObject::HasLootMode ( uint16  lootMode) const
inline

Definition at line 284 of file GameObject.h.

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

◆ HasLootRecipient()

bool GameObject::HasLootRecipient ( ) const
inline

Definition at line 314 of file GameObject.h.

314{ 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 1815 of file GameObject.cpp.

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

◆ HasStringId()

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

Definition at line 3242 of file GameObject.cpp.

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

◆ IsAlwaysVisibleFor()

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

Reimplemented from WorldObject.

Definition at line 1891 of file GameObject.cpp.

1892{
1894 return true;
1895
1897 return true;
1898
1899 if (!seer)
1900 return false;
1901
1902 // Always seen by owner and friendly units
1903 if (!GetOwnerGUID().IsEmpty())
1904 {
1905 if (seer->GetGUID() == GetOwnerGUID())
1906 return true;
1907
1908 Unit* owner = GetOwner();
1909 if (Unit const* unitSeer = seer->ToUnit())
1910 if (owner && owner->IsFriendlyTo(unitSeer))
1911 return true;
1912 }
1913
1914 return false;
1915}
ObjectGuid GetOwnerGUID() const override
Definition: GameObject.h:223
bool IsDestructibleBuilding() const
virtual bool IsAlwaysVisibleFor(WorldObject const *seer) const
Definition: Object.h:799
bool IsFriendlyTo(WorldObject const *target) const
Definition: Object.cpp:2850
+ 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 4187 of file GameObject.cpp.

4188{
4189 if (spell || (spell = GetSpellForLock(player)))
4190 {
4191 float maxRange = spell->GetMaxRange(spell->IsPositive());
4192
4194 return maxRange * maxRange >= GetExactDistSq(player);
4195
4196 if (sGameObjectDisplayInfoStore.LookupEntry(GetGOInfo()->displayId))
4197 return IsAtInteractDistance(*player, maxRange);
4198 }
4199
4201}
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 4203 of file GameObject.cpp.

4204{
4205 if (GameObjectDisplayInfoEntry const* displayInfo = sGameObjectDisplayInfoStore.LookupEntry(GetGOInfo()->displayId))
4206 {
4207 float scale = GetObjectScale();
4208
4209 float minX = displayInfo->GeoBoxMin.X * scale - radius;
4210 float minY = displayInfo->GeoBoxMin.Y * scale - radius;
4211 float minZ = displayInfo->GeoBoxMin.Z * scale - radius;
4212 float maxX = displayInfo->GeoBoxMax.X * scale + radius;
4213 float maxY = displayInfo->GeoBoxMax.Y * scale + radius;
4214 float maxZ = displayInfo->GeoBoxMax.Z * scale + radius;
4215
4216 QuaternionData worldRotation = GetWorldRotation();
4217 G3D::Quat worldRotationQuat(worldRotation.x, worldRotation.y, worldRotation.z, worldRotation.w);
4218
4219 return G3D::CoordinateFrame { { worldRotationQuat }, { GetPositionX(), GetPositionY(), GetPositionZ() } }
4220 .toWorldSpace(G3D::Box { { minX, minY, minZ }, { maxX, maxY, maxZ } })
4221 .contains({ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ() });
4222 }
4223
4224 return GetExactDist(&pos) <= radius;
4225}
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 1846 of file GameObject.cpp.

1847{
1848 GameObjectTemplate const* gInfo = GetGOInfo();
1849 if (!gInfo)
1850 return false;
1851
1853}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsDynTransport()

bool GameObject::IsDynTransport ( ) const

Definition at line 1836 of file GameObject.cpp.

1837{
1838 // If something is marked as a transport, don't transmit an out of range packet for it.
1839 GameObjectTemplate const* gInfo = GetGOInfo();
1840 if (!gInfo)
1841 return false;
1842
1844}
+ Here is the call graph for this function:

◆ IsFullyLooted()

bool GameObject::IsFullyLooted ( ) const

Definition at line 3509 of file GameObject.cpp.

3510{
3511 if (m_loot && !m_loot->isLooted())
3512 return false;
3513
3514 for (auto const& [_, loot] : m_personalLoot)
3515 if (!loot->isLooted())
3516 return false;
3517
3518 return true;
3519}
+ 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 3207 of file GameObject.cpp.

3208{
3210 if (!info)
3211 return IsWithinDist3d(x, y, z, radius);
3212
3213 float sinA = std::sin(GetOrientation());
3214 float cosA = std::cos(GetOrientation());
3215 float dx = x - GetPositionX();
3216 float dy = y - GetPositionY();
3217 float dz = z - GetPositionZ();
3218 float dist = std::sqrt(dx*dx + dy*dy);
3221 if (G3D::fuzzyEq(dist, 0.0f))
3222 return true;
3223
3224 float sinB = dx / dist;
3225 float cosB = dy / dist;
3226 dx = dist * (cosA * cosB + sinA * sinB);
3227 dy = dist * (cosA * sinB - sinA * cosB);
3228 return dx < info->GeoBoxMax.X + radius && dx > info->GeoBoxMin.X - radius
3229 && dy < info->GeoBoxMax.Y + radius && dy > info->GeoBoxMin.Y - radius
3230 && dz < info->GeoBoxMax.Z + radius && dz > info->GeoBoxMin.Z - radius;
3231}
bool IsWithinDist3d(float x, float y, float z, float dist) const
Definition: Object.cpp:1113
+ 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 294 of file GameObject.h.

295 {
296 return m_SkillupList.count(playerGuid) > 0;
297 }
+ Here is the caller graph for this function:

◆ IsInvisibleDueToDespawn()

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

Reimplemented from WorldObject.

Definition at line 1917 of file GameObject.cpp.

1918{
1920 return true;
1921
1922 // Despawned
1923 if (!isSpawned())
1924 return true;
1925
1926 if (m_perPlayerState)
1927 if (PerPlayerState const* state = Trinity::Containers::MapGetValuePtr(*m_perPlayerState, seer->GetGUID()))
1928 if (state->Despawned)
1929 return true;
1930
1931 return false;
1932}
bool isSpawned() const
Definition: GameObject.h:237
virtual bool IsInvisibleDueToDespawn(WorldObject const *seer) const
Definition: Object.h:800
+ Here is the call graph for this function:

◆ IsLootAllowedFor()

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

Definition at line 3668 of file GameObject.cpp.

3669{
3670 if (Loot const* loot = GetLootForPlayer(player)) // check only if loot was already generated
3671 {
3672 if (loot->isLooted()) // nothing to loot or everything looted.
3673 return false;
3674 if (!loot->HasAllowedLooter(GetGUID()) || (!loot->hasItemForAll() && !loot->hasItemFor(player))) // no loot in chest for this player
3675 return false;
3676 }
3677
3678 if (HasLootRecipient())
3679 return m_tapList.find(player->GetGUID()) != m_tapList.end();
3680
3681 return true;
3682}
bool HasLootRecipient() const
Definition: GameObject.h:314
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 1874 of file GameObject.cpp.

1875{
1877 return true;
1878
1879 if (GetGOInfo()->GetServerOnly() && !allowServersideObjects)
1880 return true;
1881
1882 if (!GetDisplayId() && GetGOInfo()->IsDisplayMandatory())
1883 return true;
1884
1885 if (m_goTypeImpl)
1886 return m_goTypeImpl->IsNeverVisibleFor(seer, allowServersideObjects);
1887
1888 return false;
1889}
uint32 GetDisplayId() const
Definition: GameObject.h:366
virtual bool IsNeverVisibleFor(WorldObject const *seer, bool allowServersideObjects=false) const
Definition: Object.h:798
+ Here is the call graph for this function:

◆ isSpawned()

bool GameObject::isSpawned ( ) const
inline

Definition at line 237 of file GameObject.h.

238 {
239 return m_respawnDelayTime == 0 ||
242 }
+ Here is the caller graph for this function:

◆ isSpawnedByDefault()

bool GameObject::isSpawnedByDefault ( ) const
inline

Definition at line 243 of file GameObject.h.

243{ return m_spawnedByDefault; }

◆ IsTransport()

bool GameObject::IsTransport ( ) const

Definition at line 1825 of file GameObject.cpp.

1826{
1827 // If something is marked as a transport, don't transmit an out of range packet for it.
1828 GameObjectTemplate const* gInfo = GetGOInfo();
1829 if (!gInfo)
1830 return false;
1831
1833}
+ 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 4227 of file GameObject.cpp.

4228{
4229 return IsInMap(player) && InSamePhase(player) && IsAtInteractDistance(player);
4230}
bool InSamePhase(PhaseShift const &phaseShift) const
Definition: Object.h:508
bool IsInMap(WorldObject const *obj) const
Definition: Object.cpp:1106
+ 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 555 of file Object.cpp.

1139{
1140 return obj && IsInMap(obj) && InSamePhase(obj) && _IsWithinDist(obj, dist2compare, is3D, incOwnRadius, incTargetRadius);
1141}
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:478

◆ LoadFromDB()

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

Definition at line 1671 of file GameObject.cpp.

1672{
1673 GameObjectData const* data = sObjectMgr->GetGameObjectData(spawnId);
1674 if (!data)
1675 {
1676 TC_LOG_ERROR("sql.sql", "Gameobject (GUID: {}) not found in table `gameobject`, can't load. ", spawnId);
1677 return false;
1678 }
1679
1680 uint32 entry = data->id;
1681 //uint32 map_id = data->mapid; // already used before call
1682
1683 uint32 animprogress = data->animprogress;
1684 GOState go_state = data->goState;
1685 uint32 artKit = data->artKit;
1686
1687 m_spawnId = spawnId;
1689 if (!Create(entry, map, data->spawnPoint, data->rotation, animprogress, go_state, artKit, !m_respawnCompatibilityMode, spawnId))
1690 return false;
1691
1694
1695 if (data->spawntimesecs >= 0)
1696 {
1697 m_spawnedByDefault = true;
1698
1699 if (!GetGOInfo()->GetDespawnPossibility() && !GetGOInfo()->IsDespawnAtAction())
1700 {
1703 m_respawnTime = 0;
1704 }
1705 else
1706 {
1709
1710 // ready to respawn
1712 {
1713 m_respawnTime = 0;
1715 }
1716 }
1717 }
1718 else
1719 {
1721 {
1722 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);
1724 }
1725
1726 m_spawnedByDefault = false;
1728 m_respawnTime = 0;
1729 }
1730
1731 m_goData = data;
1732
1733 m_stringIds[1] = data->StringId;
1734
1735 if (addToMap && !GetMap()->AddToMap(this))
1736 return false;
1737
1738 return true;
1739}
#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:661
time_t GetGORespawnTime(ObjectGuid::LowType spawnId) const
Definition: Map.h:463
static void InitDbVisibleMapId(PhaseShift &phaseShift, int32 visibleMapId)
static void InitDbPhaseShift(PhaseShift &phaseShift, uint8 phaseUseFlags, uint16 phaseId, uint32 phaseGroupId)
PhaseShift & GetPhaseShift()
Definition: Object.h:504
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 2047 of file GameObject.cpp.

2048{
2049 GameObject* ok = nullptr;
2050 Trinity::NearestGameObjectFishingHole u_check(*this, range);
2052 Cell::VisitGridObjects(this, checker, range);
2053 return ok;
2054}
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 4121 of file GameObject.cpp.

4122{
4123 if (!m_goInfo->GetConditionID1())
4124 return true;
4125
4126 if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(m_goInfo->GetConditionID1()))
4127 if (!ConditionMgr::IsPlayerMeetingCondition(user, playerCondition))
4128 return false;
4129
4130 return true;
4131}
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 3326 of file GameObject.cpp.

3327{
3328 if (!m_goValue.Building.MaxHealth || !change)
3329 return;
3330
3331 // prevent double destructions of the same object
3332 if (change < 0 && !m_goValue.Building.Health)
3333 return;
3334
3335 if (int32(m_goValue.Building.Health) + change <= 0)
3339 else
3340 m_goValue.Building.Health += change;
3341
3342 // Set the health bar, value = 255 * healthPct;
3344
3345 // dealing damage, send packet
3346 if (Player* player = attackerOrHealer ? attackerOrHealer->GetCharmerOrOwnerPlayerOrPlayerItself() : nullptr)
3347 {
3349 packet.Caster = attackerOrHealer->GetGUID(); // todo: this can be a GameObject
3350 packet.Target = GetGUID();
3351 packet.Damage = -change;
3352 packet.Owner = player->GetGUID();
3353 packet.SpellID = spellId;
3354 player->SendDirectMessage(packet.Write());
3355 }
3356
3357 if (change < 0 && GetGOInfo()->destructibleBuilding.DamageEvent)
3358 GameEvents::Trigger(GetGOInfo()->destructibleBuilding.DamageEvent, attackerOrHealer, this);
3359
3361
3363 newState = GO_DESTRUCTIBLE_DESTROYED;
3364 else if (m_goValue.Building.Health <= 10000/*GetGOInfo()->destructibleBuilding.damagedNumHits*/)