AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
GameObject Class Reference

#include "GameObject.h"

Inheritance diagram for GameObject:
WorldObject GridObject< GameObject > MovableMapObject Object WorldLocation Position Transport MotionTransport StaticTransport

Public Member Functions

 GameObject ()
 
 ~GameObject () override
 
void BuildValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const override
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void CleanupsBeforeDelete (bool finalCleanup=true) override
 
uint32 GetDynamicFlags () const override
 
void ReplaceAllDynamicFlags (uint32 flag) override
 
virtual bool Create (ObjectGuid::LowType guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, G3D::Quat const &rotation, uint32 animprogress, GOState go_state, uint32 artKit=0)
 
void Update (uint32 p_time) override
 
GameObjectTemplate const * GetGOInfo () const
 
GameObjectTemplateAddon const * GetTemplateAddon () const
 
GameObjectData const * GetGameObjectData () const
 
GameObjectValue const * GetGOValue () const
 
bool IsTransport () const
 
bool IsDestructibleBuilding () const
 
ObjectGuid::LowType GetSpawnId () const
 
void SetLocalRotationAngles (float z_rot, float y_rot, float x_rot)
 
void SetLocalRotation (G3D::Quat const &rot)
 
void SetTransportPathRotation (float qx, float qy, float qz, float qw)
 
G3D::Quat const & GetLocalRotation () const
 
int64 GetPackedLocalRotation () const
 
G3D::Quat GetWorldRotation () const
 
std::string const & GetNameForLocaleIdx (LocaleConstant locale_idx) const override
 
void SaveToDB (bool saveAddon=false)
 
void SaveToDB (uint32 mapid, uint8 spawnMask, uint32 phaseMask, bool saveAddon=false)
 
bool LoadFromDB (ObjectGuid::LowType guid, Map *map)
 
bool LoadGameObjectFromDB (ObjectGuid::LowType guid, Map *map, bool addToMap=true)
 
void DeleteFromDB ()
 
void SetOwnerGUID (ObjectGuid owner)
 
ObjectGuid GetOwnerGUID () const
 
UnitGetOwner () const
 
void SetSpellId (uint32 id)
 
uint32 GetSpellId () const
 
time_t GetRespawnTime () const
 
time_t GetRespawnTimeEx () const
 
void SetRespawnTime (int32 respawn)
 
void SetRespawnDelay (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 forcedRespawnTime=0s)
 
void Delete ()
 
void GetFishLoot (Loot *loot, Player *loot_owner)
 
void GetFishLootJunk (Loot *loot, Player *loot_owner)
 
GameobjectTypes GetGoType () const
 
void SetGoType (GameobjectTypes type)
 
GOState GetGoState () const
 
void SetGoState (GOState state)
 
uint8 GetGoArtKit () const
 
void SetGoArtKit (uint8 artkit)
 
uint8 GetGoAnimProgress () const
 
void SetGoAnimProgress (uint8 animprogress)
 
void SetPhaseMask (uint32 newPhaseMask, bool update) override
 
void EnableCollision (bool enable)
 
GameObjectFlags GetGameObjectFlags () const
 
bool HasGameObjectFlag (GameObjectFlags flags) const
 
void SetGameObjectFlag (GameObjectFlags flags)
 
void RemoveGameObjectFlag (GameObjectFlags flags)
 
void ReplaceAllGameObjectFlags (GameObjectFlags flags)
 
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 AddToSkillupList (ObjectGuid playerGuid)
 
bool IsInSkillupList (ObjectGuid playerGuid) const
 
void AddUniqueUse (Player *player)
 
void AddUse ()
 
uint32 GetUseCount () const
 
uint32 GetUniqueUseCount () const
 
void SaveRespawnTime () override
 
void SaveRespawnTime (uint32 forceDelay)
 
PlayerGetLootRecipient () const
 
GroupGetLootRecipientGroup () const
 
void SetLootRecipient (Creature *creature)
 
void SetLootRecipient (Map *map)
 
bool IsLootAllowedFor (Player const *player) const
 
bool HasLootRecipient () const
 
void SetLootGenerationTime ()
 
uint32 GetLootGenerationTime () const
 
GameObjectGetLinkedTrap ()
 
void SetLinkedTrap (GameObject *linkedTrap)
 
bool hasQuest (uint32 quest_id) const override
 
bool hasInvolvedQuest (uint32 quest_id) const override
 
bool ActivateToQuest (Player *target) const
 
void UseDoorOrButton (uint32 time_to_restore=0, bool alternative=false, Unit *user=nullptr)
 
void ResetDoorOrButton ()
 
void TriggeringLinkedGameObject (uint32 trapEntry, Unit *target)
 
bool IsNeverVisible () const override
 
bool IsAlwaysVisibleFor (WorldObject const *seer) const override
 
bool IsInvisibleDueToDespawn () const override
 
uint8 getLevelForTarget (WorldObject const *target) const override
 
GameObjectLookupFishingHoleAround (float range)
 
void CastSpell (Unit *target, uint32 spell)
 
void SendCustomAnim (uint32 anim)
 
bool IsInRange (float x, float y, float z, float radius) const
 
void SendMessageToSetInRange (WorldPacket const *data, float dist, bool, bool includeMargin=false, Player const *skipped_rcvr=nullptr) const override
 
void ModifyHealth (int32 change, Unit *attackerOrHealer=nullptr, uint32 spellId=0)
 
void SetDestructibleBuildingModifyState (bool allow)
 
void SetDestructibleState (GameObjectDestructibleState state, Player *eventInvoker=nullptr, bool setHealth=false)
 
GameObjectDestructibleState GetDestructibleState () const
 
void EventInform (uint32 eventId)
 
virtual uint32 GetScriptId () const
 
GameObjectAIAI () const
 
std::string const & GetAIName () const
 
void SetDisplayId (uint32 displayid)
 
uint32 GetDisplayId () const
 
void GetRespawnPosition (float &x, float &y, float &z, float *ori=nullptr) const
 
void SetPosition (float x, float y, float z, float o)
 
void SetPosition (const Position &pos)
 
bool IsStaticTransport () const
 
bool IsMotionTransport () const
 
TransportToTransport ()
 
Transport const * ToTransport () const
 
StaticTransportToStaticTransport ()
 
StaticTransport const * ToStaticTransport () const
 
MotionTransportToMotionTransport ()
 
MotionTransport const * ToMotionTransport () const
 
float GetStationaryX () const override
 
float GetStationaryY () const override
 
float GetStationaryZ () const override
 
float GetStationaryO () const override
 
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
 
void SaveInstanceData (uint8 state)
 
void UpdateInstanceData (uint8 state)
 
bool FindStateSavedOnInstance ()
 
bool ValidateGameobjectType ()
 
uint8 GetStateSavedOnInstance ()
 
bool IsInstanceGameobject ()
 
uint8 GameobjectStateToInt (GOState *state)
 
bool IsAbleToSaveOnDb ()
 
void UpdateSaveToDb (bool enable)
 
void SavingStateOnDB ()
 
std::string GetDebugInfo () const override
 
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
 
- Public Member Functions inherited from WorldObject
 ~WorldObject () override
 
virtual void Update (uint32)
 
void _Create (ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void GetNearPoint2D (WorldObject const *searcher, float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
 
void GetNearPoint2D (float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
 
void GetNearPoint (WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle, float controlZ=0, Position const *startPos=nullptr) const
 
void GetVoidClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0, float controlZ=0) const
 
bool GetClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float angle=0, WorldObject const *forWho=nullptr, bool force=false) 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 startX, float startY, float startZ, float destX, float destY)
 
Position GetFirstCollisionPosition (float destX, float destY, float destZ)
 
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
 
void GetChargeContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
float GetObjectSize () 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 (const Position &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
 
Position GetRandomPoint (const Position &srcPos, float distance) const
 
uint32 GetInstanceId () const
 
virtual void SetPhaseMask (uint32 newPhaseMask, bool update)
 
uint32 GetPhaseMask () const
 
bool InSamePhase (WorldObject const *obj) const
 
bool InSamePhase (uint32 phasemask) const
 
uint32 GetZoneId () const
 
uint32 GetAreaId () const
 
void GetZoneAndAreaId (uint32 &zoneid, uint32 &areaid) const
 
bool IsOutdoors () const
 
LiquidData const & GetLiquidData () const
 
InstanceScriptGetInstanceScript () const
 
std::string const & GetName () const
 
void SetName (std::string const &newname)
 
virtual std::string const & GetNameForLocaleIdx (LocaleConstant) const
 
float GetDistance (WorldObject const *obj) const
 
float GetDistance (const Position &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 (const Position *pos, float dist) const
 
bool IsWithinDist2d (float x, float y, float dist) const
 
bool IsWithinDist2d (const Position *pos, float dist) const
 
bool IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
 
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
 
bool IsWithinLOS (float x, float y, float z, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS) const
 
bool IsWithinLOSInMap (WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
Position GetHitSpherePointFor (Position const &dest, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
void GetHitSpherePointFor (Position const &dest, float &x, float &y, float &z, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) 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=M_PI) const
 
bool isInBack (WorldObject const *target, float arc=M_PI) 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, bool includeMargin=false, Player const *skipped_rcvr=nullptr) const
 
virtual void SendMessageToSet (WorldPacket const *data, Player const *skipped_rcvr) const
 
virtual uint8 getLevelForTarget (WorldObject const *) const
 
void PlayDistanceSound (uint32 sound_id, Player *target=nullptr)
 
void PlayDirectSound (uint32 sound_id, Player *target=nullptr)
 
void PlayDirectMusic (uint32 music_id, Player *target=nullptr)
 
void SendObjectDeSpawnAnim (ObjectGuid guid)
 
virtual void SaveRespawnTime ()
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
virtual float GetSightRange (WorldObject const *target=nullptr) const
 
bool CanSeeOrDetect (WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
 
void SendPlayMusic (uint32 Music, bool OnlySelf)
 
virtual void SetMap (Map *map)
 
virtual void ResetMap ()
 
MapGetMap () const
 
MapFindMap () const
 
void SetZoneScript ()
 
void ClearZoneScript ()
 
ZoneScriptGetZoneScript () const
 
TempSummonSummonCreature (uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
 
TempSummonSummonCreature (uint32 id, float x, float y, float z, float ang=0, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false)
 
GameObjectSummonGameObject (uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport=true, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
 
CreatureSummonTrigger (float x, float y, float z, float ang, uint32 dur, bool setLevel=false, CreatureAI *(*GetAI)(Creature *)=nullptr)
 
void SummonCreatureGroup (uint8 group, std::list< TempSummon * > *list=nullptr)
 
CreatureFindNearestCreature (uint32 entry, float range, bool alive=true) const
 
GameObjectFindNearestGameObject (uint32 entry, float range, bool onlySpawned=false) const
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
PlayerSelectNearestPlayer (float distance=0) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetDeadCreatureListInGrid (std::list< Creature * > &lList, float maxSearchRange, bool alive=false) const
 
void DestroyForNearbyPlayers ()
 
virtual void UpdateObjectVisibility (bool forced=true, bool fromUpdate=false)
 
void BuildUpdate (UpdateDataMapType &data_map, UpdatePlayerSet &player_set) override
 
void GetCreaturesWithEntryInRange (std::list< Creature * > &creatureList, float radius, uint32 entry)
 
void SetPositionDataUpdate ()
 
void UpdatePositionData ()
 
void AddToObjectUpdate () override
 
void RemoveFromObjectUpdate () override
 
void AddToNotify (uint16 f)
 
void RemoveFromNotify (uint16 f)
 
bool isNeedNotify (uint16 f) const
 
uint16 GetNotifyFlags () const
 
bool NotifyExecuted (uint16 f) const
 
void SetNotified (uint16 f)
 
void ResetAllNotifies ()
 
bool isActiveObject () const
 
void setActive (bool isActiveObject)
 
bool IsFarVisible () const
 
bool IsVisibilityOverridden () const
 
void SetVisibilityDistanceOverride (VisibilityDistanceType type)
 
void SetWorldObject (bool apply)
 
bool IsPermanentWorldObject () const
 
bool IsWorldObject () const
 
bool IsInWintergrasp () const
 
TransportGetTransport () const
 
float GetTransOffsetX () const
 
float GetTransOffsetY () const
 
float GetTransOffsetZ () const
 
float GetTransOffsetO () const
 
uint32 GetTransTime () const
 
int8 GetTransSeat () const
 
virtual ObjectGuid GetTransGUID () const
 
void SetTransport (Transport *t)
 
virtual float GetStationaryX () const
 
virtual float GetStationaryY () const
 
virtual float GetStationaryZ () const
 
virtual float GetStationaryO () 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
 
float GetFloorZ () const
 
float GetMinHeightInWater () const
 Get the minimum height of a object that should be in water to start floating/swim.
 
virtual float GetCollisionHeight () const
 
virtual float GetCollisionWidth () const
 
virtual float GetCollisionRadius () const
 
void AddAllowedLooter (ObjectGuid guid)
 
void ResetAllowedLooters ()
 
void SetAllowedLooters (GuidUnorderedSet const looters)
 
bool HasAllowedLooter (ObjectGuid guid) const
 
GuidUnorderedSet const & GetAllowedLooters () const
 
std::string GetDebugInfo () const override
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
virtual void AddToWorld ()
 
virtual void RemoveFromWorld ()
 
ObjectGuid GetGUID () const
 
PackedGuid const & GetPackGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
virtual void SetObjectScale (float scale)
 
virtual uint32 GetDynamicFlags () const
 
bool HasDynamicFlag (uint32 flag) const
 
virtual void SetDynamicFlag (uint32 flag)
 
virtual void RemoveDynamicFlag (uint32 flag)
 
virtual 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 *target) const
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
void BuildMovementUpdateBlock (UpdateData *data, uint32 flags=0) const
 
virtual void DestroyForPlayer (Player *target, bool onDeath=false) const
 
int32 GetInt32Value (uint16 index) const
 
uint32 GetUInt32Value (uint16 index) const
 
uint64 GetUInt64Value (uint16 index) const
 
float GetFloatValue (uint16 index) const
 
uint8 GetByteValue (uint16 index, uint8 offset) const
 
uint16 GetUInt16Value (uint16 index, uint8 offset) const
 
ObjectGuid GetGuidValue (uint16 index) const
 
void SetInt32Value (uint16 index, int32 value)
 
void SetUInt32Value (uint16 index, uint32 value)
 
void UpdateUInt32Value (uint16 index, uint32 value)
 
void SetUInt64Value (uint16 index, uint64 value)
 
void SetFloatValue (uint16 index, float value)
 
void SetByteValue (uint16 index, uint8 offset, uint8 value)
 
void SetUInt16Value (uint16 index, uint8 offset, uint16 value)
 
void SetInt16Value (uint16 index, uint8 offset, int16 value)
 
void SetGuidValue (uint16 index, ObjectGuid value)
 
void SetStatFloatValue (uint16 index, float value)
 
void SetStatInt32Value (uint16 index, int32 value)
 
bool AddGuidValue (uint16 index, ObjectGuid value)
 
bool RemoveGuidValue (uint16 index, ObjectGuid value)
 
void ApplyModUInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModUInt64Value (uint16 index, int32 val, bool apply)
 
void ApplyModPositiveFloatValue (uint16 index, float val, bool apply)
 
void ApplyModSignedFloatValue (uint16 index, float val, bool apply)
 
void ApplyPercentModFloatValue (uint16 index, float val, bool apply)
 
void SetFlag (uint16 index, uint32 newFlag)
 
void RemoveFlag (uint16 index, uint32 oldFlag)
 
void ToggleFlag (uint16 index, uint32 flag)
 
bool HasFlag (uint16 index, uint32 flag) const
 
void ApplyModFlag (uint16 index, uint32 flag, bool apply)
 
void SetByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void RemoveByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
bool HasByteFlag (uint16 index, uint8 offset, uint8 flag) const
 
void SetFlag64 (uint16 index, uint64 newFlag)
 
void RemoveFlag64 (uint16 index, uint64 oldFlag)
 
void ToggleFlag64 (uint16 index, uint64 flag)
 
bool HasFlag64 (uint16 index, uint64 flag) const
 
void ApplyModFlag64 (uint16 index, uint64 flag, bool apply)
 
void ClearUpdateMask (bool remove)
 
uint16 GetValuesCount () const
 
virtual bool hasQuest (uint32) const
 
virtual bool hasInvolvedQuest (uint32) const
 
virtual void BuildUpdate (UpdateDataMapType &, UpdatePlayerSet &)
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &) const
 
void SetFieldNotifyFlag (uint16 flag)
 
void RemoveFieldNotifyFlag (uint16 flag)
 
void ForceValuesUpdateAtIndex (uint32)
 
bool IsPlayer () const
 
PlayerToPlayer ()
 
Player const * ToPlayer () const
 
CreatureToCreature ()
 
Creature const * ToCreature () const
 
UnitToUnit ()
 
Unit const * ToUnit () const
 
GameObjectToGameObject ()
 
GameObject const * ToGameObject () const
 
CorpseToCorpse ()
 
Corpse const * ToCorpse () const
 
DynamicObjectToDynObject ()
 
DynamicObject const * ToDynObject () const
 
virtual std::string GetDebugInfo () 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 (const WorldLocation &loc)
 
void WorldRelocate (uint32 mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
void SetMapId (uint32 mapId)
 
uint32 GetMapId () const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y) const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z) const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z, float &o) const
 
void GetWorldLocation (WorldLocation *location) const
 
WorldLocation GetWorldLocation () const
 
std::string GetDebugInfo () const
 
- Public Member Functions inherited from Position
 Position (float x=0, float y=0, float z=0, float o=0)
 
 Position (Position const &loc)
 
 Position (Position &&)=default
 
Positionoperator= (const Position &)=default
 
Positionoperator= (Position &&)=default
 
bool operator== (Position const &a) const
 
bool operator!= (Position const &a)
 
 operator G3D::Vector3 () const
 
void Relocate (float x, float y)
 
void Relocate (float x, float y, float z)
 
void Relocate (float x, float y, float z, float orientation)
 
void Relocate (const Position &pos)
 
void Relocate (const Position *pos)
 
void RelocatePolarOffset (float angle, float dist, float z=0.0f)
 
void RelocateOffset (const Position &offset)
 
void SetOrientation (float orientation)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
float GetOrientation () const
 
void GetPosition (float &x, float &y) const
 
void GetPosition (float &x, float &y, float &z) const
 
void GetPosition (float &x, float &y, float &z, float &o) const
 
Position GetPosition () const
 
Position::PositionXYZStreamer PositionXYZStream ()
 
Position::PositionXYZOStreamer PositionXYZOStream ()
 
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 (const Position &endPos, Position &retOffset) const
 
Position GetPositionWithOffset (Position const &offset) const
 
float GetAngle (const Position *pos) const
 
float GetAngle (float x, float y) const
 
float GetAbsoluteAngle (float x, float y) const
 
float GetAbsoluteAngle (Position const &pos) const
 
float GetAbsoluteAngle (Position const *pos) const
 
float GetRelativeAngle (const Position *pos) const
 
float GetRelativeAngle (float x, float y) const
 
float ToAbsoluteAngle (float relAngle) const
 
void GetSinCos (float x, float y, float &vsin, float &vcos) const
 
bool IsInDist2d (float x, float y, float dist) const
 
bool IsInDist2d (const Position *pos, float dist) const
 
bool IsInDist (float x, float y, float z, float dist) const
 
bool IsInDist (const Position *pos, float dist) const
 
bool IsWithinBox (const Position &center, float xradius, float yradius, float zradius) const
 
bool HasInArc (float arcangle, const Position *pos, float targetRadius=0.0f) const
 
bool HasInLine (Position const *pos, float width) const
 
std::string ToString () const
 
- Public Member Functions inherited from GridObject< GameObject >
bool IsInGrid () const
 
void AddToGrid (GridRefMgr< GameObject > &m)
 
void RemoveFromGrid ()
 

Static Public Member Functions

static void SetGoArtKit (uint8 artkit, GameObject *go, ObjectGuid::LowType lowguid=0)
 
- Static Public Member Functions inherited from Object
static ObjectGuid GetGUID (Object const *o)
 
- Static Public Member Functions inherited from Position
static float NormalizeOrientation (float o)
 

Public Attributes

Loot loot
 
uint32 m_groupLootTimer
 
uint32 lootingGroupLowGUID
 
GameObjectModelm_model
 
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealth
 
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealthDetect
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibility
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibilityDetect
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibility
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibilityDetect
 
uint32 LastUsedScriptID
 
MovementInfo m_movementInfo
 
ElunaEventProcessor * elunaEvents
 
- Public Attributes inherited from Object
DataMap CustomData
 
- Public Attributes inherited from WorldLocation
uint32 m_mapId
 
- Public Attributes inherited from Position
float m_positionX = 0
 
float m_positionY = 0
 
float m_positionZ = 0
 
float m_orientation = 0
 

Static Public Attributes

static std::unordered_map< int, goEventFlaggameObjectToEventFlag = { }
 

Protected Types

typedef std::map< uint32, ObjectGuidChairSlotAndUser
 

Protected Member Functions

bool AIM_Initialize ()
 
GameObjectModelCreateModel ()
 
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 IsNeverVisible () const
 
virtual bool IsAlwaysVisibleFor (WorldObject const *) const
 
virtual bool IsInvisibleDueToDespawn () const
 
virtual bool IsAlwaysDetectableFor (WorldObject const *) const
 
- Protected Member Functions inherited from Object
 Object ()
 
void _InitValues ()
 
void _Create (ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
 
std::string _ConcatFields (uint16 startIndex, uint16 size) const
 
bool _LoadIntoDataField (std::string const &data, uint32 startOffset, uint32 count)
 
uint32 GetUpdateFieldData (Player const *target, uint32 *&flags) const
 
void BuildMovementUpdate (ByteBuffer *data, uint16 flags) const
 
virtual void BuildValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const
 
virtual void AddToObjectUpdate ()=0
 
virtual void RemoveFromObjectUpdate ()=0
 
void AddToObjectUpdateIfNeeded ()
 
- Protected Member Functions inherited from MovableMapObject
 MovableMapObject ()=default
 

Protected Attributes

uint32 m_spellId
 
time_t m_respawnTime
 
uint32 m_respawnDelayTime
 
uint32 m_despawnDelay
 
Seconds m_despawnRespawnTime
 
Seconds m_restockTime
 
LootState m_lootState
 
bool m_spawnedByDefault
 
uint32 m_cooldownTime
 
std::unordered_map< ObjectGuid, int32m_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
 
GameObjectData const * m_goData
 
GameObjectValue m_goValue
 
bool m_allowModifyDestructibleBuilding
 
int64 m_packedRotation
 
G3D::Quat m_localRotation
 
Position m_stationaryPosition
 
ObjectGuid m_lootRecipient
 
ObjectGuid::LowType m_lootRecipientGroup
 
uint16 m_LootMode
 
uint32 m_lootGenerationTime
 
ObjectGuid m_linkedTrap
 
ObjectGuid _lootStateUnitGUID
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
bool m_isFarVisible
 
Optional< float > m_visibilityDistanceOverride
 
const bool m_isWorldObject
 
ZoneScriptm_zoneScript
 
uint32 _zoneId
 
uint32 _areaId
 
float _floorZ
 
bool _outdoors
 
LiquidData _liquidData
 
bool _updatePositionData
 
Transportm_transport
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
TypeID m_objectTypeId
 
uint16 m_updateFlag
 
union {
   int32 *   m_int32Values
 
   uint32 *   m_uint32Values
 
   float *   m_floatValues
 
}; 
 
UpdateMask _changesMask
 
uint16 m_valuesCount
 
uint16 _fieldNotifyFlags
 
bool m_objectUpdated
 

Private Member Functions

void CheckRitualList ()
 
void ClearRitualList ()
 
void RemoveFromOwner ()
 
void SwitchDoorOrButton (bool activate, bool alternative=false)
 
void UpdatePackedRotation ()
 
bool _IsWithinDist (WorldObject const *obj, float dist2compare, bool, bool) const override
 Object distance/size - overridden from Object::_IsWithinDist. Needs to take in account proper GO size.
 

Private Attributes

GameObjectAIm_AI
 
bool m_saveStateOnDb = false
 

Detailed Description

Member Typedef Documentation

◆ ChairSlotAndUser

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

Constructor & Destructor Documentation

◆ GameObject()

GameObject::GameObject ( )
explicit
42 : WorldObject(false), MovableMapObject(),
43 m_model(nullptr), m_goValue(), m_AI(nullptr)
44{
47
49
51 m_respawnTime = 0;
55 m_restockTime = 0s;
57 m_spawnedByDefault = true;
59 m_usetimes = 0;
60 m_spellId = 0;
62 m_goInfo = nullptr;
63 m_goData = nullptr;
65
66 m_spawnId = 0;
67
72
73 ResetLootMode(); // restore default loot mode
75 m_stationaryPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
76}
@ GO_NOT_READY
Definition: GameObject.h:112
@ TYPEID_GAMEOBJECT
Definition: ObjectGuid.h:39
@ TYPEMASK_GAMEOBJECT
Definition: ObjectGuid.h:53
@ UPDATEFLAG_ROTATION
Definition: UpdateData.h:48
@ UPDATEFLAG_POSITION
Definition: UpdateData.h:47
@ UPDATEFLAG_LOWGUID
Definition: UpdateData.h:43
@ UPDATEFLAG_STATIONARY_POSITION
Definition: UpdateData.h:45
@ GAMEOBJECT_END
Definition: UpdateFields.h:405
Loot loot
Definition: GameObject.h:249
GameObjectValue m_goValue
Definition: GameObject.h:400
time_t m_respawnTime
Definition: GameObject.h:379
GameObjectData const * m_goData
Definition: GameObject.h:399
int64 m_packedRotation
Definition: GameObject.h:403
Position m_stationaryPosition
Definition: GameObject.h:405
bool m_allowModifyDestructibleBuilding
Definition: GameObject.h:401
uint32 m_cooldownTime
Definition: GameObject.h:386
uint32 m_spellId
Definition: GameObject.h:378
uint32 m_respawnDelayTime
Definition: GameObject.h:380
void ResetLootMode()
Definition: GameObject.h:235
uint32 m_despawnDelay
Definition: GameObject.h:381
Seconds m_despawnRespawnTime
Definition: GameObject.h:382
ObjectGuid::LowType m_lootRecipientGroup
Definition: GameObject.h:408
GameObjectAI * m_AI
Definition: GameObject.h:430
GameObjectModel * m_model
Definition: GameObject.h:316
GameObjectTemplate const * m_goInfo
Definition: GameObject.h:398
ObjectGuid::LowType m_spawnId
For new or temporary gameobjects is 0 for saved it is lowguid.
Definition: GameObject.h:397
uint32 m_groupLootTimer
Definition: GameObject.h:257
uint32 lootingGroupLowGUID
Definition: GameObject.h:258
bool m_spawnedByDefault
Definition: GameObject.h:385
LootState m_lootState
Definition: GameObject.h:384
Seconds m_restockTime
Definition: GameObject.h:383
uint32 m_usetimes
Definition: GameObject.h:392
uint32 m_lootGenerationTime
Definition: GameObject.h:410
uint16 m_objectType
Definition: Object.h:228
uint16 m_valuesCount
Definition: Object.h:242
uint16 m_updateFlag
Definition: Object.h:231
TypeID m_objectTypeId
Definition: Object.h:230
MovableMapObject()=default
Definition: Object.h:393
void Relocate(float x, float y)
Definition: Position.h:73
GameObject * sourceGameObject
Definition: LootMgr.h:331

References GAMEOBJECT_END, GO_NOT_READY, loot, lootingGroupLowGUID, m_allowModifyDestructibleBuilding, m_cooldownTime, m_despawnDelay, m_despawnRespawnTime, m_goData, m_goInfo, m_groupLootTimer, m_lootGenerationTime, m_lootRecipientGroup, m_lootState, Object::m_objectType, Object::m_objectTypeId, m_packedRotation, m_respawnDelayTime, m_respawnTime, m_restockTime, m_spawnedByDefault, m_spawnId, m_spellId, m_stationaryPosition, Object::m_updateFlag, m_usetimes, Object::m_valuesCount, Position::Relocate(), ResetLootMode(), Loot::sourceGameObject, TYPEID_GAMEOBJECT, TYPEMASK_GAMEOBJECT, UPDATEFLAG_LOWGUID, UPDATEFLAG_POSITION, UPDATEFLAG_ROTATION, and UPDATEFLAG_STATIONARY_POSITION.

Referenced by Create(), and MotionTransport::CreateGOPassenger().

◆ ~GameObject()

GameObject::~GameObject ( )
override
79{
80 delete m_AI;
81 delete m_model;
82 //if (m_uint32Values) // field array can be not exist if GameOBject not loaded
83 // CleanupsBeforeDelete();
84}

References m_AI, and m_model.

Member Function Documentation

◆ _IsWithinDist()

bool GameObject::_IsWithinDist ( WorldObject const *  obj,
float  dist2compare,
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.

425 {
427 dist2compare += obj->GetObjectSize();
428 return IsInRange(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), dist2compare);
429 }
bool IsInRange(float x, float y, float z, float radius) const
Definition: GameObject.cpp:2146

References WorldObject::GetObjectSize(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), and IsInRange().

◆ ActivateToQuest()

bool GameObject::ActivateToQuest ( Player target) const
1326{
1327 if (target->HasQuestForGO(GetEntry()))
1328 return true;
1329
1330 if (!GetGOInfo()->IsGameObjectForQuests())
1331 return false;
1332
1333 switch (GetGoType())
1334 {
1336 {
1337 GameObject* go = const_cast<GameObject*>(this);
1338 QuestGiverStatus questStatus = target->GetQuestDialogStatus(go);
1339 if (questStatus > DIALOG_STATUS_UNAVAILABLE)
1340 return true;
1341 break;
1342 }
1344 {
1345 // scan GO chest with loot including quest items
1347 {
1348 //TODO: fix this hack
1349 //look for battlegroundAV for some objects which are only activated after mine gots captured by own team
1351 if (Battleground* bg = target->GetBattleground())
1352 if (bg->GetBgTypeID(true) == BATTLEGROUND_AV && !bg->ToBattlegroundAV()->PlayerCanDoMineQuest(GetEntry(), target->GetTeamId()))
1353 return false;
1354 return true;
1355 }
1356 break;
1357 }
1359 {
1360 if (GetGOInfo()->_generic.questID == -1 || target->GetQuestStatus(GetGOInfo()->_generic.questID) == QUEST_STATUS_INCOMPLETE)
1361 return true;
1362 break;
1363 }
1365 {
1366 if (GetGOInfo()->spellFocus.questID > 0 && target->GetQuestStatus(GetGOInfo()->spellFocus.questID) == QUEST_STATUS_INCOMPLETE)
1367 return true;
1368 break;
1369 }
1371 {
1372 if (GetGOInfo()->goober.questId == -1 || target->GetQuestStatus(GetGOInfo()->goober.questId) == QUEST_STATUS_INCOMPLETE)
1373 return true;
1374 break;
1375 }
1376 default:
1377 break;
1378 }
1379
1380 return false;
1381}
@ BG_AV_OBJECTID_MINE_N
Definition: BattlegroundAV.h:160
@ BG_AV_OBJECTID_MINE_S
Definition: BattlegroundAV.h:161
LootStore LootTemplates_Gameobject("gameobject_loot_template", "gameobject entry", true)
QuestGiverStatus
Definition: QuestDef.h:111
@ DIALOG_STATUS_UNAVAILABLE
Definition: QuestDef.h:113
@ QUEST_STATUS_INCOMPLETE
Definition: QuestDef.h:103
@ GAMEOBJECT_TYPE_SPELL_FOCUS
Definition: SharedDefines.h:1540
@ GAMEOBJECT_TYPE_GENERIC
Definition: SharedDefines.h:1537
@ GAMEOBJECT_TYPE_CHEST
Definition: SharedDefines.h:1535
@ GAMEOBJECT_TYPE_QUESTGIVER
Definition: SharedDefines.h:1534
@ GAMEOBJECT_TYPE_GOOBER
Definition: SharedDefines.h:1542
@ BATTLEGROUND_AV
Definition: SharedDefines.h:3453
Definition: Battleground.h:293
Definition: GameObject.h:122
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:138
GameobjectTypes GetGoType() const
Definition: GameObject.h:205
struct GameObjectTemplate::@215::@226 goober
int32 questID
Definition: GameObjectData.h:111
struct GameObjectTemplate::@215::@221 _generic
uint32 questId
Definition: GameObjectData.h:92
struct GameObjectTemplate::@215::@224 spellFocus
uint32 GetEntry() const
Definition: Object.h:109
bool HasQuestForGO(int32 GOId) const
Definition: Player.cpp:12283
TeamId GetTeamId(bool original=false) const
Definition: Player.h:2059
QuestGiverStatus GetQuestDialogStatus(Object *questGiver)
Definition: PlayerQuest.cpp:1579
Battleground * GetBattleground(bool create=false) const
Definition: Player.cpp:12097
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition: PlayerQuest.cpp:1414
bool HaveQuestLootForPlayer(uint32 loot_id, Player const *player) const
Definition: LootMgr.cpp:227

References GameObjectTemplate::_generic, BATTLEGROUND_AV, BG_AV_OBJECTID_MINE_N, BG_AV_OBJECTID_MINE_S, DIALOG_STATUS_UNAVAILABLE, GAMEOBJECT_TYPE_CHEST, GAMEOBJECT_TYPE_GENERIC, GAMEOBJECT_TYPE_GOOBER, GAMEOBJECT_TYPE_QUESTGIVER, GAMEOBJECT_TYPE_SPELL_FOCUS, Player::GetBattleground(), Object::GetEntry(), GetGOInfo(), GetGoType(), Player::GetQuestDialogStatus(), Player::GetQuestStatus(), Player::GetTeamId(), GameObjectTemplate::goober, Player::HasQuestForGO(), LootStore::HaveQuestLootForPlayer(), LootTemplates_Gameobject, QUEST_STATUS_INCOMPLETE, GameObjectTemplate::questId, GameObjectTemplate::questID, and GameObjectTemplate::spellFocus.

Referenced by BuildValuesUpdate().

◆ AddLootMode()

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

References m_LootMode.

◆ AddToSkillupList()

void GameObject::AddToSkillupList ( ObjectGuid  playerGuid)
3114{
3115 int32 timer = GetMap()->IsDungeon() ? -1 : 10 * MINUTE * IN_MILLISECONDS;
3116 m_SkillupList[playerGuid] = timer;
3117}
constexpr auto IN_MILLISECONDS
Definition: Common.h:62
constexpr auto MINUTE
Definition: Common.h:56
std::int32_t int32
Definition: Define.h:104
std::unordered_map< ObjectGuid, int32 > m_SkillupList
Definition: GameObject.h:388
Map * GetMap() const
Definition: Object.h:517
bool IsDungeon() const
Definition: Map.h:447

References WorldObject::GetMap(), IN_MILLISECONDS, Map::IsDungeon(), m_SkillupList, and MINUTE.

Referenced by Spell::EffectOpenLock().

◆ AddToWorld()

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

Reimplemented from Object.

142{
144 if (!IsInWorld())
145 {
146 if (m_zoneScript)
148
150 if (m_spawnId)
151 GetMap()->GetGameObjectBySpawnIdStore().insert(std::make_pair(m_spawnId, this));
152
153 if (m_model)
154 {
157 }
158
159 EnableCollision(GetGoState() == GO_STATE_READY || IsTransport()); // pussywizard: this startOpen is unneeded here, collision depends entirely on GOState
160
162
164
165 sScriptMgr->OnGameObjectAddWorld(this);
166 }
167}
@ GO_STATE_READY
Definition: GameObjectData.h:691
#define sScriptMgr
Definition: ScriptMgr.h:2702
bool UpdatePosition()
Definition: GameObjectModel.cpp:269
bool Insert(KEY_TYPE const &handle, SPECIFIC_TYPE *obj)
Definition: TypeContainer.h:135
GOState GetGoState() const
Definition: GameObject.h:207
void EnableCollision(bool enable)
Definition: GameObject.cpp:2649
bool IsTransport() const
Definition: GameObject.cpp:1224
bool IsInWorld() const
Definition: Object.h:101
ObjectGuid GetGUID() const
Definition: Object.h:107
void AddToWorld() override
Definition: Object.cpp:1176
ZoneScript * m_zoneScript
Definition: Object.h:628
ObjectGuid sourceWorldObjectGUID
Definition: LootMgr.h:330
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:515
GameObjectBySpawnIdContainer & GetGameObjectBySpawnIdStore()
Definition: Map.h:521
void InsertGameObjectModel(const GameObjectModel &model)
Definition: Map.h:559
virtual void OnGameObjectCreate(GameObject *)
Definition: ZoneScript.h:38

References WorldObject::AddToWorld(), EnableCollision(), Map::GetGameObjectBySpawnIdStore(), GetGoState(), Object::GetGUID(), WorldObject::GetMap(), Map::GetObjectsStore(), GO_STATE_READY, TypeUnorderedMapContainer< OBJECT_TYPES, KEY_TYPE >::Insert(), Map::InsertGameObjectModel(), Object::IsInWorld(), IsTransport(), loot, m_model, m_spawnId, WorldObject::m_zoneScript, ZoneScript::OnGameObjectCreate(), Loot::sourceWorldObjectGUID, sScriptMgr, and GameObjectModel::UpdatePosition().

Referenced by AddObjectHelper(), and Map::AddToMap().

◆ AddUniqueUse()

void GameObject::AddUniqueUse ( Player player)
925{
926 AddUse();
927 m_unique_users.insert(player->GetGUID());
928}
void AddUse()
Definition: GameObject.h:241
GuidSet m_unique_users
Definition: GameObject.h:391
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106

References AddUse(), Object::GetGUID(), and m_unique_users.

Referenced by Spell::EffectTransmitted(), and Use().

◆ AddUse()

◆ AI()

◆ AIM_Initialize()

bool GameObject::AIM_Initialize ( )
protected
87{
88 if (m_AI)
89 delete m_AI;
90
92
93 if (!m_AI)
94 return false;
95
97 return true;
98}
GameObjectAI * SelectGameObjectAI(GameObject *go)
Definition: CreatureAISelector.cpp:103
virtual void InitializeAI()
Definition: GameObjectAI.h:44

References GameObjectAI::InitializeAI(), m_AI, and FactorySelector::SelectGameObjectAI().

Referenced by Create(), StaticTransport::Create(), MotionTransport::Update(), and Update().

◆ BuildValuesUpdate()

void GameObject::BuildValuesUpdate ( uint8  updatetype,
ByteBuffer data,
Player target 
) const
overridevirtual

Reimplemented from Object.

2786{
2787 if (!target)
2788 return;
2789
2791 bool targetIsGM = target->IsGameMaster() && AccountMgr::IsGMAccount(target->GetSession()->GetSecurity());
2792
2793 ByteBuffer fieldBuffer;
2794
2795 UpdateMask updateMask;
2796 updateMask.SetCount(m_valuesCount);
2797
2799 uint32 visibleFlag = UF_FLAG_PUBLIC;
2800 if (GetOwnerGUID() == target->GetGUID())
2801 visibleFlag |= UF_FLAG_OWNER;
2802
2803 for (uint16 index = 0; index < m_valuesCount; ++index)
2804 {
2805 if (_fieldNotifyFlags & flags[index] ||
2806 ((updateType == UPDATETYPE_VALUES ? _changesMask.GetBit(index) : m_uint32Values[index]) && (flags[index] & visibleFlag)) ||
2807 (index == GAMEOBJECT_FLAGS && forcedFlags))
2808 {
2809 updateMask.SetBit(index);
2810
2811 if (index == GAMEOBJECT_DYNAMIC)
2812 {
2813 uint16 dynFlags = 0;
2814 int16 pathProgress = -1;
2815 switch (GetGoType())
2816 {
2818 if (ActivateToQuest(target))
2819 dynFlags |= GO_DYNFLAG_LO_ACTIVATE;
2820 break;
2823 if (ActivateToQuest(target))
2824 {
2825 dynFlags |= GO_DYNFLAG_LO_ACTIVATE;
2826 if (sWorld->getBoolConfig(CONFIG_OBJECT_SPARKLES))
2827 dynFlags |= GO_DYNFLAG_LO_SPARKLE;
2828 }
2829 else if (targetIsGM)
2830 dynFlags |= GO_DYNFLAG_LO_ACTIVATE;
2831 break;
2834 if (ActivateToQuest(target) && sWorld->getBoolConfig(CONFIG_OBJECT_SPARKLES))
2835 dynFlags |= GO_DYNFLAG_LO_SPARKLE;
2836 break;
2838 if (const StaticTransport* t = ToStaticTransport())
2839 if (t->GetPauseTime())
2840 {
2841 if (GetGoState() == GO_STATE_READY)
2842 {
2843 if (t->GetPathProgress() >= t->GetPauseTime()) // if not, send 100% progress
2844 pathProgress = int16(float(t->GetPathProgress() - t->GetPauseTime()) / float(t->GetPeriod() - t->GetPauseTime()) * 65535.0f);
2845 }
2846 else
2847 {
2848 if (t->GetPathProgress() <= t->GetPauseTime()) // if not, send 100% progress
2849 pathProgress = int16(float(t->GetPathProgress()) / float(t->GetPauseTime()) * 65535.0f);
2850 }
2851 }
2852 // else it's ignored
2853 break;
2855 if (const MotionTransport* t = ToMotionTransport())
2856 pathProgress = int16(float(t->GetPathProgress()) / float(t->GetPeriod()) * 65535.0f);
2857 break;
2858 default:
2859 break;
2860 }
2861
2862 fieldBuffer << uint16(dynFlags);
2863 fieldBuffer << int16(pathProgress);
2864 }
2865 else if (index == GAMEOBJECT_FLAGS)
2866 {
2869 {
2871 }
2872
2873 fieldBuffer << goFlags;
2874 }
2875 else
2876 fieldBuffer << m_uint32Values[index]; // other cases
2877 }
2878 }
2879
2880 *data << uint8(updateMask.GetBlockCount());
2881 updateMask.AppendToPacket(data);
2882 data->append(fieldBuffer);
2883}
std::uint8_t uint8
Definition: Define.h:110
std::uint32_t uint32
Definition: Define.h:108
std::uint16_t uint16
Definition: Define.h:109
std::int16_t int16
Definition: Define.h:105
@ UPDATETYPE_VALUES
Definition: UpdateData.h:28
uint32 GameObjectUpdateFieldFlags[GAMEOBJECT_END]
Definition: UpdateFieldFlags.cpp:1492
@ UF_FLAG_PUBLIC
Definition: UpdateFieldFlags.h:27
@ UF_FLAG_OWNER
Definition: UpdateFieldFlags.h:29
@ GAMEOBJECT_DYNAMIC
Definition: UpdateFields.h:401
@ GAMEOBJECT_FLAGS
Definition: UpdateFields.h:399
@ CONFIG_OBJECT_SPARKLES
Definition: IWorld.h:179
@ GAMEOBJECT_TYPE_MO_TRANSPORT
Definition: SharedDefines.h:1547
@ GAMEOBJECT_TYPE_TRANSPORT
Definition: SharedDefines.h:1543
@ GO_DYNFLAG_LO_ACTIVATE
Definition: SharedDefines.h:1590
@ GO_DYNFLAG_LO_SPARKLE
Definition: SharedDefines.h:1593
@ GO_FLAG_NOT_SELECTABLE
Definition: SharedDefines.h:1579
@ GO_FLAG_LOCKED
Definition: SharedDefines.h:1576
#define sWorld
Definition: World.h:451
bool IsGMAccount(uint32 gmlevel)
Definition: AccountMgr.cpp:281
MotionTransport * ToMotionTransport()
Definition: GameObject.h:331
bool HasLootRecipient() const
Definition: GameObject.h:256
ObjectGuid GetOwnerGUID() const
Definition: GameObject.h:175
bool ActivateToQuest(Player *target) const
Definition: GameObject.cpp:1325
bool IsLootAllowedFor(Player const *player) const
Definition: GameObject.cpp:2747
StaticTransport * ToStaticTransport()
Definition: GameObject.h:328
struct GameObjectTemplate::@215::@220 chest
uint32 groupLootRules
Definition: GameObjectData.h:99
uint16 _fieldNotifyFlags
Definition: Object.h:244
UpdateMask _changesMask
Definition: Object.h:240
uint32 * m_uint32Values
Definition: Object.h:236
Definition: UpdateMask.h:26
uint32 GetBlockCount() const
Definition: UpdateMask.h:63
bool GetBit(uint32 index) const
Definition: UpdateMask.h:48
void SetCount(uint32 valuesCount)
Definition: UpdateMask.h:66
void SetBit(uint32 index)
Definition: UpdateMask.h:46
void AppendToPacket(ByteBuffer *data)
Definition: UpdateMask.h:50
WorldSession * GetSession() const
Definition: Player.h:1948
bool IsGameMaster() const
Definition: Player.h:1136
Definition: Transport.h:48
Definition: Transport.h:112
AccountTypes GetSecurity() const
Definition: WorldSession.h:358
Definition: ByteBuffer.h:70
void append(T value)
Definition: ByteBuffer.h:129

References Object::_changesMask, Object::_fieldNotifyFlags, ActivateToQuest(), ByteBuffer::append(), UpdateMask::AppendToPacket(), GameObjectTemplate::chest, CONFIG_OBJECT_SPARKLES, GAMEOBJECT_DYNAMIC, GAMEOBJECT_FLAGS, GAMEOBJECT_TYPE_CHEST, GAMEOBJECT_TYPE_GENERIC, GAMEOBJECT_TYPE_GOOBER, GAMEOBJECT_TYPE_MO_TRANSPORT, GAMEOBJECT_TYPE_QUESTGIVER, GAMEOBJECT_TYPE_SPELL_FOCUS, GAMEOBJECT_TYPE_TRANSPORT, GameObjectUpdateFieldFlags, UpdateMask::GetBit(), UpdateMask::GetBlockCount(), GetGOInfo(), GetGoState(), GetGoType(), Object::GetGUID(), GetOwnerGUID(), WorldSession::GetSecurity(), Player::GetSession(), GO_DYNFLAG_LO_ACTIVATE, GO_DYNFLAG_LO_SPARKLE, GO_FLAG_LOCKED, GO_FLAG_NOT_SELECTABLE, GO_STATE_READY, GameObjectTemplate::groupLootRules, HasLootRecipient(), Player::IsGameMaster(), AccountMgr::IsGMAccount(), IsLootAllowedFor(), Object::m_uint32Values, Object::m_valuesCount, UpdateMask::SetBit(), UpdateMask::SetCount(), sWorld, ToMotionTransport(), ToStaticTransport(), UF_FLAG_OWNER, UF_FLAG_PUBLIC, and UPDATETYPE_VALUES.

◆ CastSpell()

void GameObject::CastSpell ( Unit target,
uint32  spell 
)
2074{
2075 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
2076 if (!spellInfo)
2077 return;
2078
2079 bool self = true;
2080 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
2081 {
2082 if (spellInfo->Effects[i].TargetA.GetReferenceType() != TARGET_REFERENCE_TYPE_CASTER || spellInfo->Effects[i].TargetB.GetTarget())
2083 {
2084 self = false;
2085 break;
2086 }
2087 }
2088
2089 if (self && target && target->GetGUID() != GetGUID())
2090 {
2091 target->CastSpell(target, spellInfo, true);
2092 return;
2093 }
2094
2095 //summon world trigger
2096 Creature* trigger = SummonTrigger(GetPositionX(), GetPositionY(), GetPositionZ(), 0, spellInfo->CalcCastTime() + 2000, true);
2097 if (!trigger)
2098 return;
2099
2100 if (Unit* owner = GetOwner())
2101 {
2102 trigger->SetLevel(owner->GetLevel(), false);
2103 trigger->SetFaction(owner->GetFaction());
2104 // needed for GO casts for proper target validation checks
2105 trigger->SetOwnerGUID(owner->GetGUID());
2106 // xinef: fixes some duel bugs with traps]
2107 if (owner->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
2109 if (owner->IsFFAPvP())
2110 {
2112 {
2113 sScriptMgr->OnFfaPvpStateUpdate(trigger, true);
2115 }
2116
2117 }
2118 // xinef: Remove Immunity flags
2119 trigger->SetImmuneToNPC(false);
2120 // xinef: set proper orientation, fixes cast against stealthed targets
2121 if (target)
2122 trigger->SetInFront(target);
2123 trigger->CastSpell(target ? target : trigger, spellInfo, true, 0, 0, owner->GetGUID());
2124 }
2125 else
2126 {
2127 // xinef: set faction of gameobject, if no faction - assume hostile
2128 trigger->SetFaction(GetTemplateAddon() && GetTemplateAddon()->faction ? GetTemplateAddon()->faction : 14);
2129 // Set owner guid for target if no owner availble - needed by trigger auras
2130 // - trigger gets despawned and there's no caster avalible (see AuraEffect::TriggerSpell())
2131 // xinef: set proper orientation, fixes cast against stealthed targets
2132 if (target)
2133 trigger->SetInFront(target);
2134 trigger->CastSpell(target ? target : trigger, spellInfo, true, 0, 0, target ? target->GetGUID() : ObjectGuid::Empty);
2135 }
2136}
@ UNIT_FIELD_BYTES_2
Definition: UpdateFields.h:161
@ UNIT_BYTE2_FLAG_FFA_PVP
Definition: Unit.h:138
@ UNIT_FLAG_PLAYER_CONTROLLED
Definition: Unit.h:451
@ TARGET_REFERENCE_TYPE_CASTER
Definition: SpellInfo.h:89
#define sSpellMgr
Definition: SpellMgr.h:818
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1610
Definition: Creature.h:46
Unit * GetOwner() const
Definition: GameObject.cpp:1236
GameObjectTemplateAddon const * GetTemplateAddon() const
Definition: GameObject.cpp:909
bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const
Definition: Object.cpp:949
void SetByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition: Object.cpp:911
Creature * SummonTrigger(float x, float y, float z, float ang, uint32 dur, bool setLevel=false, CreatureAI *(*GetAI)(Creature *)=nullptr)
Definition: Object.cpp:2367
static ObjectGuid const Empty
Definition: ObjectGuid.h:122
float GetPositionZ() const
Definition: Position.h:119
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118
Definition: Unit.h:1290
void SetFaction(uint32 faction)
Definition: Unit.cpp:10029
void SetImmuneToNPC(bool apply, bool keepCombat=false)
Definition: Unit.cpp:13527
void SetLevel(uint8 lvl, bool showLevelChange=true)
Definition: Unit.cpp:15352
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1169
void SetOwnerGUID(ObjectGuid owner)
Definition: Unit.cpp:10533
void SetUnitFlag(UnitFlags flags)
Definition: Unit.h:1481
void SetInFront(WorldObject const *target)
Definition: Unit.cpp:20776
Definition: SpellInfo.h:314
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition: SpellInfo.h:391
uint32 CalcCastTime(Unit *caster=nullptr, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:2335

References SpellInfo::CalcCastTime(), Unit::CastSpell(), SpellInfo::Effects, ObjectGuid::Empty, Object::GetGUID(), GetOwner(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetTemplateAddon(), Object::HasByteFlag(), MAX_SPELL_EFFECTS, Object::SetByteFlag(), Unit::SetFaction(), Unit::SetImmuneToNPC(), Unit::SetInFront(), Unit::SetLevel(), Unit::SetOwnerGUID(), Unit::SetUnitFlag(), sScriptMgr, sSpellMgr, WorldObject::SummonTrigger(), TARGET_REFERENCE_TYPE_CASTER, UNIT_BYTE2_FLAG_FFA_PVP, UNIT_FIELD_BYTES_2, and UNIT_FLAG_PLAYER_CONTROLLED.

Referenced by instance_onyxias_lair::instance_onyxias_lair_InstanceMapScript::OnGameObjectCreate(), go_harpoon_canon::OnGossipHello(), go_amberpine_outhouse::OnGossipSelect(), SmartScript::ProcessAction(), go_direbrew_mole_machine::go_direbrew_mole_machineAI::Reset(), npc_deaths_door_fell_cannon_target_bunny::npc_deaths_door_fell_cannon_target_bunnyAI::SpellHit(), Update(), go_suppression_device::go_suppression_deviceAI::UpdateAI(), go_witherbark_totem_bundle::go_witherbark_totem_bundleAI::UpdateAI(), and Use().

◆ CheckRitualList()

void GameObject::CheckRitualList ( )
private
203{
204 if (m_unique_users.empty())
205 return;
206
207 for (GuidSet::iterator itr = m_unique_users.begin(); itr != m_unique_users.end();)
208 {
209 if (*itr == GetOwnerGUID())
210 {
211 ++itr;
212 continue;
213 }
214
215 bool erase = true;
216 if (Player* channeler = ObjectAccessor::GetPlayer(*this, *itr))
217 if (Spell* spell = channeler->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
218 if (spell->m_spellInfo->Id == GetGOInfo()->summoningRitual.animSpell)
219 erase = false;
220
221 if (erase)
222 m_unique_users.erase(itr++);
223 else
224 ++itr;
225 }
226}
@ CURRENT_CHANNELED_SPELL
Definition: Unit.h:980
Player * GetPlayer(Map const *, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:225
uint32 animSpell
Definition: GameObjectData.h:234
Definition: Player.h:1046
Definition: Spell.h:284

References GameObjectTemplate::animSpell, CURRENT_CHANNELED_SPELL, GetGOInfo(), GetOwnerGUID(), ObjectAccessor::GetPlayer(), and m_unique_users.

Referenced by Update(), and Use().

◆ CleanupsBeforeDelete()

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

Reimplemented from WorldObject.

Reimplemented in MotionTransport, and StaticTransport.

106{
107 if (GetTransport() && !ToTransport())
108 {
110 SetTransport(nullptr);
113 }
114
115 if (IsInWorld())
117
118 if (m_uint32Values) // field array can be not exist if GameOBject not loaded
120}
@ MOVEMENTFLAG_ONTRANSPORT
Definition: Unit.h:561
void RemoveFromWorld() override
Definition: GameObject.cpp:169
void RemoveFromOwner()
Definition: GameObject.cpp:122
Transport * ToTransport()
Definition: GameObject.h:325
void RemoveMovementFlag(uint32 flag)
Definition: Object.h:321
struct MovementInfo::TransportInfo transport
void Reset()
Definition: Object.h:275
void SetTransport(Transport *t)
Definition: Object.h:593
Transport * GetTransport() const
Definition: Object.h:585
MovementInfo m_movementInfo
Definition: Object.h:595
virtual void RemovePassenger(WorldObject *passenger, bool withAll=false)=0

References WorldObject::GetTransport(), Object::IsInWorld(), WorldObject::m_movementInfo, Object::m_uint32Values, MOVEMENTFLAG_ONTRANSPORT, RemoveFromOwner(), RemoveFromWorld(), MovementInfo::RemoveMovementFlag(), Transport::RemovePassenger(), MovementInfo::TransportInfo::Reset(), WorldObject::SetTransport(), ToTransport(), and MovementInfo::transport.

Referenced by MotionTransport::CleanupsBeforeDelete(), and StaticTransport::CleanupsBeforeDelete().

◆ ClearRitualList()

void GameObject::ClearRitualList ( )
private
229{
231 if (!animSpell || m_unique_users.empty())
232 return;
233
234 for (ObjectGuid const& guid : m_unique_users)
235 {
236 if (Player* channeler = ObjectAccessor::GetPlayer(*this, guid))
237 if (Spell* spell = channeler->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
238 if (spell->m_spellInfo->Id == animSpell)
239 {
240 spell->SendChannelUpdate(0);
241 spell->finish();
242 }
243 }
244
245 m_unique_users.clear();
246}
struct GameObjectTemplate::@215::@231 summoningRitual
Definition: ObjectGuid.h:120

References GameObjectTemplate::animSpell, CURRENT_CHANNELED_SPELL, GetGOInfo(), ObjectAccessor::GetPlayer(), m_unique_users, and GameObjectTemplate::summoningRitual.

Referenced by Delete(), and Update().

◆ Create()

bool GameObject::Create ( ObjectGuid::LowType  guidlow,
uint32  name_id,
Map map,
uint32  phaseMask,
float  x,
float  y,
float  z,
float  ang,
G3D::Quat const &  rotation,
uint32  animprogress,
GOState  go_state,
uint32  artKit = 0 
)
virtual

Reimplemented in StaticTransport.

249{
250 ASSERT(map);
251 SetMap(map);
252
253 Relocate(x, y, z, ang);
254 m_stationaryPosition.Relocate(x, y, z, ang);
255 if (!IsPositionValid())
256 {
257 LOG_ERROR("entities.gameobject", "Gameobject (GUID: {} Entry: {}) not created. Suggested coordinates isn't valid (X: {} Y: {})", guidlow, name_id, x, y);
258 return false;
259 }
260
261 SetPhaseMask(phaseMask, false);
262
264
266 if (m_zoneScript)
267 {
268 name_id = m_zoneScript->GetGameObjectEntry(guidlow, name_id);
269 if (!name_id)
270 return false;
271 }
272
273 GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(name_id);
274 if (!goinfo)
275 {
276 LOG_ERROR("sql.sql", "Gameobject (GUID: {} Entry: {}) not created: non-existing entry in `gameobject_template`. Map: {} (X: {} Y: {} Z: {})", guidlow, name_id, map->GetId(), x, y, z);
277 return false;
278 }
279
280 Object::_Create(guidlow, goinfo->entry, HighGuid::GameObject);
281
282 m_goInfo = goinfo;
283
284 if (goinfo->type >= MAX_GAMEOBJECT_TYPE)
285 {
286 LOG_ERROR("sql.sql", "Gameobject (GUID: {} Entry: {}) not created: non-existing GO type '{}' in `gameobject_template`. It will crash client if created.", guidlow, name_id, goinfo->type);
287 return false;
288 }
289
290 GameObjectAddon const* addon = sObjectMgr->GetGameObjectAddon(GetSpawnId());
291
292 // hackfix for the hackfix down below
293 switch (goinfo->entry)
294 {
295 // excluded ids from the hackfix below
296 // used switch since there should be more
297 case 181233: // maexxna portal effect
298 case 181575: // maexxna portal
299 case 20992: // theramore black shield
300 case 21042: // theramore guard badge
301 SetLocalRotation(rotation);
302 break;
303 default:
304 // xinef: hackfix - but make it possible to use original WorldRotation (using special gameobject addon data)
305 // pussywizard: temporarily calculate WorldRotation from orientation, do so until values in db are correct
306 if (addon && addon->invisibilityType == INVISIBILITY_GENERAL && addon->InvisibilityValue == 0)
307 {
308 SetLocalRotation(rotation);
309 }
310 else
311 {
313 }
314 break;
315 }
316
317 // pussywizard: no PathRotation for normal gameobjects
318 SetTransportPathRotation(0.0f, 0.0f, 0.0f, 1.0f);
319
320 SetObjectScale(goinfo->size);
321
322 if (GameObjectTemplateAddon const* templateAddon = GetTemplateAddon())
323 {
324 SetUInt32Value(GAMEOBJECT_FACTION, templateAddon->faction);
325 ReplaceAllGameObjectFlags((GameObjectFlags)templateAddon->flags);
326 }
327
328 SetEntry(goinfo->entry);
329
330 // set name for logs usage, doesn't affect anything ingame
331 SetName(goinfo->name);
332
333 // GAMEOBJECT_BYTES_1, index at 0, 1, 2 and 3
335
337 {
338 switch (GetStateSavedOnInstance())
339 {
340 case 0:
342 SwitchDoorOrButton(true);
343 break;
344 case 1:
346 break;
347 case 2:
349 break;
350 default:
351 SetGoState(go_state);
352 break;
353 }
354 }
355 else
356 {
357 SetGoState(go_state);
358 }
359
360 SetGoArtKit(artKit);
361
362 SetDisplayId(goinfo->displayId);
363
364 if (!m_model)
366
367 switch (goinfo->type)
368 {
370 SetGoAnimProgress(animprogress);
372 break;
377 break;
380 break;
382 if (GetGOInfo()->trap.stealthed)
383 {
386 }
387
388 if (GetGOInfo()->trap.invisible)
389 {
392 }
393 break;
394 default:
395 SetGoAnimProgress(animprogress);
396 break;
397 }
398
399 if (addon)
400 {
401 if (addon->InvisibilityValue)
402 {
405 }
406 }
407
410
411 if (uint32 linkedEntry = GetGOInfo()->GetLinkedGameObjectEntry())
412 {
413 GameObject* linkedGO = new GameObject();
414 if (linkedGO->Create(map->GenerateLowGuid<HighGuid::GameObject>(), linkedEntry, map, phaseMask, x, y, z, ang, rotation, 255, GO_STATE_READY))
415 {
416 SetLinkedTrap(linkedGO);
417 map->AddToMap(linkedGO);
418 }
419 else
420 {
421 delete linkedGO;
422 }
423 }
424
425 // Check if GameObject is Large
426 if (goinfo->IsLargeGameObject())
427 {
428 SetVisibilityDistanceOverride(VisibilityDistanceType::Large);
429 }
430
431 // Check if GameObject is Infinite
432 if (goinfo->IsInfiniteGameObject())
433 {
434 SetVisibilityDistanceOverride(VisibilityDistanceType::Infinite);
435 }
436
437 return true;
438}
#define ASSERT
Definition: Errors.h:68
#define LOG_ERROR(filterType__,...)
Definition: Log.h:159
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
@ GO_STATE_ACTIVE_ALTERNATIVE
Definition: GameObjectData.h:692
@ GAMEOBJECT_FACTION
Definition: UpdateFields.h:402
#define sObjectMgr
Definition: ObjectMgr.h:1640
GameobjectTypes
Definition: SharedDefines.h:1531
@ GAMEOBJECT_TYPE_TRAP
Definition: SharedDefines.h:1538
@ GAMEOBJECT_TYPE_FISHINGHOLE
Definition: SharedDefines.h:1557
@ GAMEOBJECT_TYPE_FISHINGNODE
Definition: SharedDefines.h:1549
@ GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING
Definition: SharedDefines.h:1565
@ STEALTH_TRAP
Definition: SharedDefines.h:1220
@ INVISIBILITY_GENERAL
Definition: SharedDefines.h:1227
@ INVISIBILITY_TRAP
Definition: SharedDefines.h:1230
#define MAX_GAMEOBJECT_TYPE
Definition: SharedDefines.h:1570
GameObjectFlags
Definition: SharedDefines.h:1574
uint32 MaxOpens
Definition: GameObject.h:62
struct GameObjectValue::@212 FishingHole
uint32 MaxHealth
Definition: GameObject.h:73
struct GameObjectValue::@214 Building
uint32 Health
Definition: GameObject.h:72
void SetLocalRotationAngles(float z_rot, float y_rot, float x_rot)
Definition: GameObject.cpp:2252
GameObject()
Definition: GameObject.cpp:42
void SetGoState(GOState state)
Definition: GameObject.cpp:2467
void SetTransportPathRotation(float qx, float qy, float qz, float qw)
Definition: GameObject.cpp:2244
void SetGoArtKit(uint8 artkit)
Definition: GameObject.cpp:1441
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition: GameObject.cpp:2641
void SetLocalRotation(G3D::Quat const &rot)
Definition: GameObject.cpp:2230
void SetGoAnimProgress(uint8 animprogress)
Definition: GameObject.h:212
virtual bool Create(ObjectGuid::LowType guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, G3D::Quat const &rotation, uint32 animprogress, GOState go_state, uint32 artKit=0)
Definition: GameObject.cpp:248
GameObjectModel * CreateModel()
Definition: GameObject.cpp:3001
bool IsInstanceGameobject()
Definition: GameObject.cpp:2511
void SetGoType(GameobjectTypes type)
Definition: GameObject.h:206
void SetLinkedTrap(GameObject *linkedTrap)
Definition: GameObject.h:263
ObjectGuid::LowType GetSpawnId() const
Definition: GameObject.h:146
bool AIM_Initialize()
Definition: GameObject.cpp:86
void SetDisplayId(uint32 displayid)
Definition: GameObject.cpp:2635
void ReplaceAllGameObjectFlags(GameObjectFlags flags)
Definition: GameObject.h:222
void SwitchDoorOrButton(bool activate, bool alternative=false)
Definition: GameObject.cpp:1464
uint8 GetStateSavedOnInstance()
Definition: GameObject.cpp:2625
Definition: GameObjectData.h:32
uint32 intactNumHits
Definition: GameObjectData.h:352
uint32 ScriptId
Definition: GameObjectData.h:394
uint32 stealthed
Definition: GameObjectData.h:125
uint32 type
Definition: GameObjectData.h:34
uint32 entry
Definition: GameObjectData.h:33
bool IsLargeGameObject() const
Definition: GameObjectData.h:594
bool IsInfiniteGameObject() const
Definition: GameObjectData.h:619
uint32 minSuccessOpens
Definition: GameObjectData.h:88
uint32 invisible
Definition: GameObjectData.h:127
uint32 damagedNumHits
Definition: GameObjectData.h:357
std::string name
Definition: GameObjectData.h:36
uint32 maxSuccessOpens
Definition: GameObjectData.h:89
struct GameObjectTemplate::@215::@243 building
float size
Definition: GameObjectData.h:40
uint32 displayId
Definition: GameObjectData.h:35
Definition: GameObjectData.h:665
Definition: GameObjectData.h:682
uint32 InvisibilityValue
Definition: GameObjectData.h:684
InvisibilityType invisibilityType
Definition: GameObjectData.h:683
void _Create(ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
Definition: Object.cpp:134
void SetEntry(uint32 entry)
Definition: Object.h:110
virtual void SetObjectScale(float scale)
Definition: Object.h:113
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:650
void AddFlag(FLAG_TYPE flag)
Definition: Object.h:356
void AddValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:361
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibility
Definition: Object.h:506
uint32 LastUsedScriptID
Definition: Object.h:582
void SetName(std::string const &newname)
Definition: Object.h:447
void SetZoneScript()
Definition: Object.cpp:2296
virtual void SetMap(Map *map)
Definition: Object.cpp:2071
void UpdatePositionData()
Definition: Object.cpp:1154
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealth
Definition: Object.h:503
void SetVisibilityDistanceOverride(VisibilityDistanceType type)
Definition: Object.cpp:1122
static float NormalizeOrientation(float o)
Definition: Position.h:233
float GetOrientation() const
Definition: Position.h:120
bool IsPositionValid() const
Definition: Position.cpp:175
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:632
uint32 GetId() const
Definition: Map.h:378
bool AddToMap(T *, bool checkTransport=false)
Definition: Map.cpp:557
virtual uint32 GetGameObjectEntry(ObjectGuid::LowType, uint32 entry)
Definition: ZoneScript.h:33

References Object::_Create(), FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::AddFlag(), Map::AddToMap(), FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::AddValue(), AIM_Initialize(), ASSERT, GameObjectValue::Building, GameObjectTemplate::building, Create(), CreateModel(), GameObjectTemplate::damagedNumHits, GameObjectTemplate::displayId, GameObjectTemplate::entry, GameObjectValue::FishingHole, GameObject(), GAMEOBJECT_FACTION, GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING, GAMEOBJECT_TYPE_FISHINGHOLE, GAMEOBJECT_TYPE_FISHINGNODE, GAMEOBJECT_TYPE_TRAP, Map::GenerateLowGuid(), ZoneScript::GetGameObjectEntry(), GetGOInfo(), Map::GetId(), Position::GetOrientation(), GetSpawnId(), GetStateSavedOnInstance(), GetTemplateAddon(), GO_STATE_ACTIVE_ALTERNATIVE, GO_STATE_READY, GameObjectValue::Health, GameObjectTemplate::intactNumHits, INVISIBILITY_GENERAL, INVISIBILITY_TRAP, GameObjectAddon::invisibilityType, GameObjectAddon::InvisibilityValue, GameObjectTemplate::invisible, GameObjectTemplate::IsInfiniteGameObject(), IsInstanceGameobject(), GameObjectTemplate::IsLargeGameObject(), Position::IsPositionValid(), WorldObject::LastUsedScriptID, LOG_ERROR, m_goInfo, m_goValue, WorldObject::m_invisibility, m_model, m_stationaryPosition, WorldObject::m_stealth, WorldObject::m_zoneScript, MAX_GAMEOBJECT_TYPE, GameObjectValue::MaxHealth, GameObjectValue::MaxOpens, GameObjectTemplate::maxSuccessOpens, GameObjectTemplate::minSuccessOpens, GameObjectTemplate::name, Position::NormalizeOrientation(), Position::Relocate(), ReplaceAllGameObjectFlags(), GameObjectTemplate::ScriptId, SetDisplayId(), Object::SetEntry(), SetGoAnimProgress(), SetGoArtKit(), SetGoState(), SetGoType(), SetLinkedTrap(), SetLocalRotation(), SetLocalRotationAngles(), WorldObject::SetMap(), WorldObject::SetName(), Object::SetObjectScale(), SetPhaseMask(), SetTransportPathRotation(), Object::SetUInt32Value(), WorldObject::SetVisibilityDistanceOverride(), WorldObject::SetZoneScript(), GameObjectTemplate::size, sObjectMgr, STEALTH_TRAP, GameObjectTemplate::stealthed, SwitchDoorOrButton(), GameObjectTemplate::type, WorldObject::UpdatePositionData(), and urand().

Referenced by Battleground::AddObject(), Create(), Spell::EffectDuel(), Spell::EffectSummonObject(), Spell::EffectSummonObjectWild(), Spell::EffectTransmitted(), OutdoorPvPSI::HandleDropFlag(), gobject_commandscript::HandleGameObjectAddCommand(), LoadGameObjectFromDB(), Battlefield::SpawnGameObject(), Map::SummonGameObject(), and WorldObject::SummonGameObject().

◆ CreateModel()

GameObjectModel * GameObject::CreateModel ( )
protected
3002{
3003 return GameObjectModel::Create(std::make_unique<GameObjectModelOwnerImpl>(this), sWorld->GetDataPath());
3004}
static GameObjectModel * Create(std::unique_ptr< GameObjectModelOwnerBase > modelOwner, std::string const &dataPath)
Definition: GameObjectModel.cpp:168

References GameObjectModel::Create(), and sWorld.

Referenced by Create(), StaticTransport::Create(), MotionTransport::CreateMoTrans(), and UpdateModel().

◆ Delete()

void GameObject::Delete ( )
977{
980
982
984
985 if (GameObjectTemplateAddon const* addon = GetTemplateAddon())
987
988 // Xinef: if ritual gameobject is removed, clear anim spells
991
992 uint32 poolid = m_spawnId ? sPoolMgr->IsPartOfAPool<GameObject>(m_spawnId) : 0;
993 if (poolid)
994 sPoolMgr->UpdatePool<GameObject>(poolid, m_spawnId);
995 else
997}
#define sPoolMgr
Definition: PoolMgr.h:163
@ GAMEOBJECT_TYPE_SUMMONING_RITUAL
Definition: SharedDefines.h:1550
void SetLootState(LootState s, Unit *unit=nullptr)
Definition: GameObject.cpp:2432
void ClearRitualList()
Definition: GameObject.cpp:228
void AddObjectToRemoveList()
Definition: Object.cpp:2115
void SendObjectDeSpawnAnim(ObjectGuid guid)
Definition: Object.cpp:2064

References WorldObject::AddObjectToRemoveList(), ClearRitualList(), GAMEOBJECT_TYPE_SUMMONING_RITUAL, GetGOInfo(), Object::GetGUID(), GetTemplateAddon(), GO_NOT_READY, GO_STATE_READY, m_spawnId, RemoveFromOwner(), ReplaceAllGameObjectFlags(), WorldObject::SendObjectDeSpawnAnim(), SetGoState(), SetLootState(), and sPoolMgr.

Referenced by MotionTransport::DelayedTeleportTransport(), OPvPCapturePoint::DelCapturePoint(), OPvPCapturePoint::DelObject(), OutdoorPvPSI::HandleCustomSpell(), instance_razorfen_downs::instance_razorfen_downs_InstanceMapScript::OnGameObjectCreate(), go_ulduar_working_harpoon::OnGossipHello(), Unit::RemoveAllGameObjects(), Unit::RemoveGameObject(), Update(), go_celestial_planetarium_access::go_celestial_planetarium_accessAI::UpdateAI(), and Use().

◆ DeleteFromDB()

void GameObject::DeleteFromDB ( )
1186{
1188 sObjectMgr->DeleteGOData(m_spawnId);
1189
1191 stmt->SetData(0, m_spawnId);
1192 WorldDatabase.Execute(stmt);
1193
1194 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_EVENT_GAMEOBJECT);
1195 stmt->SetData(0, m_spawnId);
1196 WorldDatabase.Execute(stmt);
1197}
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
@ WORLD_DEL_EVENT_GAMEOBJECT
Definition: WorldDatabase.h:38
@ WORLD_DEL_GAMEOBJECT
Definition: WorldDatabase.h:37
Definition: PreparedStatement.h:158
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition: PreparedStatement.h:78
void RemoveGORespawnTime(ObjectGuid::LowType dbGuid)
Definition: Map.cpp:3385

References WorldObject::GetMap(), m_spawnId, Map::RemoveGORespawnTime(), PreparedStatementBase::SetData(), sObjectMgr, WORLD_DEL_EVENT_GAMEOBJECT, WORLD_DEL_GAMEOBJECT, and WorldDatabase.

◆ DespawnOrUnsummon()

void GameObject::DespawnOrUnsummon ( Milliseconds  delay = 0ms,
Seconds  forcedRespawnTime = 0s 
)
931{
932 if (delay > 0ms)
933 {
934 if (!m_despawnDelay || m_despawnDelay > delay.count())
935 {
936 m_despawnDelay = delay.count();
937 m_despawnRespawnTime = forceRespawnTime;
938 }
939 }
940 else
941 {
942 if (m_goData)
943 {
944 int32 const respawnDelay = (forceRespawnTime > 0s) ? forceRespawnTime.count() : m_goData->spawntimesecs;
945 SetRespawnTime(respawnDelay);
946 }
947
948 // Respawn is handled by the gameobject itself.
949 // If we delete it from world, it simply never respawns...
950 // Uncomment this and remove the following lines if dynamic spawn is implemented.
951 // Delete();
952 {
956
957 if (GameObject* trap = GetLinkedTrap())
958 {
959 trap->DespawnOrUnsummon();
960 }
961
962 if (GameObjectTemplateAddon const* addon = GetTemplateAddon())
963 {
965 }
966
967 uint32 poolid = m_spawnId ? sPoolMgr->IsPartOfAPool<GameObject>(m_spawnId) : 0;
968 if (poolid)
969 {
970 sPoolMgr->UpdatePool<GameObject>(poolid, m_spawnId);
971 }
972 }
973 }
974}
@ GO_JUST_DEACTIVATED
Definition: GameObject.h:115
GameObject * GetLinkedTrap()
Definition: GameObject.cpp:2780
void SetRespawnTime(int32 respawn)
Definition: GameObject.cpp:1301
int32 spawntimesecs
Definition: GameObjectData.h:707

References Object::GetGUID(), GetLinkedTrap(), GetTemplateAddon(), GO_JUST_DEACTIVATED, GO_STATE_READY, m_despawnDelay, m_despawnRespawnTime, m_goData, m_spawnId, ReplaceAllGameObjectFlags(), WorldObject::SendObjectDeSpawnAnim(), SetGoState(), SetLootState(), SetRespawnTime(), GameObjectData::spawntimesecs, and sPoolMgr.

Referenced by Spell::EffectActivateObject(), spell_item_crystal_prison_dummy_dnd::HandleDummy(), instance_deadmines::instance_deadmines_InstanceMapScript::OnGameObjectCreate(), instance_molten_core::instance_molten_core_InstanceMapScript::OnGameObjectCreate(), instance_temple_of_ahnqiraj::instance_temple_of_ahnqiraj_InstanceMapScript::OnGameObjectCreate(), SmartScript::ProcessAction(), and Update().

◆ EnableCollision()

void GameObject::EnableCollision ( bool  enable)
2650{
2651 if (!m_model)
2652 return;
2653
2654 /*if (enable && !GetMap()->ContainsGameObjectModel(*m_model))
2655 GetMap()->InsertGameObjectModel(*m_model);*/
2656
2657 uint32 phaseMask = 0;
2658 if (enable && !DisableMgr::IsDisabledFor(DISABLE_TYPE_GO_LOS, GetEntry(), nullptr))
2659 phaseMask = GetPhaseMask();
2660
2661 m_model->enable(phaseMask);
2662}
@ DISABLE_TYPE_GO_LOS
Definition: DisableMgr.h:36
bool IsDisabledFor(DisableType type, uint32 entry, Unit const *unit, uint8 flags)
Definition: DisableMgr.cpp:306
void enable(uint32 ph_mask)
Definition: GameObjectModel.h:67
uint32 GetPhaseMask() const
Definition: Object.h:434

References DISABLE_TYPE_GO_LOS, GameObjectModel::enable(), Object::GetEntry(), WorldObject::GetPhaseMask(), DisableMgr::IsDisabledFor(), and m_model.

Referenced by AddToWorld(), instance_ulduar::instance_ulduar_InstanceMapScript::OnGameObjectCreate(), SetDestructibleState(), SetGoState(), and SetPhaseMask().

◆ EventInform()

void GameObject::EventInform ( uint32  eventId)
2183{
2184 if (!eventId)
2185 return;
2186
2187 if (AI())
2188 AI()->EventInform(eventId);
2189
2190 if (m_zoneScript)
2191 m_zoneScript->ProcessEvent(this, eventId);
2192}
virtual void EventInform(uint32)
Definition: GameObjectAI.h:66
GameObjectAI * AI() const
Definition: GameObject.h:310
virtual void ProcessEvent(WorldObject *, uint32)
Definition: ZoneScript.h:55

References AI(), GameObjectAI::EventInform(), WorldObject::m_zoneScript, and ZoneScript::ProcessEvent().

Referenced by MotionTransport::DoEventIfAny(), SetDestructibleState(), and Use().

◆ FindStateSavedOnInstance()

bool GameObject::FindStateSavedOnInstance ( )
2631{
2632 return sObjectMgr->FindInstanceSavedGameobjectState(GetInstanceId(), GetSpawnId());
2633}
uint32 GetInstanceId() const
Definition: Object.h:431

References WorldObject::GetInstanceId(), GetSpawnId(), and sObjectMgr.

Referenced by SavingStateOnDB(), and SetGoState().

◆ GameobjectStateToInt()

uint8 GameObject::GameobjectStateToInt ( GOState state)
2546{
2547 uint8 m_state = 3;
2548
2549 if (state)
2550 {
2551 switch (*state)
2552 {
2553 case GO_STATE_ACTIVE:
2554 m_state = 0;
2555 return m_state;
2556 case GO_STATE_READY:
2557 m_state = 1;
2558 return m_state;
2560 m_state = 2;
2561 return m_state;
2562 }
2563 }
2564
2565 // Returning any value that is not one of the specified ones
2566 // Which will default into the invalid part of the switch
2567 return m_state;
2568}
@ GO_STATE_ACTIVE
Definition: GameObjectData.h:690

References GO_STATE_ACTIVE, GO_STATE_ACTIVE_ALTERNATIVE, and GO_STATE_READY.

Referenced by SavingStateOnDB(), and SetGoState().

◆ GetAIName()

std::string const & GameObject::GetAIName ( ) const
101{
102 return sObjectMgr->GetGameObjectTemplate(GetEntry())->AIName;
103}

References Object::GetEntry(), and sObjectMgr.

Referenced by GetDebugInfo(), and SmartScript::IsSmartGO().

◆ GetDebugInfo()

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

Reimplemented from Object.

Reimplemented in MotionTransport.

3133{
3134 std::stringstream sstr;
3135 sstr << WorldObject::GetDebugInfo() << "\n"
3136 << "SpawnId: " << GetSpawnId() << " GoState: " << std::to_string(GetGoState()) << " ScriptId: " << GetScriptId() << " AIName: " << GetAIName();
3137 return sstr.str();
3138}
virtual uint32 GetScriptId() const
Definition: GameObject.cpp:2194
std::string const & GetAIName() const
Definition: GameObject.cpp:100
std::string GetDebugInfo() const override
Definition: Object.cpp:2447

References GetAIName(), WorldObject::GetDebugInfo(), GetGoState(), GetScriptId(), and GetSpawnId().

Referenced by MotionTransport::GetDebugInfo().

◆ GetDestructibleState()

GameObjectDestructibleState GameObject::GetDestructibleState ( ) const
inline
299 {
305 }
@ GO_FLAG_DESTROYED
Definition: SharedDefines.h:1583
@ GO_FLAG_DAMAGED
Definition: SharedDefines.h:1582
@ GO_DESTRUCTIBLE_DESTROYED
Definition: SharedDefines.h:1601
@ GO_DESTRUCTIBLE_INTACT
Definition: SharedDefines.h:1599
@ GO_DESTRUCTIBLE_DAMAGED
Definition: SharedDefines.h:1600
bool HasGameObjectFlag(GameObjectFlags flags) const
Definition: GameObject.h:219

References GO_DESTRUCTIBLE_DAMAGED, GO_DESTRUCTIBLE_DESTROYED, GO_DESTRUCTIBLE_INTACT, GO_FLAG_DAMAGED, GO_FLAG_DESTROYED, and HasGameObjectFlag().

Referenced by ModifyHealth().

◆ GetDisplayId()

uint32 GameObject::GetDisplayId ( ) const
inline
@ GAMEOBJECT_DISPLAYID
Definition: UpdateFields.h:398
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:305

References GAMEOBJECT_DISPLAYID, and Object::GetUInt32Value().

Referenced by GameObjectModelOwnerImpl::GetDisplayId(), and spell_zulfarrak_unlocking::spell_zulfarrak_unlocking_SpellScript::HandleOpenLock().

◆ GetDynamicFlags()

uint32 GameObject::GetDynamicFlags ( ) const
inlineoverridevirtual

Reimplemented from Object.

References GAMEOBJECT_DYNAMIC, and Object::GetUInt32Value().

◆ GetFishLoot()

void GameObject::GetFishLoot ( Loot loot,
Player loot_owner 
)
1000{
1001 fishloot->clear();
1002
1003 uint32 zone, subzone;
1004 uint32 defaultzone = 1;
1005 GetZoneAndAreaId(zone, subzone);
1006
1007 // if subzone loot exist use it
1008 fishloot->FillLoot(subzone, LootTemplates_Fishing, loot_owner, true, true);
1009 if (fishloot->empty()) //use this becase if zone or subzone has set LOOT_MODE_JUNK_FISH,Even if no normal drop, fishloot->FillLoot return true. it wrong.
1010 {
1011 //subzone no result,use zone loot
1012 fishloot->FillLoot(zone, LootTemplates_Fishing, loot_owner, true, true);
1013 //use zone 1 as default, somewhere fishing got nothing,becase subzone and zone not set, like Off the coast of Storm Peaks.
1014 if (fishloot->empty())
1015 fishloot->FillLoot(defaultzone, LootTemplates_Fishing, loot_owner, true, true);
1016 }
1017}
LootStore LootTemplates_Fishing("fishing_loot_template", "area id", true)
void GetZoneAndAreaId(uint32 &zoneid, uint32 &areaid) const
Definition: Object.cpp:3091

References Loot::clear(), Loot::empty(), Loot::FillLoot(), WorldObject::GetZoneAndAreaId(), and LootTemplates_Fishing.

Referenced by Player::SendLoot().

◆ GetFishLootJunk()

void GameObject::GetFishLootJunk ( Loot loot,
Player loot_owner 
)
1020{
1021 fishloot->clear();
1022
1023 uint32 zone, subzone;
1024 uint32 defaultzone = 1;
1025 GetZoneAndAreaId(zone, subzone);
1026
1027 // if subzone loot exist use it
1028 fishloot->FillLoot(subzone, LootTemplates_Fishing, loot_owner, true, true, LOOT_MODE_JUNK_FISH);
1029 if (fishloot->empty()) //use this becase if zone or subzone has normal mask drop, then fishloot->FillLoot return true.
1030 {
1031 //use zone loot
1032 fishloot->FillLoot(zone, LootTemplates_Fishing, loot_owner, true, true, LOOT_MODE_JUNK_FISH);
1033 if (fishloot->empty())
1034 //use zone 1 as default
1035 fishloot->FillLoot(defaultzone, LootTemplates_Fishing, loot_owner, true, true, LOOT_MODE_JUNK_FISH);
1036 }
1037}
@ LOOT_MODE_JUNK_FISH
Definition: SharedDefines.h:47

References Loot::clear(), Loot::empty(), Loot::FillLoot(), WorldObject::GetZoneAndAreaId(), LOOT_MODE_JUNK_FISH, and LootTemplates_Fishing.

Referenced by Player::SendLoot().

◆ GetGameObjectData()

GameObjectData const * GameObject::GetGameObjectData ( ) const
inline

◆ GetGameObjectFlags()

GameObjectFlags GameObject::GetGameObjectFlags ( ) const
inline

◆ GetGoAnimProgress()

uint8 GameObject::GetGoAnimProgress ( ) const
inline
211{ return GetByteValue(GAMEOBJECT_BYTES_1, 3); }
@ GAMEOBJECT_BYTES_1
Definition: UpdateFields.h:404
uint8 GetByteValue(uint16 index, uint8 offset) const
Definition: Object.cpp:323

References GAMEOBJECT_BYTES_1, and Object::GetByteValue().

Referenced by Spell::EffectDummy(), SaveToDB(), Update(), and Use().

◆ GetGoArtKit()

uint8 GameObject::GetGoArtKit ( ) const
inline
209{ return GetByteValue(GAMEOBJECT_BYTES_1, 2); }

References GAMEOBJECT_BYTES_1, and Object::GetByteValue().

Referenced by SaveToDB().

◆ GetGOInfo()

GameObjectTemplate const * GameObject::GetGOInfo ( ) const
inline
138{ return m_goInfo; }

References m_goInfo.

Referenced by ActivateToQuest(), BuildValuesUpdate(), Spell::CheckCast(), Spell::CheckEffectTarget(), CheckRitualList(), ClearRitualList(), Create(), StaticTransport::Create(), Delete(), WorldSession::DoLootRelease(), Spell::EffectOpenLock(), MotionTransport::EnableMovement(), BattlegroundSA::EventPlayerDamagedGO(), Player::GetDefaultGossipMenuForSource(), GetScriptId(), GetSpellForLock(), GetStationaryO(), GetStationaryX(), GetStationaryY(), GetStationaryZ(), GetTemplateAddon(), go_celestial_planetarium_access::go_celestial_planetarium_accessAI::GossipHello(), WorldSession::HandleAlterAppearance(), OutdoorPvPSI::HandleCustomSpell(), gobject_commandscript::HandleGameObjectMoveCommand(), gobject_commandscript::HandleGameObjectTurnCommand(), OPvPCapturePoint::HandlePlayerEnter(), OPvPCapturePoint::HandlePlayerLeave(), IsAtInteractDistance(), IsDestructibleBuilding(), IsMotionTransport(), IsNeverVisible(), IsStaticTransport(), IsTransport(), LoadGameObjectFromDB(), MotionTransport::LoadStaticPassengers(), ModifyHealth(), instance_naxxramas::instance_naxxramas_InstanceMapScript::OnGameObjectCreate(), instance_naxxramas::instance_naxxramas_InstanceMapScript::OnGameObjectRemove(), icecrown_citadel_teleport::OnGossipHello(), go_simon_cluster::OnGossipHello(), go_apexis_relic::OnGossipHello(), go_skull_pile::OnGossipHello(), Acore::NearestGameObjectFishingHole::operator()(), Acore::GameObjectInRangeCheck::operator()(), Acore::GameObjectFocusCheck::operator()(), RemoveFromOwner(), Creature::SaveToDB(), SaveToDB(), BfCapturePoint::SendChangePhase(), OPvPCapturePoint::SendChangePhase(), Player::SendLoot(), Spell::SendLoot(), BfCapturePoint::SetCapturePointData(), SetLootState(), ToMotionTransport(), ToStaticTransport(), ToTransport(), BfCapturePoint::Update(), OPvPCapturePoint::Update(), MotionTransport::Update(), Update(), UpdateVisibilityOf_helper(), Use(), and UseDoorOrButton().

◆ GetGoState()

◆ GetGoType()

◆ GetGOValue()

GameObjectValue const * GameObject::GetGOValue ( ) const
inline
141{ return &m_goValue; }

References m_goValue.

Referenced by WorldSession::DoLootRelease(), and Transport::GetPathProgress().

◆ GetInteractionDistance()

float GameObject::GetInteractionDistance ( ) const
2918{
2919 switch (GetGoType())
2920 {
2922 return 0.0f;
2928 return 5.5555553f;
2930 return 10.0f;
2933 return 3.0f;
2935 return 100.0f;
2937 return 20.0f + CONTACT_DISTANCE; // max spell range
2943 return 5.0f;
2944 // Following values are not blizzlike
2947 // 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.
2948 // 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.
2949 return 10.0f; // 5.0f is blizzlike
2950 default:
2951 return INTERACTION_DISTANCE;
2952 }
2953}
#define INTERACTION_DISTANCE
Definition: ObjectDefines.h:24
#define CONTACT_DISTANCE
Definition: ObjectDefines.h:23
@ GAMEOBJECT_TYPE_GUILD_BANK
Definition: SharedDefines.h:1566
@ GAMEOBJECT_TYPE_MINI_GAME
Definition: SharedDefines.h:1559
@ GAMEOBJECT_TYPE_CAMERA
Definition: SharedDefines.h:1545
@ GAMEOBJECT_TYPE_MAP_OBJECT
Definition: SharedDefines.h:1546
@ GAMEOBJECT_TYPE_FLAGDROP
Definition: SharedDefines.h:1558
@ GAMEOBJECT_TYPE_MAILBOX
Definition: SharedDefines.h:1551
@ GAMEOBJECT_TYPE_FLAGSTAND
Definition: SharedDefines.h:1556
@ GAMEOBJECT_TYPE_CHAIR
Definition: SharedDefines.h:1539
@ GAMEOBJECT_TYPE_TEXT
Definition: SharedDefines.h:1541
@ GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY
Definition: SharedDefines.h:1563
@ GAMEOBJECT_TYPE_AREADAMAGE
Definition: SharedDefines.h:1544
@ GAMEOBJECT_TYPE_BARBER_CHAIR
Definition: SharedDefines.h:1564
@ GAMEOBJECT_TYPE_DOOR
Definition: SharedDefines.h:1532
@ GAMEOBJECT_TYPE_BINDER
Definition: SharedDefines.h:1536

References CONTACT_DISTANCE, GAMEOBJECT_TYPE_AREADAMAGE, GAMEOBJECT_TYPE_BARBER_CHAIR, GAMEOBJECT_TYPE_BINDER, GAMEOBJECT_TYPE_CAMERA, GAMEOBJECT_TYPE_CHAIR, GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING, GAMEOBJECT_TYPE_DOOR, GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY, GAMEOBJECT_TYPE_FISHINGHOLE, GAMEOBJECT_TYPE_FISHINGNODE, GAMEOBJECT_TYPE_FLAGDROP, GAMEOBJECT_TYPE_FLAGSTAND, GAMEOBJECT_TYPE_GUILD_BANK, GAMEOBJECT_TYPE_MAILBOX, GAMEOBJECT_TYPE_MAP_OBJECT, GAMEOBJECT_TYPE_MINI_GAME, GAMEOBJECT_TYPE_QUESTGIVER, GAMEOBJECT_TYPE_TEXT, GetGoType(), and INTERACTION_DISTANCE.

Referenced by IsAtInteractDistance().

◆ getLevelForTarget()

uint8 GameObject::getLevelForTarget ( WorldObject const *  target) const
inlineoverridevirtual

Reimplemented from WorldObject.

279 {
280 if (Unit* owner = GetOwner())
281 return owner->getLevelForTarget(target);
282
283 return 1;
284 }

References GetOwner().

◆ GetLinkedTrap()

GameObject * GameObject::GetLinkedTrap ( )
2781{
2783}
GameObject * GetGameObject(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:189
ObjectGuid m_linkedTrap
Definition: GameObject.h:412

References ObjectAccessor::GetGameObject(), and m_linkedTrap.

Referenced by DespawnOrUnsummon(), Spell::EffectSummonObjectWild(), Spell::EffectTransmitted(), RemoveFromWorld(), go_direbrew_mole_machine::go_direbrew_mole_machineAI::Reset(), TriggeringLinkedGameObject(), and Update().

◆ GetLocalRotation()

G3D::Quat const & GameObject::GetLocalRotation ( ) const
inline
152{ return m_localRotation; }
G3D::Quat m_localRotation
Definition: GameObject.h:404

References m_localRotation.

Referenced by GetWorldRotation().

◆ GetLootGenerationTime()

uint32 GameObject::GetLootGenerationTime ( ) const
inline
260{ return m_lootGenerationTime; }

References m_lootGenerationTime.

Referenced by Player::SendLoot().

◆ GetLootMode()

uint16 GameObject::GetLootMode ( ) const
inline

◆ GetLootRecipient()

Player * GameObject::GetLootRecipient ( ) const
2678{
2679 if (!m_lootRecipient)
2680 return nullptr;
2682}
Player * FindConnectedPlayer(ObjectGuid const guid)
Definition: ObjectAccessor.cpp:262
ObjectGuid m_lootRecipient
Definition: GameObject.h:407

References ObjectAccessor::FindConnectedPlayer(), and m_lootRecipient.

◆ GetLootRecipientGroup()

Group * GameObject::GetLootRecipientGroup ( ) const
2685{
2687 return nullptr;
2688 return sGroupMgr->GetGroupByGUID(m_lootRecipientGroup);
2689}
#define sGroupMgr
Definition: GroupMgr.h:51

References m_lootRecipientGroup, and sGroupMgr.

Referenced by IsLootAllowedFor().

◆ getLootState()

◆ GetNameForLocaleIdx()

std::string const & GameObject::GetNameForLocaleIdx ( LocaleConstant  locale_idx) const
overridevirtual

Reimplemented from WorldObject.

2205{
2206 if (loc_idx != DEFAULT_LOCALE)
2207 {
2208 uint8 uloc_idx = uint8(loc_idx);
2209 if (GameObjectLocale const* cl = sObjectMgr->GetGameObjectLocale(GetEntry()))
2210 if (cl->Name.size() > uloc_idx && !cl->Name[uloc_idx].empty())
2211 return cl->Name[uloc_idx];
2212 }
2213
2214 return GetName();
2215}
#define DEFAULT_LOCALE
Definition: Common.h:88
Definition: GameObjectData.h:675
std::string const & GetName() const
Definition: Object.h:446

References DEFAULT_LOCALE, Object::GetEntry(), WorldObject::GetName(), and sObjectMgr.

◆ GetOwner()

Unit * GameObject::GetOwner ( ) const

◆ GetOwnerGUID()

◆ GetPackedLocalRotation()

int64 GameObject::GetPackedLocalRotation ( ) const
inline
153{ return m_packedRotation; }

References m_packedRotation.

◆ GetRespawnDelay()

uint32 GameObject::GetRespawnDelay ( ) const
inline

◆ GetRespawnPosition()

void GameObject::GetRespawnPosition ( float &  x,
float &  y,
float &  z,
float *  ori = nullptr 
) const
2886{
2887 if (m_spawnId)
2888 {
2889 if (GameObjectData const* data = sObjectMgr->GetGameObjectData(m_spawnId))
2890 {
2891 x = data->posX;
2892 y = data->posY;
2893 z = data->posZ;
2894 if (ori)
2895 *ori = data->orientation;
2896 return;
2897 }
2898 }
2899
2900 x = GetPositionX();
2901 y = GetPositionY();
2902 z = GetPositionZ();
2903 if (ori)
2904 *ori = GetOrientation();
2905}
Definition: GameObjectData.h:697

References Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), m_spawnId, and sObjectMgr.

◆ GetRespawnTime()

time_t GameObject::GetRespawnTime ( ) const
inline

◆ GetRespawnTimeEx()

time_t GameObject::GetRespawnTimeEx ( ) const
2969{
2970 time_t now = GameTime::GetGameTime().count();
2971 if (m_respawnTime > now)
2972 return m_respawnTime;
2973 else
2974 return now;
2975}
Seconds GetGameTime()
Definition: GameTime.cpp:38

References GameTime::GetGameTime(), and m_respawnTime.

Referenced by gobject_commandscript::HandleGameObjectTargetCommand().

◆ GetScriptId()

◆ GetSpawnId()

◆ GetSpellForLock()

SpellInfo const * GameObject::GetSpellForLock ( Player const *  player) const
3054{
3055 if (!player)
3056 {
3057 return nullptr;
3058 }
3059
3060 uint32 lockId = GetGOInfo()->GetLockId();
3061 if (!lockId)
3062 {
3063 return nullptr;
3064 }
3065
3066 LockEntry const* lock = sLockStore.LookupEntry(lockId);
3067 if (!lock)
3068 {
3069 return nullptr;
3070 }
3071
3072 for (uint8 i = 0; i < MAX_LOCK_CASE; ++i)
3073 {
3074 if (!lock->Type[i])
3075 {
3076 continue;
3077 }
3078
3079 if (lock->Type[i] == LOCK_KEY_SPELL)
3080 {
3081 if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(lock->Index[i]))
3082 {
3083 return spell;
3084 }
3085 }
3086
3087 if (lock->Type[i] != LOCK_KEY_SKILL)
3088 {
3089 break;
3090 }
3091
3092 for (auto&& playerSpell : player->GetSpellMap())
3093 {
3094 if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(playerSpell.first))
3095 {
3096 for (auto&& effect : spell->Effects)
3097 {
3098 if (effect.Effect == SPELL_EFFECT_OPEN_LOCK && ((uint32) effect.MiscValue) == lock->Index[i])
3099 {
3100 if (effect.CalcValue(player) >= int32(lock->Skill[i]))
3101 {
3102 return spell;
3103 }
3104 }
3105 }
3106 }
3107 }
3108 }
3109
3110 return nullptr;
3111}
DBCStorage< LockEntry > sLockStore(LockEntryfmt)
#define MAX_LOCK_CASE
Definition: DBCStructure.h:1288
@ SPELL_EFFECT_OPEN_LOCK
Definition: SharedDefines.h:783
@ LOCK_KEY_SKILL
Definition: SharedDefines.h:2558
@ LOCK_KEY_SPELL
Definition: SharedDefines.h:2559
uint32 GetLockId() const
Definition: GameObjectData.h:428
Definition: DBCStructure.h:1291
uint32 Type[MAX_LOCK_CASE]
Definition: DBCStructure.h:1293
uint32 Index[MAX_LOCK_CASE]
Definition: DBCStructure.h:1294
uint32 Skill[MAX_LOCK_CASE]
Definition: DBCStructure.h:1295

References GetGOInfo(), GameObjectTemplate::GetLockId(), Player::GetSpellMap(), LockEntry::Index, LOCK_KEY_SKILL, LOCK_KEY_SPELL, MAX_LOCK_CASE, LockEntry::Skill, sLockStore, SPELL_EFFECT_OPEN_LOCK, sSpellMgr, and LockEntry::Type.

Referenced by IsAtInteractDistance().

◆ GetSpellId()

uint32 GameObject::GetSpellId ( ) const
inline
183{ return m_spellId;}

References m_spellId.

Referenced by Unit::AddGameObject(), Unit::RemoveGameObject(), and Update().

◆ GetStateSavedOnInstance()

uint8 GameObject::GetStateSavedOnInstance ( )

◆ GetStationaryO()

float GameObject::GetStationaryO ( ) const
inlineoverridevirtual

◆ GetStationaryX()

float GameObject::GetStationaryX ( ) const
inlineoverridevirtual

◆ GetStationaryY()

float GameObject::GetStationaryY ( ) const
inlineoverridevirtual

◆ GetStationaryZ()

float GameObject::GetStationaryZ ( ) const
inlineoverridevirtual

◆ GetTemplateAddon()

GameObjectTemplateAddon const * GameObject::GetTemplateAddon ( ) const

◆ GetUniqueUseCount()

uint32 GameObject::GetUniqueUseCount ( ) const
inline
244{ return m_unique_users.size(); }

References m_unique_users.

Referenced by Update(), and Use().

◆ GetUseCount()

uint32 GameObject::GetUseCount ( ) const
inline
243{ return m_usetimes; }

References m_usetimes.

Referenced by WorldSession::DoLootRelease().

◆ GetWorldRotation()

G3D::Quat GameObject::GetWorldRotation ( ) const
2258{
2259 G3D::Quat localRotation = GetLocalRotation();
2260 if (Transport* transport = GetTransport())
2261 {
2262 G3D::Quat worldRotation = transport->GetWorldRotation();
2263
2264 G3D::Quat worldRotationQuat(worldRotation.x, worldRotation.y, worldRotation.z, worldRotation.w);
2265 G3D::Quat localRotationQuat(localRotation.x, localRotation.y, localRotation.z, localRotation.w);
2266
2267 G3D::Quat resultRotation = localRotationQuat * worldRotationQuat;
2268
2269 return G3D::Quat(resultRotation.x, resultRotation.y, resultRotation.z, resultRotation.w);
2270 }
2271 return localRotation;
2272}
G3D::Quat const & GetLocalRotation() const
Definition: GameObject.h:152
Definition: Transport.h:29

References GetLocalRotation(), and WorldObject::GetTransport().

Referenced by IsAtInteractDistance().

◆ HasGameObjectFlag()

bool GameObject::HasGameObjectFlag ( GameObjectFlags  flags) const
inline
219{ return HasFlag(GAMEOBJECT_FLAGS, flags) != 0; }
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.cpp:889

References GAMEOBJECT_FLAGS, and Object::HasFlag().

Referenced by GetDestructibleState(), and Use().

◆ hasInvolvedQuest()

bool GameObject::hasInvolvedQuest ( uint32  quest_id) const
overridevirtual

Reimplemented from Object.

1214{
1215 QuestRelationBounds qir = sObjectMgr->GetGOQuestInvolvedRelationBounds(GetEntry());
1216 for (QuestRelations::const_iterator itr = qir.first; itr != qir.second; ++itr)
1217 {
1218 if (itr->second == quest_id)
1219 return true;
1220 }
1221 return false;
1222}
std::pair< QuestRelations::const_iterator, QuestRelations::const_iterator > QuestRelationBounds
Definition: ObjectMgr.h:519

References Object::GetEntry(), and sObjectMgr.

◆ HasLootMode()

bool GameObject::HasLootMode ( uint16  lootMode) const
inline
231{ return m_LootMode & lootMode; }

References m_LootMode.

◆ HasLootRecipient()

bool GameObject::HasLootRecipient ( ) const
inline

◆ hasQuest()

bool GameObject::hasQuest ( uint32  quest_id) const
overridevirtual

Reimplemented from Object.

1203{
1204 QuestRelationBounds qr = sObjectMgr->GetGOQuestRelationBounds(GetEntry());
1205 for (QuestRelations::const_iterator itr = qr.first; itr != qr.second; ++itr)
1206 {
1207 if (itr->second == quest_id)
1208 return true;
1209 }
1210 return false;
1211}

References Object::GetEntry(), and sObjectMgr.

◆ IsAbleToSaveOnDb()

bool GameObject::IsAbleToSaveOnDb ( )
2571{
2572 return m_saveStateOnDb;
2573}
bool m_saveStateOnDb
Definition: GameObject.h:432

References m_saveStateOnDb.

Referenced by SetGoState().

◆ IsAlwaysVisibleFor()

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

Reimplemented from WorldObject.

1262{
1264 return true;
1265
1267 return true;
1268
1269 if (!seer)
1270 return false;
1271
1272 // Always seen by owner and friendly units
1273 if (ObjectGuid guid = GetOwnerGUID())
1274 {
1275 if (seer->GetGUID() == guid)
1276 return true;
1277
1278 Unit* owner = GetOwner();
1279 if (owner)
1280 {
1281 if (seer->isType(TYPEMASK_UNIT) && owner->IsFriendlyTo(seer->ToUnit()))
1282 return true;
1283 }
1284 }
1285
1286 return false;
1287}
@ TYPEMASK_UNIT
Definition: ObjectGuid.h:51
bool IsDestructibleBuilding() const
Definition: GameObject.cpp:1229
virtual bool IsAlwaysVisibleFor(WorldObject const *) const
Definition: Object.h:648
bool IsFriendlyTo(Unit const *unit) const
Definition: Unit.cpp:10214

References Object::GetGUID(), GetOwner(), GetOwnerGUID(), WorldObject::IsAlwaysVisibleFor(), IsDestructibleBuilding(), Unit::IsFriendlyTo(), IsTransport(), Object::isType(), Object::ToUnit(), and TYPEMASK_UNIT.

◆ IsAtInteractDistance() [1/2]

bool GameObject::IsAtInteractDistance ( Player const *  player,
SpellInfo const *  spell = nullptr 
) const
3007{
3008 if (spell || (spell = GetSpellForLock(player)))
3009 {
3010 float maxRange = spell->GetMaxRange(spell->IsPositive());
3011
3013 {
3014 return maxRange * maxRange >= GetExactDistSq(player);
3015 }
3016
3017 if (sGameObjectDisplayInfoStore.LookupEntry(GetGOInfo()->displayId))
3018 {
3019 return IsAtInteractDistance(*player, maxRange);
3020 }
3021 }
3022
3024}
DBCStorage< GameObjectDisplayInfoEntry > sGameObjectDisplayInfoStore(GameObjectDisplayInfofmt)
bool IsAtInteractDistance(Position const &pos, float radius) const
Definition: GameObject.cpp:3026
SpellInfo const * GetSpellForLock(Player const *player) const
Definition: GameObject.cpp:3053
float GetInteractionDistance() const
Definition: GameObject.cpp:2917
float GetExactDistSq(float x, float y, float z) const
Definition: Position.h:170

References GAMEOBJECT_TYPE_SPELL_FOCUS, Position::GetExactDistSq(), GetGOInfo(), GetGoType(), GetInteractionDistance(), SpellInfo::GetMaxRange(), GetSpellForLock(), IsAtInteractDistance(), SpellInfo::IsPositive(), and sGameObjectDisplayInfoStore.

◆ IsAtInteractDistance() [2/2]

bool GameObject::IsAtInteractDistance ( Position const &  pos,
float  radius 
) const
3027{
3028 if (GameObjectDisplayInfoEntry const* displayInfo = sGameObjectDisplayInfoStore.LookupEntry(GetGOInfo()->displayId))
3029 {
3030 float scale = GetObjectScale();
3031
3032 float minX = displayInfo->minX * scale - radius;
3033 float minY = displayInfo->minY * scale - radius;
3034 float minZ = displayInfo->minZ * scale - radius;
3035 float maxX = displayInfo->maxX * scale + radius;
3036 float maxY = displayInfo->maxY * scale + radius;
3037 float maxZ = displayInfo->maxZ * scale + radius;
3038
3039 G3D::Quat worldRotation = GetWorldRotation();
3040 G3D::Quat worldRotationQuat(worldRotation.x, worldRotation.y, worldRotation.z, worldRotation.w);
3041
3042 return G3D::CoordinateFrame {{worldRotationQuat}, {GetPositionX(), GetPositionY(), GetPositionZ()}}.toWorldSpace(G3D::Box {{minX, minY, minZ}, {maxX, maxY, maxZ}}).contains({pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()});
3043 }
3044
3045 return GetExactDist(&pos) <= radius;
3046}
G3D::Quat GetWorldRotation() const
Definition: GameObject.cpp:2257
float GetObjectScale() const
Definition: Object.h:112
float GetExactDist(float x, float y, float z) const
Definition: Position.h:178
Definition: DBCStructure.h:991

References Position::GetExactDist(), GetGOInfo(), Object::GetObjectScale(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetWorldRotation(), and sGameObjectDisplayInfoStore.

Referenced by IsAtInteractDistance(), and IsWithinDistInMap().

◆ IsDestructibleBuilding()

bool GameObject::IsDestructibleBuilding ( ) const
1230{
1231 GameObjectTemplate const* gInfo = GetGOInfo();
1232 if (!gInfo) return false;
1234}

References GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING, GetGOInfo(), and GameObjectTemplate::type.

Referenced by IsAlwaysVisibleFor(), and ModifyHealth().

◆ 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

2147{
2149 if (!info)
2150 return IsWithinDist3d(x, y, z, radius);
2151
2152 float sinA = std::sin(GetOrientation());
2153 float cosA = cos(GetOrientation());
2154 float dx = x - GetPositionX();
2155 float dy = y - GetPositionY();
2156 float dz = z - GetPositionZ();
2157 float dist = std::sqrt(dx * dx + dy * dy);
2160 if (G3D::fuzzyEq(dist, 0.0f))
2161 return true;
2162
2163 float scale = GetObjectScale();
2164 float sinB = dx / dist;
2165 float cosB = dy / dist;
2166 dx = dist * (cosA * cosB + sinA * sinB);
2167 dy = dist * (cosA * sinB - sinA * cosB);
2168 return dx < (info->maxX * scale) + radius && dx > (info->minX * scale) - radius
2169 && dy < (info->maxY * scale) + radius && dy > (info->minY * scale) - radius
2170 && dz < (info->maxZ * scale) + radius && dz > (info->minZ * scale) - radius;
2171}
bool IsWithinDist3d(float x, float y, float z, float dist) const
Definition: Object.cpp:1295
float maxX
Definition: DBCStructure.h:998
float maxY
Definition: DBCStructure.h:999
float minY
Definition: DBCStructure.h:996
float minX
Definition: DBCStructure.h:995
float minZ
Definition: DBCStructure.h:997
float maxZ
Definition: DBCStructure.h:1000

References GameObjectTemplate::displayId, Object::GetObjectScale(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::IsWithinDist3d(), m_goInfo, GameObjectDisplayInfoEntry::maxX, GameObjectDisplayInfoEntry::maxY, GameObjectDisplayInfoEntry::maxZ, GameObjectDisplayInfoEntry::minX, GameObjectDisplayInfoEntry::minY, GameObjectDisplayInfoEntry::minZ, and sGameObjectDisplayInfoStore.

Referenced by _IsWithinDist(), Acore::GameObjectInRangeCheck::operator()(), Acore::AnyPlayerExactPositionInGameObjectRangeCheck::operator()(), and Acore::WorldObjectSpellAreaTargetCheck::operator()().

◆ IsInSkillupList()

bool GameObject::IsInSkillupList ( ObjectGuid  playerGuid) const
3120{
3121 for (auto const& itr : m_SkillupList)
3122 {
3123 if (itr.first == playerGuid)
3124 {
3125 return true;
3126 }
3127 }
3128
3129 return false;
3130}

References m_SkillupList.

Referenced by Spell::EffectOpenLock().

◆ IsInstanceGameobject()

bool GameObject::IsInstanceGameobject ( )
2512{
2513 // Avoid checking for unecessary gameobjects whose
2514 // states don't matter for the dungeon progression
2516 {
2517 return false;
2518 }
2519
2520 if (auto* map = FindMap())
2521 {
2522 if (map->IsDungeon() || map->IsRaid())
2523 {
2524 return true;
2525 }
2526 }
2527 return false;
2528}
bool ValidateGameobjectType()
Definition: GameObject.cpp:2530
Map * FindMap() const
Definition: Object.h:518

References WorldObject::FindMap(), and ValidateGameobjectType().

Referenced by Create(), SavingStateOnDB(), and SetGoState().

◆ IsInvisibleDueToDespawn()

bool GameObject::IsInvisibleDueToDespawn ( ) const
overridevirtual

Reimplemented from WorldObject.

1290{
1292 return true;
1293
1294 // Despawned
1295 if (!isSpawned())
1296 return true;
1297
1298 return false;
1299}
bool isSpawned() const
Definition: GameObject.h:191
virtual bool IsInvisibleDueToDespawn() const
Definition: Object.h:649

References WorldObject::IsInvisibleDueToDespawn(), and isSpawned().

◆ IsLootAllowedFor()

bool GameObject::IsLootAllowedFor ( Player const *  player) const
2748{
2750 {
2751 return true;
2752 }
2753
2754 if (player->GetGUID() == m_lootRecipient)
2755 {
2756 return true;
2757 }
2758
2759 if (player->HasPendingBind())
2760 {
2761 return false;
2762 }
2763
2764 // if we dont have a group we arent the recipient
2765 // if go doesnt have group bound it means it was solo killed by someone else
2766 Group const* playerGroup = player->GetGroup();
2767 if (!playerGroup || playerGroup != GetLootRecipientGroup())
2768 {
2769 return false;
2770 }
2771
2772 if (!HasAllowedLooter(player->GetGUID()))
2773 {
2774 return false;
2775 }
2776
2777 return true;
2778}
Group * GetLootRecipientGroup() const
Definition: GameObject.cpp:2684
bool HasAllowedLooter(ObjectGuid guid) const
Definition: Object.cpp:3131
Definition: Group.h:168

References Player::GetGroup(), Object::GetGUID(), GetLootRecipientGroup(), WorldObject::HasAllowedLooter(), Player::HasPendingBind(), m_lootRecipient, and m_lootRecipientGroup.

Referenced by BuildValuesUpdate().

◆ IsMotionTransport()

bool GameObject::IsMotionTransport ( ) const
inline

◆ IsNeverVisible()

bool GameObject::IsNeverVisible ( ) const
overridevirtual

Reimplemented from WorldObject.

1251{
1253 return true;
1254
1255 if (GetGoType() == GAMEOBJECT_TYPE_SPELL_FOCUS && GetGOInfo()->spellFocus.serverOnly == 1)
1256 return true;
1257
1258 return false;
1259}
uint32 serverOnly
Definition: GameObjectData.h:108
virtual bool IsNeverVisible() const
Definition: Object.h:647

References GAMEOBJECT_TYPE_SPELL_FOCUS, GetGOInfo(), GetGoType(), WorldObject::IsNeverVisible(), and GameObjectTemplate::serverOnly.

◆ isSpawned()

◆ isSpawnedByDefault()

bool GameObject::isSpawnedByDefault ( ) const
inline

◆ IsStaticTransport()

bool GameObject::IsStaticTransport ( ) const
inline

◆ IsTransport()

◆ IsWithinDistInMap() [1/2]

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

◆ IsWithinDistInMap() [2/2]

bool WorldObject::IsWithinDistInMap ( WorldObject const *  obj,
float  dist2compare,
bool  is3D = true,
bool  useBoundingRadius = true 
) const
1322{
1323 return obj && IsInMap(obj) && InSamePhase(obj) && _IsWithinDist(obj, dist2compare, is3D, useBoundingRadius);
1324}
bool _IsWithinDist(WorldObject const *obj, float dist2compare, bool, bool) const override
Object distance/size - overridden from Object::_IsWithinDist. Needs to take in account proper GO size...
Definition: GameObject.h:424

◆ LoadFromDB()

bool GameObject::LoadFromDB ( ObjectGuid::LowType  guid,
Map map 
)
inline
161{ return LoadGameObjectFromDB(guid, map, false); }
bool LoadGameObjectFromDB(ObjectGuid::LowType guid, Map *map, bool addToMap=true)
Definition: GameObject.cpp:1120

References LoadGameObjectFromDB().

Referenced by LoadHelper().

◆ LoadGameObjectFromDB()

bool GameObject::LoadGameObjectFromDB ( ObjectGuid::LowType  guid,
Map map,
bool  addToMap = true 
)
1121{
1122 GameObjectData const* data = sObjectMgr->GetGameObjectData(spawnId);
1123
1124 if (!data)
1125 {
1126 LOG_ERROR("sql.sql", "Gameobject (GUID: {}) not found in table `gameobject`, can't load. ", spawnId);
1127 return false;
1128 }
1129
1130 uint32 entry = data->id;
1131 //uint32 map_id = data->mapid; // already used before call
1132 uint32 phaseMask = data->phaseMask;
1133 float x = data->posX;
1134 float y = data->posY;
1135 float z = data->posZ;
1136 float ang = data->orientation;
1137
1138 uint32 animprogress = data->animprogress;
1139 GOState go_state = data->go_state;
1140 uint32 artKit = data->artKit;
1141
1142 m_spawnId = spawnId;
1143
1144 if (!Create(map->GenerateLowGuid<HighGuid::GameObject>(), entry, map, phaseMask, x, y, z, ang, data->rotation, animprogress, go_state, artKit))
1145 return false;
1146
1147 if (data->spawntimesecs >= 0)
1148 {
1149 m_spawnedByDefault = true;
1150
1151 if (!GetGOInfo()->GetDespawnPossibility() && !GetGOInfo()->IsDespawnAtAction())
1152 {
1155 m_respawnTime = 0;
1156 }
1157 else
1158 {
1161
1162 // ready to respawn
1164 {
1165 m_respawnTime = 0;
1167 }
1168 }
1169 }
1170 else
1171 {
1172 m_spawnedByDefault = false;
1174 m_respawnTime = 0;
1175 }
1176
1177 m_goData = data;
1178
1179 if (addToMap && !GetMap()->AddToMap(this))
1180 return false;
1181
1182 return true;
1183}
@ GO_FLAG_NODESPAWN
Definition: SharedDefines.h:1580
void SetGameObjectFlag(GameObjectFlags flags)
Definition: GameObject.h:220
float orientation
Definition: GameObjectData.h:705
float posZ
Definition: GameObjectData.h:704
uint8 artKit
Definition: GameObjectData.h:712
G3D::Quat rotation
Definition: GameObjectData.h:706
uint32 animprogress
Definition: GameObjectData.h:709
float posX
Definition: GameObjectData.h:702
uint32 phaseMask
Definition: GameObjectData.h:701
float posY
Definition: GameObjectData.h:703
uint32 id
Definition: GameObjectData.h:699
GOState go_state
Definition: GameObjectData.h:710
time_t GetGORespawnTime(ObjectGuid::LowType dbGuid) const
Definition: Map.h:580

References GameObjectData::animprogress, GameObjectData::artKit, Create(), Map::GenerateLowGuid(), GameTime::GetGameTime(), GetGOInfo(), Map::GetGORespawnTime(), WorldObject::GetMap(), GO_FLAG_NODESPAWN, GameObjectData::go_state, GameObjectData::id, LOG_ERROR, m_goData, m_respawnDelayTime, m_respawnTime, m_spawnedByDefault, m_spawnId, GameObjectData::orientation, GameObjectData::phaseMask, GameObjectData::posX, GameObjectData::posY, GameObjectData::posZ, Map::RemoveGORespawnTime(), GameObjectData::rotation, SetGameObjectFlag(), sObjectMgr, and GameObjectData::spawntimesecs.

Referenced by ObjectMgr::AddGOData(), MotionTransport::CreateGOPassenger(), GameEventMgr::GameEventSpawn(), gobject_commandscript::HandleGameObjectAddCommand(), gobject_commandscript::HandleGameObjectMoveCommand(), gobject_commandscript::HandleGameObjectTurnCommand(), LoadFromDB(), and PoolGroup< T >::Spawn1Object().

◆ LookupFishingHoleAround()

GameObject * GameObject::LookupFishingHoleAround ( float  range)
1407{
1408 GameObject* ok = nullptr;
1409
1410 Acore::NearestGameObjectFishingHole u_check(*this, range);
1412
1413 Cell::VisitGridObjects(this, checker, range);
1414 return ok;
1415}
static void VisitGridObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:179
Definition: GridNotifiers.h:316
Definition: GridNotifiers.h:679

References Cell::VisitGridObjects().

Referenced by Use().

◆ ModifyHealth()

void GameObject::ModifyHealth ( int32  change,
Unit attackerOrHealer = nullptr,
uint32  spellId = 0 
)
Todo:
: is there any packet for healing?
2275{
2277 return;
2278
2279 if (!m_goValue.Building.MaxHealth || !change)
2280 return;
2281
2283 change = 0;
2284
2285 // prevent double destructions of the same object
2286 if (change < 0 && !m_goValue.Building.Health)
2287 return;
2288
2289 if (int32(m_goValue.Building.Health) + change <= 0)
2293 else
2294 m_goValue.Building.Health += change;
2295
2296 // Set the health bar, value = 255 * healthPct;
2298
2299 Player* player = attackerOrHealer->GetCharmerOrOwnerPlayerOrPlayerItself();
2300
2301 // dealing damage, send packet
2303 if (player)
2304 {
2305 WorldPacket data(SMSG_DESTRUCTIBLE_BUILDING_DAMAGE, 8 + 8 + 8 + 4 + 4);
2306 data << GetPackGUID();
2307 data << attackerOrHealer->GetPackGUID();
2308 data << player->GetPackGUID();
2309 data << uint32(-change); // change < 0 triggers SPELL_BUILDING_HEAL combat log event
2310 // change >= 0 triggers SPELL_BUILDING_DAMAGE event
2311 data << uint32(spellId);
2312 player->GetSession()->SendPacket(&data);
2313 }
2314
2316
2318 newState = GO_DESTRUCTIBLE_DESTROYED;
2319 else if (m_goValue.Building.Health <= GetGOInfo()->building.damagedNumHits)
2320 newState = GO_DESTRUCTIBLE_DAMAGED;
2322 newState = GO_DESTRUCTIBLE_INTACT;
2323
2324 if (newState == GetDestructibleState())
2325 return;
2326
2327 SetDestructibleState(newState, player, false);
2328}
GameObjectDestructibleState
Definition: SharedDefines.h:1598
@ SMSG_DESTRUCTIBLE_BUILDING_DAMAGE
Definition: Opcodes.h:80
void SetDestructibleState(GameObjectDestructibleState state, Player *eventInvoker=nullptr, bool setHealth=false)
Definition: GameObject.cpp:2330
GameObjectDestructibleState GetDestructibleState() const
Definition: GameObject.h:298
PackedGuid const & GetPackGUID() const
Definition: Object.h:108
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition: Unit.cpp:10576
Definition: WorldPacket.h:27
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition: WorldSession.cpp:207

References GameObjectValue::Building, GameObjectTemplate::damagedNumHits, Unit::GetCharmerOrOwnerPlayerOrPlayerItself(), GetDestructibleState(), GetGOInfo(), Object::GetPackGUID(), Player::GetSession(), GO_DESTRUCTIBLE_DAMAGED, GO_DESTRUCTIBLE_DESTROYED, GO_DESTRUCTIBLE_INTACT, GameObjectValue::Health, IsDestructibleBuilding(), m_allowModifyDestructibleBuilding, m_goValue, GameObjectValue::MaxHealth, WorldSession::SendPacket(), SetDestructibleState(), SetGoAnimProgress(), and SMSG_DESTRUCTIBLE_BUILDING_DAMAGE.

Referenced by Spell::EffectGameObjectDamage(), and Spell::EffectGameObjectRepair().

◆ Refresh()

void GameObject::Refresh ( )
915{
916 // not refresh despawned not casted GO (despawned casted GO destroyed in all cases anyway)
918 return;
919
920 if (isSpawned())
921 GetMap()->AddToMap(this);
922}

References Map::AddToMap(), WorldObject::GetMap(), isSpawned(), m_respawnTime, and m_spawnedByDefault.

Referenced by BattlegroundSA::ResetObjs().

◆ RemoveFromOwner()

void GameObject::RemoveFromOwner ( )
private
123{
124 ObjectGuid ownerGUID = GetOwnerGUID();
125 if (!ownerGUID)
126 return;
127
128 if (Unit* owner = ObjectAccessor::GetUnit(*this, ownerGUID))
129 {
130 owner->RemoveGameObject(this, false);
132 return;
133 }
134
135 LOG_DEBUG("entities.gameobject", "Delete GameObject ({} Entry: {} SpellId {} LinkedGO {}) that lost references to owner {} GO list.",
136 GetGUID().ToString(), GetGOInfo()->entry, m_spellId, GetGOInfo()->GetLinkedGameObjectEntry(), ownerGUID.ToString());
137
139}
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:171
void SetOwnerGUID(ObjectGuid owner)
Definition: GameObject.h:165
std::string ToString() const
Definition: ObjectGuid.cpp:47
std::string ToString() const
Definition: Position.cpp:51

References ASSERT, ObjectGuid::Empty, GetGOInfo(), Object::GetGUID(), GetOwnerGUID(), ObjectAccessor::GetUnit(), LOG_DEBUG, m_spellId, SetOwnerGUID(), ObjectGuid::ToString(), and Position::ToString().

Referenced by CleanupsBeforeDelete(), Delete(), RemoveFromWorld(), and Use().

◆ RemoveFromWorld()

void GameObject::RemoveFromWorld ( )
overridevirtual
  • Remove the gameobject from the accessor

Reimplemented from Object.

170{
172 if (IsInWorld())
173 {
174 sScriptMgr->OnGameObjectRemoveWorld(this);
175
176 if (m_zoneScript)
178
180
181 if (m_model)
182 if (GetMap()->ContainsGameObjectModel(*m_model))
184
185 if (Transport* transport = GetTransport())
186 transport->RemovePassenger(this, true);
187
188 // If linked trap exists, despawn it
189 if (GameObject* linkedTrap = GetLinkedTrap())
190 {
191 linkedTrap->Delete();
192 }
193
195
196 if (m_spawnId)
197 Acore::Containers::MultimapErasePair(GetMap()->GetGameObjectBySpawnIdStore(), m_spawnId, this);
199 }
200}
void MultimapErasePair(M< K, V, Rest... > &multimap, K const &key, V const &value)
Definition: Containers.h:228
bool Remove(KEY_TYPE const &handle)
Definition: TypeContainer.h:141
void RemoveFromWorld() override
Definition: Object.cpp:1182
void RemoveGameObjectModel(const GameObjectModel &model)
Definition: Map.h:558
virtual void OnGameObjectRemove(GameObject *)
Definition: ZoneScript.h:39

References Object::GetGUID(), GetLinkedTrap(), WorldObject::GetMap(), Map::GetObjectsStore(), WorldObject::GetTransport(), Object::IsInWorld(), m_model, m_spawnId, WorldObject::m_zoneScript, Acore::Containers::MultimapErasePair(), ZoneScript::OnGameObjectRemove(), TypeUnorderedMapContainer< OBJECT_TYPES, KEY_TYPE >::Remove(), RemoveFromOwner(), WorldObject::RemoveFromWorld(), Map::RemoveGameObjectModel(), and sScriptMgr.

Referenced by CleanupsBeforeDelete(), BattlegroundIC::PostUpdateImpl(), Map::RemoveFromMap(), Map::UnloadAll(), and go_bear_trap::go_bear_trapAI::UpdateAI().

◆ RemoveGameObjectFlag()

◆ RemoveLootMode()

void GameObject::RemoveLootMode ( uint16  lootMode)
inline
234{ m_LootMode &= ~lootMode; }

References m_LootMode.

◆ ReplaceAllDynamicFlags()

void GameObject::ReplaceAllDynamicFlags ( uint32  flag)
inlineoverridevirtual

Reimplemented from Object.

References GAMEOBJECT_DYNAMIC, and Object::SetUInt32Value().

◆ ReplaceAllGameObjectFlags()

◆ ResetDoorOrButton()

◆ ResetLootMode()

void GameObject::ResetLootMode ( )
inline
@ LOOT_MODE_DEFAULT
Definition: SharedDefines.h:42

References LOOT_MODE_DEFAULT, and m_LootMode.

Referenced by GameObject().

◆ Respawn()

◆ SaveInstanceData()

void GameObject::SaveInstanceData ( uint8  state)
2598{
2599 uint32 id = GetInstanceId();
2600 uint32 guid = GetSpawnId();
2601
2603 stmt->SetData(0, id);
2604 stmt->SetData(1, guid);
2605 stmt->SetData(2, state);
2606 CharacterDatabase.Execute(stmt);
2607
2608 sObjectMgr->NewInstanceSavedGameobjectState(id, guid, state);
2609}
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
@ CHAR_INSERT_INSTANCE_SAVED_DATA
Definition: CharacterDatabase.h:521

References CHAR_INSERT_INSTANCE_SAVED_DATA, CharacterDatabase, WorldObject::GetInstanceId(), GetSpawnId(), PreparedStatementBase::SetData(), and sObjectMgr.

Referenced by SavingStateOnDB(), and SetGoState().

◆ SaveRespawnTime() [1/2]

void GameObject::SaveRespawnTime ( )
inlineoverridevirtual

Reimplemented from WorldObject.

246{ SaveRespawnTime(0); }
void SaveRespawnTime() override
Definition: GameObject.h:246

References SaveRespawnTime().

Referenced by Map::RemoveFromMap(), SaveRespawnTime(), and Update().

◆ SaveRespawnTime() [2/2]

void GameObject::SaveRespawnTime ( uint32  forceDelay)
1242{
1243 if (m_goData && m_goData->dbData && (forceDelay || m_respawnTime > GameTime::GetGameTime().count()) && m_spawnedByDefault)
1244 {
1245 time_t respawnTime = forceDelay ? GameTime::GetGameTime().count() + forceDelay : m_respawnTime;
1246 GetMap()->SaveGORespawnTime(m_spawnId, respawnTime);
1247 }
1248}
bool dbData
Definition: GameObjectData.h:713
void SaveGORespawnTime(ObjectGuid::LowType dbGuid, time_t &respawnTime)
Definition: Map.cpp:3362

References GameObjectData::dbData, GameTime::GetGameTime(), WorldObject::GetMap(), m_goData, m_respawnTime, m_spawnedByDefault, m_spawnId, and Map::SaveGORespawnTime().

◆ SaveToDB() [1/2]

void GameObject::SaveToDB ( bool  saveAddon = false)
1040{
1041 // this should only be used when the gameobject has already been loaded
1042 // preferably after adding to map, because mapid may not be valid otherwise
1043 GameObjectData const* data = sObjectMgr->GetGameObjectData(m_spawnId);
1044 if (!data)
1045 {
1046 LOG_ERROR("entities.gameobject", "GameObject::SaveToDB failed, cannot get gameobject data!");
1047 return;
1048 }
1049
1050 SaveToDB(GetMapId(), data->spawnMask, data->phaseMask, saveAddon);
1051}
void SaveToDB(bool saveAddon=false)
Definition: GameObject.cpp:1039
uint8 spawnMask
Definition: GameObjectData.h:711
uint32 GetMapId() const
Definition: Position.h:276

References WorldLocation::GetMapId(), LOG_ERROR, m_spawnId, GameObjectData::phaseMask, SaveToDB(), sObjectMgr, and GameObjectData::spawnMask.

Referenced by SaveToDB().

◆ SaveToDB() [2/2]

void GameObject::SaveToDB ( uint32  mapid,
uint8  spawnMask,
uint32  phaseMask,
bool  saveAddon = false 
)
1054{
1055 const GameObjectTemplate* goI = GetGOInfo();
1056
1057 if (!goI)
1058 return;
1059
1060 if (!m_spawnId)
1061 m_spawnId = sObjectMgr->GenerateGameObjectSpawnId();
1062
1063 // update in loaded data (changing data only in this place)
1064 GameObjectData& data = sObjectMgr->NewGOData(m_spawnId);
1065
1066 data.id = GetEntry();
1067 data.mapid = mapid;
1068 data.phaseMask = phaseMask;
1069 data.posX = GetPositionX();
1070 data.posY = GetPositionY();
1071 data.posZ = GetPositionZ();
1072 data.orientation = GetOrientation();
1076 data.go_state = GetGoState();
1077 data.spawnMask = spawnMask;
1078 data.artKit = GetGoArtKit();
1079
1080 // Update in DB
1081 WorldDatabaseTransaction trans = WorldDatabase.BeginTransaction();
1082
1083 uint8 index = 0;
1084
1086 stmt->SetData(0, m_spawnId);
1087 trans->Append(stmt);
1088
1089 stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_GAMEOBJECT);
1090 stmt->SetData(index++, m_spawnId);
1091 stmt->SetData(index++, GetEntry());
1092 stmt->SetData(index++, uint16(mapid));
1093 stmt->SetData(index++, spawnMask);
1094 stmt->SetData(index++, GetPhaseMask());
1095 stmt->SetData(index++, GetPositionX());
1096 stmt->SetData(index++, GetPositionY());
1097 stmt->SetData(index++, GetPositionZ());
1098 stmt->SetData(index++, GetOrientation());
1099 stmt->SetData(index++, m_localRotation.x);
1100 stmt->SetData(index++, m_localRotation.y);
1101 stmt->SetData(index++, m_localRotation.z);
1102 stmt->SetData(index++, m_localRotation.w);
1103 stmt->SetData(index++, int32(m_respawnDelayTime));
1104 stmt->SetData(index++, GetGoAnimProgress());
1105 stmt->SetData(index++, uint8(GetGoState()));
1106 trans->Append(stmt);
1107
1108 if (saveAddon && !sObjectMgr->GetGameObjectAddon(m_spawnId))
1109 {
1110 index = 0;
1111 stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_GAMEOBJECT_ADDON);
1112 stmt->SetData(index++, m_spawnId);
1113 trans->Append(stmt);
1114 }
1115
1116 WorldDatabase.CommitTransaction(trans);
1117 sScriptMgr->OnGameObjectSaveToDB(this);
1118}
SQLTransaction< WorldDatabaseConnection > WorldDatabaseTransaction
Definition: DatabaseEnvFwd.h:72
@ WORLD_INS_GAMEOBJECT
Definition: WorldDatabase.h:95
@ WORLD_INS_GAMEOBJECT_ADDON
Definition: WorldDatabase.h:102
uint8 GetGoAnimProgress() const
Definition: GameObject.h:211
uint8 GetGoArtKit() const
Definition: GameObject.h:209
uint16 mapid
Definition: GameObjectData.h:700

References GameObjectData::animprogress, GameObjectData::artKit, Object::GetEntry(), GetGoAnimProgress(), GetGoArtKit(), GetGOInfo(), GetGoState(), Position::GetOrientation(), WorldObject::GetPhaseMask(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GameObjectData::go_state, GameObjectData::id, m_localRotation, m_respawnDelayTime, m_spawnedByDefault, m_spawnId, GameObjectData::mapid, GameObjectData::orientation, GameObjectData::phaseMask, GameObjectData::posX, GameObjectData::posY, GameObjectData::posZ, GameObjectData::rotation, PreparedStatementBase::SetData(), sObjectMgr, GameObjectData::spawnMask, GameObjectData::spawntimesecs, sScriptMgr, WORLD_DEL_GAMEOBJECT, WORLD_INS_GAMEOBJECT, WORLD_INS_GAMEOBJECT_ADDON, and WorldDatabase.

◆ SavingStateOnDB()

void GameObject::SavingStateOnDB ( )
2586{
2588 {
2589 GOState param = GetGoState();
2591 {
2593 }
2594 }
2595}
uint8 GameobjectStateToInt(GOState *state)
Definition: GameObject.cpp:2545
void SaveInstanceData(uint8 state)
Definition: GameObject.cpp:2597
bool FindStateSavedOnInstance()
Definition: GameObject.cpp:2630

References FindStateSavedOnInstance(), GameobjectStateToInt(), GetGoState(), IsInstanceGameobject(), and SaveInstanceData().

Referenced by UpdateSaveToDb().

◆ SendCustomAnim()

void GameObject::SendCustomAnim ( uint32  anim)
2139{
2141 data << GetGUID();
2142 data << uint32(anim);
2143 SendMessageToSet(&data, true);
2144}
@ SMSG_GAMEOBJECT_CUSTOM_ANIM
Definition: Opcodes.h:209
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition: Object.h:482

References Object::GetGUID(), WorldObject::SendMessageToSet(), and SMSG_GAMEOBJECT_CUSTOM_ANIM.

Referenced by Spell::EffectActivateObject(), Spell::EffectDummy(), go_gong_of_bethekk::OnGossipHello(), brann_bronzebeard::brann_bronzebeardAI::SwitchHeadVisaul(), Update(), go_suppression_device::go_suppression_deviceAI::UpdateAI(), and Use().

◆ SendMessageToSetInRange()

void GameObject::SendMessageToSetInRange ( WorldPacket const *  data,
float  dist,
bool  ,
bool  includeMargin = false,
Player const *  skipped_rcvr = nullptr 
) const
overridevirtual

Reimplemented from WorldObject.

2174{
2175 dist += GetObjectSize();
2176 if (includeMargin)
2177 dist += VISIBILITY_COMPENSATION * 2.0f; // pussywizard: to ensure everyone receives all important packets
2178 Acore::MessageDistDeliverer notifier(this, data, dist, false, skipped_rcvr);
2179 Cell::VisitWorldObjects(this, notifier, dist);
2180}
#define VISIBILITY_COMPENSATION
Definition: ObjectDefines.h:26
float GetObjectSize() const
Definition: Object.cpp:2734
static void VisitWorldObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:193
Definition: GridNotifiers.h:98

References WorldObject::GetObjectSize(), VISIBILITY_COMPENSATION, and Cell::VisitWorldObjects().

◆ SetDestructibleBuildingModifyState()

void GameObject::SetDestructibleBuildingModifyState ( bool  allow)
inline

◆ SetDestructibleState()

void GameObject::SetDestructibleState ( GameObjectDestructibleState  state,
Player eventInvoker = nullptr,
bool  setHealth = false 
)
2331{
2332 // the user calling this must know he is already operating on destructible gameobject
2334
2335 switch (state)
2336 {
2340 if (setHealth)
2341 {
2343 SetGoAnimProgress(255);
2344 }
2345 EnableCollision(true);
2346 break;
2348 {
2350
2351 sScriptMgr->OnGameObjectDamaged(this, eventInvoker);
2352
2353 if (BattlegroundMap* bgMap = GetMap()->ToBattlegroundMap())
2354 if (Battleground* bg = bgMap->GetBG())
2355 bg->EventPlayerDamagedGO(eventInvoker, this, m_goInfo->building.damagedEvent);
2356
2359
2362 if (modelData->DamagedDisplayId)
2363 modelId = modelData->DamagedDisplayId;
2364 SetDisplayId(modelId);
2365
2366 if (setHealth)
2367 {
2369 uint32 maxHealth = m_goValue.Building.MaxHealth;
2370 // in this case current health is 0 anyway so just prevent crashing here
2371 if (!maxHealth)
2372 maxHealth = 1;
2373 SetGoAnimProgress(m_goValue.Building.Health * 255 / maxHealth);
2374 }
2375 break;
2376 }
2378 {
2379 sScriptMgr->OnGameObjectDestroyed(this, eventInvoker);
2380
2382
2383 if (BattlegroundMap* bgMap = GetMap()->ToBattlegroundMap())
2384 {
2385 if (Battleground* bg = bgMap->GetBG())
2386 {
2387 bg->EventPlayerDamagedGO(eventInvoker, this, m_goInfo->building.destroyedEvent);
2388 bg->DestroyGate(eventInvoker, this);
2389 }
2390 }
2391
2394
2397 if (modelData->DestroyedDisplayId)
2398 modelId = modelData->DestroyedDisplayId;
2399 SetDisplayId(modelId);
2400
2401 if (setHealth)
2402 {
2405 }
2406 EnableCollision(false);
2407 break;
2408 }
2410 {
2413
2414 uint32 modelId = m_goInfo->displayId;
2416 if (modelData->RebuildingDisplayId)
2417 modelId = modelData->RebuildingDisplayId;
2418 SetDisplayId(modelId);
2419
2420 // restores to full health
2421 if (setHealth)
2422 {
2424 SetGoAnimProgress(255);
2425 }
2426 EnableCollision(true);
2427 break;
2428 }
2429 }
2430}
DBCStorage< DestructibleModelDataEntry > sDestructibleModelDataStore(DestructibleModelDatafmt)
@ GO_DESTRUCTIBLE_REBUILDING
Definition: SharedDefines.h:1602
void RemoveGameObjectFlag(GameObjectFlags flags)
Definition: GameObject.h:221
void EventInform(uint32 eventId)
Definition: GameObject.cpp:2182
uint32 destructibleData
Definition: GameObjectData.h:370
uint32 rebuildingEvent
Definition: GameObjectData.h:371
uint32 destroyedEvent
Definition: GameObjectData.h:366
uint32 damagedDisplayId
Definition: GameObjectData.h:356
uint32 destroyedDisplayId
Definition: GameObjectData.h:362
uint32 damagedEvent
Definition: GameObjectData.h:361
Definition: Map.h:847
Definition: DBCStructure.h:834

References ASSERT, GameObjectValue::Building, GameObjectTemplate::building, GameObjectTemplate::damagedDisplayId, GameObjectTemplate::damagedEvent, GameObjectTemplate::damagedNumHits, GameObjectTemplate::destroyedDisplayId, GameObjectTemplate::destroyedEvent, GameObjectTemplate::destructibleData, GameObjectTemplate::displayId, EnableCollision(), EventInform(), GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING, GetGoType(), WorldObject::GetMap(), GO_DESTRUCTIBLE_DAMAGED, GO_DESTRUCTIBLE_DESTROYED, GO_DESTRUCTIBLE_INTACT, GO_DESTRUCTIBLE_REBUILDING, GO_FLAG_DAMAGED, GO_FLAG_DESTROYED, GameObjectValue::Health, m_goInfo, m_goValue, GameObjectValue::MaxHealth, GameObjectTemplate::rebuildingEvent, RemoveGameObjectFlag(), sDestructibleModelDataStore, SetDisplayId(), SetGameObjectFlag(), SetGoAnimProgress(), and sScriptMgr.

Referenced by Spell::EffectGameObjectSetDestructionState(), BfWGGameObjectBuilding::Init(), ModifyHealth(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::OnGameObjectCreate(), FrozenThroneResetWorker::operator()(), BattlegroundIC::PostUpdateImpl(), and BfWGGameObjectBuilding::Rebuild().

◆ SetDisplayId()

void GameObject::SetDisplayId ( uint32  displayid)

◆ SetGameObjectFlag()

void GameObject::SetGameObjectFlag ( GameObjectFlags  flags)
inline
220{ SetFlag(GAMEOBJECT_FLAGS, flags); }
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:845

References GAMEOBJECT_FLAGS, and Object::SetFlag().

Referenced by go_suppression_device::go_suppression_deviceAI::Deactivate(), go_chromaggus_lever::go_chromaggus_leverAI::GossipHello(), go_gilded_brazier::go_gilded_brazierAI::GossipHello(), go_celestial_planetarium_access::go_celestial_planetarium_accessAI::GossipHello(), LoadGameObjectFromDB(), BattlefieldWG::OnBattleStart(), instance_uldaman::instance_uldaman_InstanceMapScript::OnGameObjectCreate(), instance_blackfathom_deeps::instance_blackfathom_deeps_InstanceMapScript::OnGameObjectCreate(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::OnGameObjectCreate(), instance_razorfen_downs::instance_razorfen_downs_InstanceMapScript::OnGameObjectCreate(), instance_ulduar::instance_ulduar_InstanceMapScript::OnGameObjectCreate(), instance_karazhan::instance_karazhan_InstanceMapScript::OnGameObjectCreate(), instance_zulgurub::instance_zulgurub_InstanceMapScript::OnGameObjectCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnGameObjectCreate(), instance_violet_hold::instance_violet_hold_InstanceMapScript::OnGameObjectCreate(), instance_ahnkahet::instance_ahnkahet_InstanceScript::OnGameObjectCreate(), go_gong_of_bethekk::OnGossipHello(), go_elune_fire::OnGossipHello(), go_palehoof_sphere::OnGossipHello(), go_main_chambers_access_panel::OnGossipHello(), go_prince_taldaram_sphere::OnGossipHello(), SetDestructibleState(), SwitchDoorOrButton(), and Use().

◆ SetGoAnimProgress()

void GameObject::SetGoAnimProgress ( uint8  animprogress)
inline
212{ SetByteValue(GAMEOBJECT_BYTES_1, 3, animprogress); }
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition: Object.cpp:750

References GAMEOBJECT_BYTES_1, and Object::SetByteValue().

Referenced by Create(), StaticTransport::Create(), MotionTransport::CreateMoTrans(), ModifyHealth(), and SetDestructibleState().

◆ SetGoArtKit() [1/2]

void GameObject::SetGoArtKit ( uint8  artkit)
1442{
1444 GameObjectData* data = const_cast<GameObjectData*>(sObjectMgr->GetGameObjectData(m_spawnId));
1445 if (data)
1446 data->artKit = kit;
1447}

References GameObjectData::artKit, GAMEOBJECT_BYTES_1, m_spawnId, Object::SetByteValue(), and sObjectMgr.

Referenced by Create(), StaticTransport::Create(), Spell::EffectActivateObject(), and SetGoArtKit().

◆ SetGoArtKit() [2/2]

void GameObject::SetGoArtKit ( uint8  artkit,
GameObject go,
ObjectGuid::LowType  lowguid = 0 
)
static
1450{
1451 const GameObjectData* data = nullptr;
1452 if (go)
1453 {
1454 go->SetGoArtKit(artkit);
1455 data = go->GetGameObjectData();
1456 }
1457 else if (lowguid)
1458 data = sObjectMgr->GetGameObjectData(lowguid);
1459
1460 if (data)
1461 const_cast<GameObjectData*>(data)->artKit = artkit;
1462}

References GetGameObjectData(), SetGoArtKit(), and sObjectMgr.

◆ SetGoState()

void GameObject::SetGoState ( GOState  state)
2468{
2470
2471 sScriptMgr->OnGameObjectStateChanged(this, state);
2472
2473 if (m_model)
2474 {
2475 if (!IsInWorld())
2476 return;
2477
2478 // pussywizard: this startOpen is unneeded here, collision depends entirely on current GOState
2480 // pussywizard: commented out everything below
2481
2482 // startOpen determines whether we are going to add or remove the LoS on activation
2483 /*bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false);
2484
2485 if (GetGameObjectData() && GetGameObjectData()->go_state == GO_STATE_READY)
2486 startOpen = !startOpen;
2487
2488 if (state == GO_STATE_ACTIVE || state == GO_STATE_ACTIVE_ALTERNATIVE)
2489 EnableCollision(startOpen);
2490 else if (state == GO_STATE_READY)
2491 EnableCollision(!startOpen);*/
2492 }
2493 /* Whenever a gameobject inside an instance changes
2494 * save it's state on the database to be loaded properly
2495 * on server restart or crash.
2496 */
2498 {
2499 // Save the gameobject state on the Database
2501 {
2503 }
2504 else
2505 {
2507 }
2508 }
2509}
void UpdateInstanceData(uint8 state)
Definition: GameObject.cpp:2611
bool IsAbleToSaveOnDb()
Definition: GameObject.cpp:2570

References EnableCollision(), FindStateSavedOnInstance(), GAMEOBJECT_BYTES_1, GameobjectStateToInt(), GO_STATE_READY, IsAbleToSaveOnDb(), IsInstanceGameobject(), Object::IsInWorld(), IsTransport(), m_model, SaveInstanceData(), Object::SetByteValue(), sScriptMgr, and UpdateInstanceData().

Referenced by go_suppression_device::go_suppression_deviceAI::Activate(), boss_thorim::boss_thorimAI::CloseDoors(), Create(), StaticTransport::Create(), MotionTransport::CreateMoTrans(), boss_thorim::boss_thorimAI::DamageTaken(), go_suppression_device::go_suppression_deviceAI::Deactivate(), Delete(), DespawnOrUnsummon(), go_chromaggus_lever::go_chromaggus_leverAI::GossipHello(), InstanceScript::HandleGameObject(), instance_deadmines::instance_deadmines_InstanceMapScript::OnGameObjectCreate(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnGameObjectCreate(), instance_blackfathom_deeps::instance_blackfathom_deeps_InstanceMapScript::OnGameObjectCreate(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::OnGameObjectCreate(), instance_dire_maul::instance_dire_maul_InstanceMapScript::OnGameObjectCreate(), instance_gundrak::instance_gundrak_InstanceMapScript::OnGameObjectCreate(), instance_ulduar::instance_ulduar_InstanceMapScript::OnGameObjectCreate(), instance_karazhan::instance_karazhan_InstanceMapScript::OnGameObjectCreate(), instance_stratholme::instance_stratholme_InstanceMapScript::OnGameObjectCreate(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::OnGameObjectCreate(), instance_pit_of_saron::instance_pit_of_saron_InstanceScript::OnGameObjectCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnGameObjectCreate(), instance_halls_of_stone::instance_halls_of_stone_InstanceMapScript::OnGameObjectCreate(), instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript::OnGameObjectCreate(), instance_ahnkahet::instance_ahnkahet_InstanceScript::OnGameObjectCreate(), instance_naxxramas::instance_naxxramas_InstanceMapScript::OnGameObjectCreate(), instance_halls_of_lightning::instance_halls_of_lightning_InstanceMapScript::OnGameObjectCreate(), go_palehoof_sphere::OnGossipHello(), go_bristlelimb_cage::OnGossipHello(), go_corkis_prison::OnGossipHello(), go_prince_taldaram_sphere::OnGossipHello(), instance_ulduar::instance_ulduar_InstanceMapScript::OpenIfDone(), FrozenThroneResetWorker::operator()(), BattlegroundIC::StartingEventOpenDoors(), SwitchDoorOrButton(), brann_bronzebeard::brann_bronzebeardAI::SwitchHeadVisaul(), boss_flame_leviathan::boss_flame_leviathanAI::TurnGates(), MotionTransport::Update(), Update(), InstanceScript::UpdateDoorState(), BattlegroundRV::UpdatePillars(), and Use().

◆ SetGoType()

void GameObject::SetGoType ( GameobjectTypes  type)
inline

◆ SetLinkedTrap()

void GameObject::SetLinkedTrap ( GameObject linkedTrap)
inline
263{ m_linkedTrap = linkedTrap->GetGUID(); }

References Object::GetGUID(), and m_linkedTrap.

Referenced by Create().

◆ SetLocalRotation()

void GameObject::SetLocalRotation ( G3D::Quat const &  rot)
2231{
2232 G3D::Quat rotation;
2233 // Temporary solution for gameobjects that have no rotation data in DB:
2234 if (G3D::fuzzyEq(rot.z, 0.f) && G3D::fuzzyEq(rot.w, 0.f))
2235 rotation = G3D::Quat::fromAxisAngleRotation(G3D::Vector3::unitZ(), GetOrientation());
2236 else
2237 rotation = rot;
2238
2239 rotation.unitize();
2240 m_localRotation = rotation;
2242}
void UpdatePackedRotation()
Definition: GameObject.cpp:2217

References Position::GetOrientation(), m_localRotation, and UpdatePackedRotation().

Referenced by Create(), MotionTransport::CreateMoTrans(), and SetLocalRotationAngles().

◆ SetLocalRotationAngles()

void GameObject::SetLocalRotationAngles ( float  z_rot,
float  y_rot,
float  x_rot 
)
2253{
2254 SetLocalRotation(G3D::Quat(G3D::Matrix3::fromEulerAnglesZYX(z_rot, y_rot, x_rot)));
2255}

References SetLocalRotation().

Referenced by Create(), and StaticTransport::Create().

◆ SetLootGenerationTime()

void GameObject::SetLootGenerationTime ( )
2978{
2980}

References GameTime::GetGameTime(), and m_lootGenerationTime.

Referenced by Player::SendLoot().

◆ SetLootMode()

void GameObject::SetLootMode ( uint16  lootMode)
inline

◆ SetLootRecipient() [1/2]

void GameObject::SetLootRecipient ( Creature creature)
2692{
2693 // set the player whose group should receive the right
2694 // to loot the creature after it dies
2695 // should be set to nullptr after the loot disappears
2696 if (!creature)
2697 {
2701 return;
2702 }
2703
2707}
ObjectGuid GetLootRecipientGUID() const
Definition: Creature.h:219
ObjectGuid::LowType GetLootRecipientGroupGUID() const
Definition: Creature.h:221
void ResetAllowedLooters()
Definition: Object.cpp:3126
void SetAllowedLooters(GuidUnorderedSet const looters)
Definition: Object.cpp:3121
GuidUnorderedSet const & GetAllowedLooters() const
Definition: Object.cpp:3141
void Clear()
Definition: ObjectGuid.h:140

References ObjectGuid::Clear(), WorldObject::GetAllowedLooters(), Creature::GetLootRecipientGroupGUID(), Creature::GetLootRecipientGUID(), m_lootRecipient, m_lootRecipientGroup, WorldObject::ResetAllowedLooters(), and WorldObject::SetAllowedLooters().

Referenced by boss_thorim::boss_thorimAI::DamageTaken(), and instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnGameObjectCreate().

◆ SetLootRecipient() [2/2]

void GameObject::SetLootRecipient ( Map map)
2710{
2711 Group* group = nullptr;
2712 Map::PlayerList const& PlayerList = map->GetPlayers();
2713 for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
2714 {
2715 if (Player* groupMember = i->GetSource())
2716 {
2717 if (groupMember->IsGameMaster() || groupMember->IsSpectator())
2718 {
2719 continue;
2720 }
2721
2722 if (!m_lootRecipient)
2723 {
2724 m_lootRecipient = groupMember->GetGUID();
2725 }
2726
2727 Group* memberGroup = groupMember->GetGroup();
2728 if (memberGroup && !group)
2729 {
2730 group = memberGroup;
2732 }
2733
2734 if (memberGroup == group)
2735 {
2736 AddAllowedLooter(groupMember->GetGUID());
2737 }
2738 }
2739 }
2740
2741 if (!group)
2742 {
2744 }
2745}
Definition: LinkedList.h:139
void AddAllowedLooter(ObjectGuid guid)
Definition: Object.cpp:3116
LowType GetCounter() const
Definition: ObjectGuid.h:147
ObjectGuid GetGUID() const
Definition: Group.cpp:2245
PlayerList const & GetPlayers() const
Definition: Map.h:484
Definition: MapRefMgr.h:26
iterator begin()
Definition: MapRefMgr.h:36
iterator end()
Definition: MapRefMgr.h:37

References WorldObject::AddAllowedLooter(), MapRefMgr::begin(), MapRefMgr::end(), ObjectGuid::GetCounter(), Group::GetGUID(), Map::GetPlayers(), m_lootRecipient, and m_lootRecipientGroup.

◆ SetLootState()

void GameObject::SetLootState ( LootState  s,
Unit unit = nullptr 
)
2433{
2434 m_lootState = state;
2435
2436 if (unit)
2437 _lootStateUnitGUID = unit->GetGUID();
2438 else
2440
2441 AI()->OnStateChanged(state, unit);
2442 sScriptMgr->OnGameObjectLootStateChanged(this, state, unit);
2443
2444 // Start restock timer if the chest is partially looted or not looted at all
2445 if (GetGoType() == GAMEOBJECT_TYPE_CHEST && state == GO_ACTIVATED && GetGOInfo()->chest.chestRestockTime > 0 && m_restockTime == 0s)
2446 {
2448 }
2449
2450 // pussywizard: lootState has nothing to do with collision, it depends entirely on GOState. Loot state is for timed close/open door and respawning, which then sets GOState
2451 /*if (m_model)
2452 {
2453 // startOpen determines whether we are going to add or remove the LoS on activation
2454 bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false);
2455
2456 // Use the current go state
2457 if (GetGoState() == GO_STATE_ACTIVE)
2458 startOpen = !startOpen;
2459
2460 if (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED)
2461 EnableCollision(startOpen);
2462 else if (state == GO_READY)
2463 EnableCollision(!startOpen);
2464 }*/
2465}
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:30
@ GO_ACTIVATED
Definition: GameObject.h:114
virtual void OnStateChanged(uint32, Unit *)
Definition: GameObjectAI.h:65
ObjectGuid _lootStateUnitGUID
Definition: GameObject.h:414
uint32 chestRestockTime
Definition: GameObjectData.h:86

References _lootStateUnitGUID, AI(), GameObjectTemplate::chestRestockTime, ObjectGuid::Clear(), GAMEOBJECT_TYPE_CHEST, GameTime::GetGameTime(), GetGOInfo(), GetGoType(), Object::GetGUID(), GO_ACTIVATED, m_lootState, m_restockTime, GameObjectAI::OnStateChanged(), and sScriptMgr.

Referenced by go_suppression_device::go_suppression_deviceAI::Activate(), Delete(), DespawnOrUnsummon(), WorldSession::DoLootRelease(), Spell::EffectOpenLock(), spell_q9452_cast_net::HandleActiveObject(), spell_q10612_10613_the_fel_and_the_furious::spell_q10612_10613_the_fel_and_the_furious_SpellScript::HandleScriptEffect(), instance_ulduar::instance_ulduar_InstanceMapScript::OnGameObjectCreate(), instance_oculus::instance_oculus_InstanceMapScript::OnGameObjectCreate(), go_massive_seaforium_charge::OnGossipHello(), go_ulduar_working_harpoon::OnGossipHello(), go_suppression_device::OnLootStateChanged(), SmartScript::ProcessAction(), go_direbrew_mole_machine::go_direbrew_mole_machineAI::Reset(), ResetDoorOrButton(), Map::ScriptsProcess(), Player::SendLoot(), boss_flame_leviathan::boss_flame_leviathanAI::TurnHealStations(), Update(), Use(), and UseDoorOrButton().

◆ SetOwnerGUID()

void GameObject::SetOwnerGUID ( ObjectGuid  owner)
inline
166 {
167 // Owner already found and different than expected owner - remove object from old owner
168 if (owner && GetOwnerGUID() && GetOwnerGUID() != owner)
169 {
170 ABORT();
171 }
172 m_spawnedByDefault = false; // all object with owner is despawned after delay
174 }
#define ABORT
Definition: Errors.h:76
void SetGuidValue(uint16 index, ObjectGuid value)
Definition: Object.cpp:723

References ABORT, GetOwnerGUID(), m_spawnedByDefault, OBJECT_FIELD_CREATED_BY, and Object::SetGuidValue().

Referenced by Unit::AddGameObject(), Spell::EffectTransmitted(), Unit::RemoveAllGameObjects(), RemoveFromOwner(), Unit::RemoveGameObject(), and Use().

◆ SetPhaseMask()

void GameObject::SetPhaseMask ( uint32  newPhaseMask,
bool  update 
)
overridevirtual

Reimplemented from WorldObject.

2642{
2643 WorldObject::SetPhaseMask(newPhaseMask, update);
2644
2645 if (m_model && m_model->isEnabled())
2646 EnableCollision(true);
2647}
bool isEnabled() const
Definition: GameObjectModel.h:69
virtual void SetPhaseMask(uint32 newPhaseMask, bool update)
Definition: Object.cpp:2836

References EnableCollision(), GameObjectModel::isEnabled(), m_model, and WorldObject::SetPhaseMask().

Referenced by Create(), StaticTransport::Create(), instance_blackwing_lair::instance_blackwing_lair_InstanceMapScript::OnGameObjectCreate(), and instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnGameObjectCreate().

◆ SetPosition() [1/2]

void GameObject::SetPosition ( const Position pos)
inline
320{ SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); }
void SetPosition(float x, float y, float z, float o)
Definition: GameObject.cpp:2907

References Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), and SetPosition().

Referenced by SetPosition().

◆ SetPosition() [2/2]

void GameObject::SetPosition ( float  x,
float  y,
float  z,
float  o 
)
2908{
2909 // pussywizard: do not call for MotionTransport and other gobjects not in grid
2910
2911 if (!Acore::IsValidMapCoord(x, y, z, o))
2912 return;
2913
2914 GetMap()->GameObjectRelocation(this, x, y, z, o);
2915}
bool IsValidMapCoord(float c)
Definition: GridDefines.h:216
void GameObjectRelocation(GameObject *go, float x, float y, float z, float o)
Definition: Map.cpp:1047

References Map::GameObjectRelocation(), WorldObject::GetMap(), and Acore::IsValidMapCoord().

Referenced by instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnGameObjectCreate().

◆ SetRespawnDelay()

void GameObject::SetRespawnDelay ( int32  respawn)
1312{
1313 m_respawnDelayTime = respawn > 0 ? respawn : 0;
1314}

References m_respawnDelayTime.

Referenced by SetRespawnTime().

◆ SetRespawnTime()

◆ SetSpawnedByDefault()

void GameObject::SetSpawnedByDefault ( bool  b)
inline

◆ SetSpellId()

void GameObject::SetSpellId ( uint32  id)
inline

◆ SetTransportPathRotation()

void GameObject::SetTransportPathRotation ( float  qx,
float  qy,
float  qz,
float  qw 
)
2245{
2250}
@ GAMEOBJECT_PARENTROTATION
Definition: UpdateFields.h:400
void SetFloatValue(uint16 index, float value)
Definition: Object.cpp:737

References GAMEOBJECT_PARENTROTATION, and Object::SetFloatValue().

Referenced by Create(), StaticTransport::Create(), MotionTransport::CreateMoTrans(), and BattlegroundSA::ResetObjs().

◆ SwitchDoorOrButton()

void GameObject::SwitchDoorOrButton ( bool  activate,
bool  alternative = false 
)
private
1465{
1466 if (activate)
1468 else
1470
1471 if (GetGoState() == GO_STATE_READY) //if closed -> open
1473 else //if open -> close
1475}
@ GO_FLAG_IN_USE
Definition: SharedDefines.h:1575

References GetGoState(), GO_FLAG_IN_USE, GO_STATE_ACTIVE, GO_STATE_ACTIVE_ALTERNATIVE, GO_STATE_READY, RemoveGameObjectFlag(), SetGameObjectFlag(), and SetGoState().

Referenced by Create(), ResetDoorOrButton(), and UseDoorOrButton().

◆ ToMotionTransport() [1/2]

◆ ToMotionTransport() [2/2]

MotionTransport const * GameObject::ToMotionTransport ( ) const
inline
332{ if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT) return reinterpret_cast<MotionTransport const*>(this); else return nullptr; }

References GAMEOBJECT_TYPE_MO_TRANSPORT, and GetGOInfo().

◆ ToStaticTransport() [1/2]

◆ ToStaticTransport() [2/2]

StaticTransport const * GameObject::ToStaticTransport ( ) const
inline
329{ if (GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<StaticTransport const*>(this); else return nullptr; }

References GAMEOBJECT_TYPE_TRANSPORT, and GetGOInfo().

◆ ToTransport() [1/2]

◆ ToTransport() [2/2]

Transport const * GameObject::ToTransport ( ) const