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 UpdatableMapObject Object WorldLocation Position Transport MotionTransport StaticTransport

Public Member Functions

 GameObject ()
 
 ~GameObject () override
 
void BuildValuesUpdate (uint8 updateType, ByteBuffer *data, Player *target) 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 SetWorldRotationAngles (float z_rot, float y_rot, float x_rot)
 
void SetWorldRotation (G3D::Quat const &rot)
 
void SetTransportPathRotation (float qx, float qy, float qz, float qw)
 
G3D::Quat const & GetWorldRotation () const
 
int64 GetPackedWorldRotation () const
 
G3D::Quat GetFinalWorldRotation () 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)
 
virtual bool LoadFromDB (ObjectGuid::LowType guid, Map *map)
 
virtual bool LoadGameObjectFromDB (ObjectGuid::LowType guid, Map *map, bool addToMap=true)
 
bool IsRespawnCompatibilityMode () const
 
void DeleteFromDB ()
 
void SetOwnerGUID (ObjectGuid owner)
 
ObjectGuid GetOwnerGUID () const override
 
uint32 GetFaction () const override
 
Unit * GetOwner () 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 *fishLoot, Player *lootOwner, bool junk=false)
 
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 const &playerGuid)
 
bool IsInSkillupList (ObjectGuid const &playerGuid) const
 
void AddUniqueUse (Player *player)
 
void AddUse ()
 
uint32 GetUseCount () const
 
uint32 GetUniqueUseCount () const
 
void SaveRespawnTime () override
 
void SaveRespawnTime (uint32 forceDelay)
 
Player * GetLootRecipient () const
 
ObjectGuid GetLootRecipientGUID () const
 
Group * GetLootRecipientGroup () const
 
ObjectGuid::LowType GetLootRecipientGroupGUID () const
 
void SetLootRecipient (Creature *creature)
 
void SetLootRecipient (Map *map)
 
bool IsLootAllowedFor (Player const *player) const
 
bool HasLootRecipient () const
 
void SetLootGenerationTime ()
 
uint32 GetLootGenerationTime () const
 
GameObject * GetLinkedTrap ()
 
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
 
GameObject * LookupFishingHoleAround (float range)
 
void CastSpell (Unit *target, uint32 spellId)
 
void SendCustomAnim (uint32 anim)
 
bool IsInRange2d (float x, float y, float radius) const
 
bool IsInRange3d (float x, float y, float z, float radius) const
 
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
 
GameObjectAI * AI () 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 (Position const &pos)
 
bool IsStaticTransport () const
 
bool IsMotionTransport () const
 
Transport * ToTransport ()
 
Transport const * ToTransport () const
 
StaticTransport * ToStaticTransport ()
 
StaticTransport const * ToStaticTransport () const
 
MotionTransport * ToMotionTransport ()
 
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
 
bool ValidateGameobjectType () const
 
bool IsInstanceGameobject () const
 
uint8 GameobjectStateToInt (GOState *state) const
 
bool IsAllowedToSaveToDB () const
 
void AllowSaveToDB (bool enable)
 
void SaveStateToDB ()
 
std::string GetDebugInfo () const override
 
bool IsUpdateNeeded () override
 
SpellCastResult CastSpell (CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={})
 
SpellCastResult CastSpell (CastSpellTargetArg const &targets, SpellInfo const *info, CastSpellExtraArgs const &args={})
 
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
 
- Public Member Functions inherited from WorldObject
 ~WorldObject () override
 
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 (Position const &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
 
Position GetRandomPoint (Position const &srcPos, float distance) const
 
uint32 GetInstanceId () const
 
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
 
InstanceScript * GetInstanceScript () const
 
std::string const & GetName () const
 
void SetName (std::string const &newname)
 
float GetDistance (WorldObject const *obj) const
 
float GetDistance (Position const &pos) const
 
float GetDistance (float x, float y, float z) const
 
float GetDistance2d (WorldObject const *obj) const
 
float GetDistance2d (float x, float y) const
 
float GetDistanceZ (WorldObject const *obj) const
 
bool IsSelfOrInSameMap (WorldObject const *obj) const
 
bool IsInMap (WorldObject const *obj) const
 
bool IsWithinDist3d (float x, float y, float z, float dist) const
 
bool IsWithinDist3d (Position const *pos, float dist) const
 
bool IsWithinDist2d (float x, float y, float dist) const
 
bool IsWithinDist2d (Position const *pos, float dist) const
 
bool IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
 
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
 
bool IsWithinLOS (float x, float y, float z, 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 SendMessageToSet (WorldPacket const *data, bool self) const
 
virtual void SendMessageToSetInRange (WorldPacket const *data, float dist, bool self) const
 
virtual void SendMessageToSet (WorldPacket const *data, Player const *skipped_rcvr) const
 
void PlayDistanceSound (uint32 sound_id, Player *target=nullptr)
 
void PlayDirectSound (uint32 sound_id, Player *target=nullptr)
 
void PlayRadiusSound (uint32 sound_id, float radius)
 
void PlayDirectMusic (uint32 music_id, Player *target=nullptr)
 
void PlayRadiusMusic (uint32 music_id, float radius)
 
template<typename Worker >
void DoForAllVisiblePlayers (Worker &&worker)
 
template<typename Worker >
void DoForAllVisibleWorldObjects (Worker &&worker)
 
void DestroyForVisiblePlayers ()
 
void SendObjectDeSpawnAnim (ObjectGuid guid)
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
virtual float GetSightRange (WorldObject const *target=nullptr) const
 
float GetLeewayBonusRange (Unit const *target) const
 
float GetLeewayBonusRadius () 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 ()
 
Map * GetMap () const
 
Map * FindMap () const
 
void SetZoneScript ()
 
void ClearZoneScript ()
 
ZoneScript * GetZoneScript () const
 
TempSummon * SummonCreature (uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
 
TempSummon * SummonCreature (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)
 
GameObject * SummonGameObject (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)
 
Creature * SummonTrigger (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)
 
void SummonGameObjectGroup (uint8 group, std::list< GameObject * > *list=nullptr)
 
Creature * FindNearestCreature (uint32 entry, float range, bool alive=true) const
 
GameObject * FindNearestGameObject (uint32 entry, float range, bool onlySpawned=false) const
 
GameObject * FindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
Player * SelectNearestPlayer (float distance=0) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &gameobjectList, std::vector< uint32 > const &entries, float maxSearchRange) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &creatureList, std::vector< uint32 > const &entries, float maxSearchRange) const
 
void GetDeadCreatureListInGrid (std::list< Creature * > &lList, float maxSearchRange, bool alive=false) const
 
virtual void UpdateObjectVisibility (bool forced=true, bool fromUpdate=false)
 
virtual void UpdateObjectVisibilityOnCreate ()
 
void BuildUpdate (UpdateDataMapType &data_map) override
 
void GetCreaturesWithEntryInRange (std::list< Creature * > &creatureList, float radius, uint32 entry)
 
void SetPositionDataUpdate ()
 
void UpdatePositionData ()
 
bool IsPositionDataUpdatePending () const
 
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)
 
VisibilityDistanceType GetVisibilityOverrideType () const
 
bool IsVisibilityOverridden () const
 
bool IsZoneWideVisible () const
 
bool IsFarVisible () const
 
float GetVisibilityOverrideDistance () const
 
void SetVisibilityDistanceOverride (VisibilityDistanceType type)
 
bool IsInWintergrasp () const
 
Transport * GetTransport () 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)
 
float GetMapWaterOrGroundLevel (Position pos, float *ground=nullptr) 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
 
void RemoveAllowedLooter (ObjectGuid guid)
 
bool CanBeAddedToMapUpdateList ()
 
std::string GetDebugInfo () const override
 
ObjectVisibilityContainer & GetObjectVisibilityContainer ()
 
ObjectVisibilityContainer const & GetObjectVisibilityContainer () const
 
SpellCastResult CastSpell (CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={})
 
SpellCastResult CastSpell (CastSpellTargetArg const &targets, SpellInfo const *info, CastSpellExtraArgs const &args={})
 
virtual ObjectGuid GetCharmerOrOwnerGUID () const
 
Unit * GetOwnerUnit () const
 
Unit * GetCharmerOrOwnerUnit () const
 
Unit * GetCharmerOrOwnerOrSelfUnit () const
 
Player * GetCharmerOrOwnerPlayerOrPlayerItself () const
 
Player * GetAffectingPlayer () const
 
virtual Player * GetSpellModOwner () const
 
FactionTemplateEntry const * GetFactionTemplateEntry () const
 
ReputationRank GetReactionTo (WorldObject const *target) const
 
bool IsHostileTo (WorldObject const *target) const
 
bool IsFriendlyTo (WorldObject const *target) const
 
float GetSpellMaxRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
float GetSpellMinRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
bool IsValidAttackTarget (WorldObject const *target, SpellInfo const *bySpell=nullptr) const
 
bool IsValidAssistTarget (WorldObject const *target, SpellInfo const *bySpell=nullptr) const
 
Unit * GetMagicHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo)
 
Unit * GetMeleeHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo)
 
int32 CalculateSpellDamage (Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
 
int32 CalcSpellDuration (SpellInfo const *spellProto) const
 
int32 ModSpellDuration (SpellInfo const *spellProto, Unit const *target, int32 duration, bool positive, uint32 effectMask) const
 
void ModSpellCastTime (SpellInfo const *spellProto, int32 &castTime, Spell *spell=nullptr) const
 
virtual SpellMissInfo MeleeSpellHitResult (Unit *, SpellInfo const *)
 
SpellMissInfo MagicSpellHitResult (Unit *victim, SpellInfo const *spellInfo)
 
SpellMissInfo SpellHitResult (Unit *victim, SpellInfo const *spellInfo, bool canReflect=false)
 
SpellMissInfo SpellHitResult (Unit *victim, Spell const *spell, bool canReflect=false)
 
void SendSpellMiss (Unit *target, uint32 spellID, SpellMissInfo missInfo)
 
void SendSpellNonMeleeDamageLog (Unit *target, SpellInfo const *spellInfo, uint32 damage, SpellSchoolMask schoolMask, uint32 absorb, uint32 resist)
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
ObjectGuid GetGUID () const
 
PackedGuid const & GetPackGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
virtual void SetObjectScale (float scale)
 
bool HasDynamicFlag (uint32 flag) const
 
virtual void SetDynamicFlag (uint32 flag)
 
virtual void RemoveDynamicFlag (uint32 flag)
 
TypeID GetTypeId () const
 
bool isType (uint16 mask) const
 
virtual void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target)
 
void SendUpdateToPlayer (Player *player)
 
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player *target)
 
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 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
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &)
 
void SetFieldNotifyFlag (uint16 flag)
 
void RemoveFieldNotifyFlag (uint16 flag)
 
void ForceValuesUpdateAtIndex (uint32)
 
bool IsPlayer () const
 
Player * ToPlayer ()
 
Player const * ToPlayer () const
 
bool IsCreature () const
 
Creature * ToCreature ()
 
Creature const * ToCreature () const
 
bool IsUnit () const
 
Unit * ToUnit ()
 
Unit const * ToUnit () const
 
bool IsGameObject () const
 
GameObject * ToGameObject ()
 
GameObject const * ToGameObject () const
 
bool IsCorpse () const
 
Corpse * ToCorpse ()
 
Corpse const * ToCorpse () const
 
bool IsDynamicObject () const
 
DynamicObject * ToDynObject ()
 
DynamicObject const * ToDynObject () const
 
bool IsItem () const
 
virtual void Heartbeat ()
 
template<typename... T>
bool EntryEquals (T... entries) const
 
- Public Member Functions inherited from WorldLocation
 WorldLocation (uint32 _mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
 WorldLocation (uint32 mapId, Position const &position)
 
void WorldRelocate (WorldLocation const &loc)
 
void WorldRelocate (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
 
Position & operator= (Position const &)=default
 
Position & operator= (Position &&)=default
 
bool operator== (Position const &a) const
 
bool operator!= (Position const &a)
 
bool operator!= (Position const &a) const
 
 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 (Position const &pos)
 
void Relocate (Position const *pos)
 
void RelocatePolarOffset (float angle, float dist, float z=0.0f)
 
void RelocateOffset (Position const &offset)
 
void SetOrientation (float orientation)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
float GetOrientation () const
 
void GetPosition (float &x, float &y) const
 
void GetPosition (float &x, float &y, float &z) const
 
void GetPosition (float &x, float &y, float &z, float &o) const
 
Position GetPosition () const
 
Position::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 (Position const &endPos, Position &retOffset) const
 
Position GetPositionWithOffset (Position const &offset) const
 
float GetAngle (Position const *pos) const
 
float GetAngle (float x, float y) const
 
float GetAbsoluteAngle (float x, float y) const
 
float GetAbsoluteAngle (Position const &pos) const
 
float GetAbsoluteAngle (Position const *pos) const
 
float GetRelativeAngle (Position const *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 (Position const *pos, float dist) const
 
bool IsInDist (float x, float y, float z, float dist) const
 
bool IsInDist (Position const *pos, float dist) const
 
bool IsWithinBox (Position const &center, float xradius, float yradius, float zradius) const
 
bool HasInArc (float arcangle, Position const *pos, float targetRadius=0.0f) const
 
bool HasInLine (Position const *pos, float width) const
 
bool HasInLine (Position const *pos, float objSize, 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 WorldObject
static float GetLeewayBonusRangeForTargets (Player const *player, Unit const *target)
 
static ReputationRank GetFactionReactionTo (FactionTemplateEntry const *factionTemplateEntry, WorldObject const *target)
 
- 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
 
GameObjectModel * m_model
 
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealth
 
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealthDetect
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibility
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibilityDetect
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
 
uint32 LastUsedScriptID
 
MovementInfo m_movementInfo
 
ALEEventProcessor * ALEEvents
 
EventProcessor m_Events
 
- 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, goEventFlag > gameObjectToEventFlag = { }
 

Protected Types

typedef std::map< uint32, ObjectGuid > ChairSlotAndUser
 

Protected Member Functions

bool AIM_Initialize ()
 
GameObjectModel * CreateModel ()
 
void UpdateModel ()
 
- Protected Member Functions inherited from WorldObject
 WorldObject ()
 
virtual void ProcessPositionDataChanged (PositionFullTerrainStatus const &data)
 
void SetLocationMapId (uint32 _mapId)
 
void SetLocationInstanceId (uint32 _instanceId)
 
virtual bool IsAlwaysDetectableFor (WorldObject const *) const
 
- Protected Member Functions inherited from Object
 Object ()
 
void _InitValues ()
 
void _Create (ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
 
void _Create (ObjectGuid guid)
 
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
 
void AddToObjectUpdateIfNeeded ()
 
- Protected Member Functions inherited from MovableMapObject
 MovableMapObject ()=default
 
Cell const & GetCurrentCell () const
 
- Protected Member Functions inherited from UpdatableMapObject
 UpdatableMapObject ()
 

Protected Attributes

bool _respawnCompatibilityMode {true}
 
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, int32 > m_SkillupList
 
ObjectGuid m_ritualOwnerGUID
 
GuidSet m_unique_users
 
uint32 m_usetimes
 
ChairSlotAndUser ChairListSlots
 
ObjectGuid::LowType m_spawnId
 For new or temporary gameobjects is 0 for saved it is lowguid.
 
GameObjectTemplate const * m_goInfo
 
GameObjectData const * m_goData
 
GameObjectValue m_goValue
 
bool m_allowModifyDestructibleBuilding
 
int64 m_packedRotation
 
G3D::Quat WorldRotation
 
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
 
VisibilityDistanceType _visibilityDistanceOverrideType
 
ZoneScript * m_zoneScript
 
uint32 _zoneId
 
uint32 _areaId
 
float _floorZ
 
bool _outdoors
 
LiquidData _liquidData
 
bool _updatePositionData
 
Transport * m_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, bool) const override
 Object distance/size - overridden from Object::_IsWithinDist. Needs to take in account proper GO size.
 
bool IsWithinSightRange (Position const &pos, float dist) const override
 

Private Attributes

GameObjectAI * m_AI
 
bool m_saveStateOnDb = false
 

Additional Inherited Members

- Public Types inherited from UpdatableMapObject
enum  UpdateState : uint8 {
  NotUpdating ,
  PendingAdd ,
  Updating
}
 

Detailed Description

Member Typedef Documentation

◆ ChairSlotAndUser

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

Constructor & Destructor Documentation

◆ GameObject()

GameObject::GameObject ( )
explicit
111 m_model(nullptr), m_goValue(), m_AI(nullptr)
112{
115
117
119 m_respawnTime = 0;
120 m_respawnDelayTime = 300;
121 m_despawnDelay = 0;
123 m_restockTime = 0s;
125 m_spawnedByDefault = true;
127 m_usetimes = 0;
128 m_spellId = 0;
129 m_cooldownTime = 0;
130 m_goInfo = nullptr;
131 m_goData = nullptr;
133
134 m_spawnId = 0;
135
140
141 ResetLootMode(); // restore default loot mode
142 loot.sourceGameObject = this;
143 m_stationaryPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
144}
@ GO_NOT_READY
Definition GameObject.h:115
@ TYPEID_GAMEOBJECT
Definition ObjectGuid.h:40
@ TYPEMASK_GAMEOBJECT
Definition ObjectGuid.h:54
@ 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:253
GameObjectValue m_goValue
Definition GameObject.h:415
time_t m_respawnTime
Definition GameObject.h:394
GameObjectData const * m_goData
Definition GameObject.h:414
int64 m_packedRotation
Definition GameObject.h:418
Position m_stationaryPosition
Definition GameObject.h:420
bool m_allowModifyDestructibleBuilding
Definition GameObject.h:416
uint32 m_cooldownTime
Definition GameObject.h:401
uint32 m_spellId
Definition GameObject.h:393
uint32 m_respawnDelayTime
Definition GameObject.h:395
void ResetLootMode()
Definition GameObject.h:239
uint32 m_despawnDelay
Definition GameObject.h:396
Seconds m_despawnRespawnTime
Definition GameObject.h:397
ObjectGuid::LowType m_lootRecipientGroup
Definition GameObject.h:423
GameObjectAI * m_AI
Definition GameObject.h:448
GameObjectModel * m_model
Definition GameObject.h:332
GameObjectTemplate const * m_goInfo
Definition GameObject.h:413
ObjectGuid::LowType m_spawnId
For new or temporary gameobjects is 0 for saved it is lowguid.
Definition GameObject.h:412
uint32 m_groupLootTimer
Definition GameObject.h:263
uint32 lootingGroupLowGUID
Definition GameObject.h:264
bool m_spawnedByDefault
Definition GameObject.h:400
LootState m_lootState
Definition GameObject.h:399
Seconds m_restockTime
Definition GameObject.h:398
uint32 m_usetimes
Definition GameObject.h:407
uint32 m_lootGenerationTime
Definition GameObject.h:425
MovableMapObject()=default
uint16 m_objectType
Definition Object.h:259
uint16 m_valuesCount
Definition Object.h:273
uint16 m_updateFlag
Definition Object.h:262
TypeID m_objectTypeId
Definition Object.h:261
WorldObject()
Definition Object.cpp:1065
GameObject * sourceGameObject
Definition LootMgr.h:331
void Relocate(float x, float y)
Definition Position.h:77

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
147{
148 delete m_AI;
149 delete m_model;
150 //if (m_uint32Values) // field array can be not exist if GameOBject not loaded
151 // CleanupsBeforeDelete();
152}

References m_AI, and m_model.

Member Function Documentation

◆ _IsWithinDist()

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

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

Following check does check 3d distance

Reimplemented from WorldObject.

440 {
442 dist2compare += obj->GetObjectSize();
443 return IsInRange3d(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), dist2compare);
444 }
bool IsInRange3d(float x, float y, float z, float radius) const
Definition GameObject.cpp:2260

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

◆ ActivateToQuest()

bool GameObject::ActivateToQuest ( Player *  target) const
1428{
1429 if (target->HasQuestForGO(GetEntry()))
1430 return true;
1431
1432 if (!GetGOInfo()->IsGameObjectForQuests())
1433 return false;
1434
1435 FactionTemplateEntry const* gameObjectFaction =
1437 FactionTemplateEntry const* playerFaction = target->GetFactionTemplateEntry();
1438 if (gameObjectFaction && playerFaction &&
1439 (gameObjectFaction->IsHostileToAlliancePlayers() || gameObjectFaction->IsHostileToHordePlayers()))
1440 {
1441 // Faction templates 101/102 have no ourMask, so check hostility from the gameobject to the player.
1442 bool isHostile = gameObjectFaction->IsHostileTo(*playerFaction);
1443 if (ReputationRank const* forcedRank = target->GetReputationMgr().GetForcedRankIfAny(gameObjectFaction))
1444 isHostile = *forcedRank <= REP_HOSTILE;
1445
1446 if (isHostile)
1447 return false;
1448 }
1449
1450 switch (GetGoType())
1451 {
1453 {
1454 GameObject* go = const_cast<GameObject*>(this);
1455 QuestGiverStatus questStatus = target->GetQuestDialogStatus(go);
1456 if (questStatus > DIALOG_STATUS_UNAVAILABLE)
1457 return true;
1458 break;
1459 }
1461 {
1462 // scan GO chest with loot including quest items
1464 {
1465 //TODO: fix this hack
1466 //look for battlegroundAV for some objects which are only activated after mine gots captured by own team
1468 if (Battleground* bg = target->GetBattleground())
1469 if (bg->GetBgTypeID(true) == BATTLEGROUND_AV && !bg->ToBattlegroundAV()->PlayerCanDoMineQuest(GetEntry(), target->GetTeamId()))
1470 return false;
1471 return true;
1472 }
1473 break;
1474 }
1476 {
1477 if (GetGOInfo()->_generic.questID == -1 || target->GetQuestStatus(GetGOInfo()->_generic.questID) == QUEST_STATUS_INCOMPLETE)
1478 return true;
1479 break;
1480 }
1482 {
1483 if (GetGOInfo()->spellFocus.questID > 0 && target->GetQuestStatus(GetGOInfo()->spellFocus.questID) == QUEST_STATUS_INCOMPLETE)
1484 return true;
1485 break;
1486 }
1488 {
1489 if (GetGOInfo()->goober.questId == -1 || target->GetQuestStatus(GetGOInfo()->goober.questId) == QUEST_STATUS_INCOMPLETE)
1490 return true;
1491 break;
1492 }
1493 default:
1494 break;
1495 }
1496
1497 return false;
1498}
@ BG_AV_OBJECTID_MINE_N
Definition BattlegroundAV.h:156
@ BG_AV_OBJECTID_MINE_S
Definition BattlegroundAV.h:157
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplateEntryfmt)
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:1572
@ GAMEOBJECT_TYPE_GENERIC
Definition SharedDefines.h:1569
@ GAMEOBJECT_TYPE_CHEST
Definition SharedDefines.h:1567
@ GAMEOBJECT_TYPE_QUESTGIVER
Definition SharedDefines.h:1566
@ GAMEOBJECT_TYPE_GOOBER
Definition SharedDefines.h:1574
ReputationRank
Definition SharedDefines.h:156
@ REP_HOSTILE
Definition SharedDefines.h:158
@ BATTLEGROUND_AV
Definition SharedDefines.h:3737
@ GAMEOBJECT_FACTION
Definition UpdateFields.h:402
Definition Battleground.h:304
Definition GameObject.h:125
GameObjectTemplate const * GetGOInfo() const
Definition GameObject.h:141
GameobjectTypes GetGoType() const
Definition GameObject.h:209
bool HaveQuestLootForPlayer(uint32 loot_id, Player const *player) const
Definition LootMgr.cpp:228
uint32 GetUInt32Value(uint16 index) const
Definition Object.cpp:303
uint32 GetEntry() const
Definition Object.h:123
bool HasQuestForGO(int32 GOId) const
Definition Player.cpp:12689
TeamId GetTeamId(bool original=false) const
Definition Player.h:2140
QuestGiverStatus GetQuestDialogStatus(Object *questGiver)
Definition PlayerQuest.cpp:1669
Battleground * GetBattleground(bool create=false) const
Definition Player.cpp:12483
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition PlayerQuest.cpp:1504
ReputationMgr & GetReputationMgr()
Definition Player.h:2157
ReputationRank const * GetForcedRankIfAny(FactionTemplateEntry const *factionTemplateEntry) const
Definition ReputationMgr.h:106
FactionTemplateEntry const * GetFactionTemplateEntry() const
Definition Unit.cpp:6864
Definition DBCStructure.h:975
bool IsHostileToHordePlayers() const
Definition DBCStructure.h:1019
bool IsHostileTo(FactionTemplateEntry const &entry) const
Definition DBCStructure.h:1004
bool IsHostileToAlliancePlayers() const
Definition DBCStructure.h:1018
int32 questID
Definition GameObjectData.h:111
struct GameObjectTemplate::@237::@243 _generic
struct GameObjectTemplate::@237::@246 spellFocus
struct GameObjectTemplate::@237::@248 goober
uint32 questId
Definition GameObjectData.h:92

References GameObjectTemplate::_generic, BATTLEGROUND_AV, BG_AV_OBJECTID_MINE_N, BG_AV_OBJECTID_MINE_S, DIALOG_STATUS_UNAVAILABLE, GAMEOBJECT_FACTION, GAMEOBJECT_TYPE_CHEST, GAMEOBJECT_TYPE_GENERIC, GAMEOBJECT_TYPE_GOOBER, GAMEOBJECT_TYPE_QUESTGIVER, GAMEOBJECT_TYPE_SPELL_FOCUS, Player::GetBattleground(), Object::GetEntry(), Unit::GetFactionTemplateEntry(), ReputationMgr::GetForcedRankIfAny(), GetGOInfo(), GetGoType(), Player::GetQuestDialogStatus(), Player::GetQuestStatus(), Player::GetReputationMgr(), Player::GetTeamId(), Object::GetUInt32Value(), GameObjectTemplate::goober, Player::HasQuestForGO(), LootStore::HaveQuestLootForPlayer(), FactionTemplateEntry::IsHostileTo(), FactionTemplateEntry::IsHostileToAlliancePlayers(), FactionTemplateEntry::IsHostileToHordePlayers(), LootTemplates_Gameobject, QUEST_STATUS_INCOMPLETE, GameObjectTemplate::questId, GameObjectTemplate::questID, REP_HOSTILE, sFactionTemplateStore, and GameObjectTemplate::spellFocus.

Referenced by BuildValuesUpdate().

◆ AddLootMode()

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

References m_LootMode.

◆ AddToSkillupList()

void GameObject::AddToSkillupList ( ObjectGuid const &  playerGuid)
3175{
3176 int32 timer = GetMap()->IsDungeon() ? -1 : 10 * MINUTE * IN_MILLISECONDS;
3177 m_SkillupList[playerGuid] = timer;
3178}
constexpr auto IN_MILLISECONDS
Definition Common.h:53
constexpr auto MINUTE
Definition Common.h:47
std::int32_t int32
Definition Define.h:103
std::unordered_map< ObjectGuid, int32 > m_SkillupList
Definition GameObject.h:403
bool IsDungeon() const
Definition Map.h:299
Map * GetMap() const
Definition Object.h:637

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.

210{
212 if (!IsInWorld())
213 {
214 if (m_zoneScript)
216
218 if (m_spawnId)
219 GetMap()->GetGameObjectBySpawnIdStore().insert(std::make_pair(m_spawnId, this));
220
221 if (m_model)
222 {
225 }
226
227 EnableCollision(GetGoState() == GO_STATE_READY || IsTransport()); // pussywizard: this startOpen is unneeded here, collision depends entirely on GOState
228
230
232
233 sScriptMgr->OnGameObjectAddWorld(this);
234 }
235}
@ GO_STATE_READY
Definition GameObjectData.h:709
#define sScriptMgr
Definition ScriptMgr.h:769
bool UpdatePosition()
Definition GameObjectModel.cpp:246
GOState GetGoState() const
Definition GameObject.h:211
void EnableCollision(bool enable)
Definition GameObject.cpp:2709
bool IsTransport() const
Definition GameObject.cpp:1326
MapStoredObjectTypesContainer & GetObjectsStore()
Definition Map.h:358
GameObjectBySpawnIdContainer & GetGameObjectBySpawnIdStore()
Definition Map.h:364
void InsertGameObjectModel(GameObjectModel const &model)
Definition Map.h:405
bool IsInWorld() const
Definition Object.h:115
ObjectGuid GetGUID() const
Definition Object.h:121
bool Insert(KEY_TYPE const &handle, SPECIFIC_TYPE *obj)
Definition TypeContainer.h:177
void AddToWorld() override
Definition Object.cpp:1223
ZoneScript * m_zoneScript
Definition Object.h:802
virtual void OnGameObjectCreate(GameObject *)
Definition ZoneScript.h:37
ObjectGuid sourceWorldObjectGUID
Definition LootMgr.h:330

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 Map::AddToMap().

◆ AddUniqueUse()

void GameObject::AddUniqueUse ( Player *  player)
1038{
1039 AddUse();
1040 m_unique_users.insert(player->GetGUID());
1041}
void AddUse()
Definition GameObject.h:245
GuidSet m_unique_users
Definition GameObject.h:406
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:120

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

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

◆ AddUse()

◆ AI()

◆ AIM_Initialize()

bool GameObject::AIM_Initialize ( )
protected
155{
156 if (m_AI)
157 delete m_AI;
158
160
161 if (!m_AI)
162 return false;
163
165 return true;
166}
virtual void InitializeAI()
Definition GameObjectAI.h:43
GameObjectAI * SelectGameObjectAI(GameObject *go)
Definition CreatureAISelector.cpp:102

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

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

◆ AllowSaveToDB()

◆ BuildValuesUpdate()

void GameObject::BuildValuesUpdate ( uint8  updateType,
ByteBuffer *  data,
Player *  target 
)
overridevirtual

Reimplemented from Object.

2846{
2847 if (!target)
2848 return;
2849
2851 bool targetIsGM = target->IsGameMaster() && target->GetSession()->IsGMAccount();
2852
2853 ByteBuffer fieldBuffer;
2854
2855 UpdateMask updateMask;
2856 updateMask.SetCount(m_valuesCount);
2857
2859 uint32 visibleFlag = UF_FLAG_PUBLIC;
2860 if (GetOwnerGUID() == target->GetGUID())
2861 visibleFlag |= UF_FLAG_OWNER;
2862
2863 for (uint16 index = 0; index < m_valuesCount; ++index)
2864 {
2865 if (_fieldNotifyFlags & flags[index] ||
2866 ((updateType == UPDATETYPE_VALUES ? _changesMask.GetBit(index) : m_uint32Values[index]) && (flags[index] & visibleFlag)) ||
2867 (index == GAMEOBJECT_FLAGS && forcedFlags))
2868 {
2869 updateMask.SetBit(index);
2870
2871 if (index == GAMEOBJECT_DYNAMIC)
2872 {
2873 uint16 dynFlags = 0;
2874 int16 pathProgress = -1;
2875 switch (GetGoType())
2876 {
2878 if (ActivateToQuest(target))
2879 dynFlags |= GO_DYNFLAG_LO_ACTIVATE;
2880 break;
2883 if (ActivateToQuest(target))
2884 {
2885 dynFlags |= GO_DYNFLAG_LO_ACTIVATE;
2886 if (sWorld->getBoolConfig(CONFIG_OBJECT_SPARKLES))
2887 dynFlags |= GO_DYNFLAG_LO_SPARKLE;
2888 }
2889 else if (targetIsGM)
2890 dynFlags |= GO_DYNFLAG_LO_ACTIVATE;
2891 break;
2894 if (ActivateToQuest(target) && sWorld->getBoolConfig(CONFIG_OBJECT_SPARKLES))
2895 dynFlags |= GO_DYNFLAG_LO_SPARKLE;
2896 break;
2898 if (StaticTransport const* t = ToStaticTransport())
2899 if (t->GetPauseTime())
2900 {
2901 if (GetGoState() == GO_STATE_READY)
2902 {
2903 if (t->GetPathProgress() >= t->GetPauseTime()) // if not, send 100% progress
2904 pathProgress = int16(float(t->GetPathProgress() - t->GetPauseTime()) / float(t->GetPeriod() - t->GetPauseTime()) * 65535.0f);
2905 }
2906 else
2907 {
2908 if (t->GetPathProgress() <= t->GetPauseTime()) // if not, send 100% progress
2909 pathProgress = int16(float(t->GetPathProgress()) / float(t->GetPauseTime()) * 65535.0f);
2910 }
2911 }
2912 // else it's ignored
2913 break;
2915 if (MotionTransport const* t = ToMotionTransport())
2916 pathProgress = int16(float(t->GetPathProgress()) / float(t->GetPeriod()) * 65535.0f);
2917 break;
2918 default:
2919 break;
2920 }
2921
2922 fieldBuffer << uint16(dynFlags);
2923 fieldBuffer << int16(pathProgress);
2924 }
2925 else if (index == GAMEOBJECT_FLAGS)
2926 {
2929 {
2931 }
2932
2933 fieldBuffer << goFlags;
2934 }
2935 else
2936 fieldBuffer << m_uint32Values[index]; // other cases
2937 }
2938 }
2939
2940 *data << uint8(updateMask.GetBlockCount());
2941 updateMask.AppendToPacket(data);
2942 data->append(fieldBuffer);
2943}
std::uint8_t uint8
Definition Define.h:109
std::uint32_t uint32
Definition Define.h:107
std::uint16_t uint16
Definition Define.h:108
std::int16_t int16
Definition Define.h:104
@ GAMEOBJECT_TYPE_MO_TRANSPORT
Definition SharedDefines.h:1579
@ GAMEOBJECT_TYPE_TRANSPORT
Definition SharedDefines.h:1575
@ GO_DYNFLAG_LO_ACTIVATE
Definition SharedDefines.h:1622
@ GO_DYNFLAG_LO_SPARKLE
Definition SharedDefines.h:1625
@ GO_FLAG_NOT_SELECTABLE
Definition SharedDefines.h:1611
@ GO_FLAG_LOCKED
Definition SharedDefines.h:1608
@ 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 WorldConfig.h:140
Definition ByteBuffer.h:70
void append(T value)
Definition ByteBuffer.h:129
ObjectGuid GetOwnerGUID() const override
Definition GameObject.h:179
MotionTransport * ToMotionTransport()
Definition GameObject.h:347
bool HasLootRecipient() const
Definition GameObject.h:262
bool ActivateToQuest(Player *target) const
Definition GameObject.cpp:1427
bool IsLootAllowedFor(Player const *player) const
Definition GameObject.cpp:2807
StaticTransport * ToStaticTransport()
Definition GameObject.h:344
Definition Transport.h:51
uint16 _fieldNotifyFlags
Definition Object.h:275
UpdateMask _changesMask
Definition Object.h:271
uint32 * m_uint32Values
Definition Object.h:267
WorldSession * GetSession() const
Definition Player.h:2032
bool IsGameMaster() const
Definition Player.h:1178
Definition Transport.h:120
Definition UpdateMask.h:25
uint32 GetBlockCount() const
Definition UpdateMask.h:62
bool GetBit(uint32 index) const
Definition UpdateMask.h:47
void SetCount(uint32 valuesCount)
Definition UpdateMask.h:65
void SetBit(uint32 index)
Definition UpdateMask.h:45
void AppendToPacket(ByteBuffer *data)
Definition UpdateMask.h:49
bool IsGMAccount() const
Definition WorldSession.cpp:221
#define sWorld
Definition World.h:337
struct GameObjectTemplate::@237::@242 chest
uint32 groupLootRules
Definition GameObjectData.h:99

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(), 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(), WorldSession::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() [1/3]

SpellCastResult WorldObject::CastSpell ( CastSpellTargetArg const &  targets,
SpellInfo const *  info,
CastSpellExtraArgs const &  args = {} 
)
3293{
3294 if (!info)
3296
3297 if (!targets.Targets)
3298 {
3299 LOG_ERROR("spells", "CastSpell: invalid target passed to spell {} by caster {}",
3300 info->Id, GetGUID().ToString());
3302 }
3303
3304 // some scripts rely on the triggering aura's caster being the original caster
3305 ObjectGuid originalCaster = args.OriginalCaster;
3306 if (!originalCaster && args.TriggeringAura)
3307 originalCaster = args.TriggeringAura->GetCasterGUID();
3308
3309 Spell* spell = new Spell(this, info, args.TriggerFlags, originalCaster);
3310 for (auto const& kv : args.SpellValueOverrides)
3311 spell->SetSpellValue(kv.first, kv.second);
3312 spell->m_CastItem = args.CastItem;
3313 return spell->prepare(&*targets.Targets, args.TriggeringAura);
3314}
#define LOG_ERROR(filterType__,...)
Definition Log.h:145
@ SPELL_FAILED_BAD_TARGETS
Definition SharedDefines.h:949
@ SPELL_FAILED_SPELL_UNAVAILABLE
Definition SharedDefines.h:1044
Definition ObjectGuid.h:121
Definition Spell.h:298
SpellCastResult prepare(SpellCastTargets const *targets, AuraEffect const *triggeredByAura=nullptr)
Definition Spell.cpp:3565
Item * m_CastItem
Definition Spell.h:536
std::string ToString() const
Definition Position.cpp:59

◆ CastSpell() [2/3]

SpellCastResult WorldObject::CastSpell ( CastSpellTargetArg const &  targets,
uint32  spellId,
CastSpellExtraArgs const &  args = {} 
)
3280{
3281 SpellInfo const* info = sSpellMgr->GetSpellInfo(spellId);
3282 if (!info)
3283 {
3284 LOG_ERROR("spells", "CastSpell: unknown spell {} by caster {}",
3285 spellId, GetGUID().ToString());
3287 }
3288 return CastSpell(targets, info, args);
3289}
#define sSpellMgr
Definition SpellMgr.h:851
void CastSpell(Unit *target, uint32 spellId)
Definition GameObject.cpp:1534
Definition SpellInfo.h:340

◆ CastSpell() [3/3]

void GameObject::CastSpell ( Unit *  target,
uint32  spellId 
)

◆ CheckRitualList()

void GameObject::CheckRitualList ( )
private
271{
272 if (m_unique_users.empty())
273 return;
274
276 if (!animSpell)
277 animSpell = GetSpellId();
278
279 for (GuidSet::iterator itr = m_unique_users.begin(); itr != m_unique_users.end();)
280 {
281 if (*itr == GetOwnerGUID())
282 {
283 ++itr;
284 continue;
285 }
286
287 bool erase = true;
288 if (Player* channeler = ObjectAccessor::GetPlayer(*this, *itr))
289 if (Spell* spell = channeler->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
290 if (spell->m_spellInfo->Id == animSpell)
291 erase = false;
292
293 if (erase)
294 m_unique_users.erase(itr++);
295 else
296 ++itr;
297 }
298}
@ CURRENT_CHANNELED_SPELL
Definition Unit.h:565
uint32 GetSpellId() const
Definition GameObject.h:188
Definition Player.h:1086
Player * GetPlayer(Map const *, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:244
uint32 animSpell
Definition GameObjectData.h:234
struct GameObjectTemplate::@237::@253 summoningRitual

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

Referenced by Update(), and Use().

◆ CleanupsBeforeDelete()

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

Reimplemented from WorldObject.

Reimplemented in MotionTransport, and StaticTransport.

174{
175 if (GetTransport() && !ToTransport())
176 {
178 SetTransport(nullptr);
181 }
182
183 if (IsInWorld())
185
186 if (m_uint32Values) // field array can be not exist if GameOBject not loaded
188}
@ MOVEMENTFLAG_ONTRANSPORT
Definition UnitDefines.h:381
void RemoveFromWorld() override
Definition GameObject.cpp:237
void RemoveFromOwner()
Definition GameObject.cpp:190
Transport * ToTransport()
Definition GameObject.h:341
virtual void RemovePassenger(WorldObject *passenger, bool withAll=false)=0
void SetTransport(Transport *t)
Definition Object.h:709
Transport * GetTransport() const
Definition Object.h:701
MovementInfo m_movementInfo
Definition Object.h:711
void Reset()
Definition Object.h:306
void RemoveMovementFlag(uint32 flag)
Definition Object.h:352
struct MovementInfo::TransportInfo transport

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
301{
302 if (m_unique_users.empty())
303 return;
304
306 if (!animSpell)
307 animSpell = GetSpellId();
308
309 for (ObjectGuid const& guid : m_unique_users)
310 {
311 if (Player* channeler = ObjectAccessor::GetPlayer(*this, guid))
312 if (Spell* spell = channeler->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
313 if (spell->m_spellInfo->Id == animSpell)
314 {
315 spell->SendChannelUpdate(0);
316 spell->finish();
317 }
318 }
319
320 m_unique_users.clear();
321}

References GameObjectTemplate::animSpell, CURRENT_CHANNELED_SPELL, GetGOInfo(), ObjectAccessor::GetPlayer(), GetSpellId(), 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.

324{
325 ASSERT(map);
326 SetMap(map);
327
328 Relocate(x, y, z, ang);
329 m_stationaryPosition.Relocate(x, y, z, ang);
330 if (!IsPositionValid())
331 {
332 LOG_ERROR("entities.gameobject", "Gameobject (GUID: {} Entry: {}) not created. Suggested coordinates isn't valid (X: {} Y: {})", guidlow, name_id, x, y);
333 return false;
334 }
335
336 SetPhaseMask(phaseMask, false);
337
339
341 if (m_zoneScript)
342 {
343 name_id = m_zoneScript->GetGameObjectEntry(guidlow, name_id);
344 if (!name_id)
345 return false;
346 }
347
348 GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(name_id);
349 if (!goinfo)
350 {
351 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);
352 return false;
353 }
354
355 Object::_Create(guidlow, goinfo->entry, HighGuid::GameObject);
356
357 m_goInfo = goinfo;
358
359 if (goinfo->type >= MAX_GAMEOBJECT_TYPE)
360 {
361 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);
362 return false;
363 }
364
365 SetWorldRotation(rotation);
366
367 GameObjectAddon const* gameObjectAddon = sObjectMgr->GetGameObjectAddon(GetSpawnId());
368 QuaternionData parentRotation;
369 if (gameObjectAddon)
370 parentRotation = gameObjectAddon->ParentRotation;
371
372 SetTransportPathRotation(parentRotation.x, parentRotation.y, parentRotation.z, parentRotation.w);
373
374 SetObjectScale(goinfo->size);
375
376 if (GameObjectTemplateAddon const* templateAddon = GetTemplateAddon())
377 {
378 SetUInt32Value(GAMEOBJECT_FACTION, templateAddon->faction);
379 ReplaceAllGameObjectFlags((GameObjectFlags)templateAddon->flags);
380 }
381
382 SetEntry(goinfo->entry);
383
384 // set name for logs usage, doesn't affect anything ingame
385 SetName(goinfo->name);
386
387 // GAMEOBJECT_BYTES_1, index at 0, 1, 2 and 3
389
391 {
392 if (InstanceScript* instance = GetInstanceScript())
393 {
394 switch (uint8 state = instance->GetStoredGameObjectState(GetSpawnId()))
395 {
396 case 0:
398 SwitchDoorOrButton(true);
399 break;
400 case 1:
401 case 2:
402 SetGoState((GOState)state);
403 break;
404 default:
405 SetGoState(go_state);
406 break;
407 }
408 }
409 }
410 else
411 {
412 SetGoState(go_state);
413 }
414
415 SetGoArtKit(artKit);
416
417 SetDisplayId(goinfo->displayId);
418
419 if (!m_model)
421
422 switch (goinfo->type)
423 {
425 SetGoAnimProgress(animprogress);
427 break;
432 break;
435 break;
437 if (GetGOInfo()->trap.stealthed)
438 {
441 }
442
443 if (GetGOInfo()->trap.invisible)
444 {
447 }
448
450 if (SpellInfo const* trapSpell = sSpellMgr->GetSpellInfo(goinfo->trap.spellId))
451 {
452 // positive spells may require enemy targets
453 if (trapSpell->IsPositive())
454 {
455 bool targetsAlly = false;
456 bool targetsEnemy = false;
457 auto isAllyTarget = [](SpellImplicitTargetInfo const& targetInfo)
458 {
459 return targetInfo.GetObjectType() == TARGET_OBJECT_TYPE_UNIT &&
460 targetInfo.GetCheckType() == TARGET_CHECK_ALLY;
461 };
462 auto isEnemyTarget = [](SpellImplicitTargetInfo const& targetInfo)
463 {
464 return targetInfo.GetObjectType() == TARGET_OBJECT_TYPE_UNIT &&
465 targetInfo.GetCheckType() == TARGET_CHECK_ENEMY;
466 };
467 for (SpellEffectInfo const& spellEffectInfo : trapSpell->Effects)
468 {
469 if (!spellEffectInfo.IsEffect())
470 continue;
471
472 targetsAlly = targetsAlly || isAllyTarget(spellEffectInfo.TargetA) ||
473 isAllyTarget(spellEffectInfo.TargetB);
474 targetsEnemy = targetsEnemy || isEnemyTarget(spellEffectInfo.TargetA) ||
475 isEnemyTarget(spellEffectInfo.TargetB);
476 }
477
478 if (targetsAlly)
481 }
482 }
483 break;
484 default:
485 SetGoAnimProgress(animprogress);
486 break;
487 }
488
489 if (gameObjectAddon)
490 {
491 if (gameObjectAddon->InvisibilityValue)
492 {
493 m_invisibility.AddFlag(gameObjectAddon->invisibilityType);
494 m_invisibility.AddValue(gameObjectAddon->invisibilityType, gameObjectAddon->InvisibilityValue);
495 }
496 }
497
500
501 if (uint32 linkedEntry = GetGOInfo()->GetLinkedGameObjectEntry())
502 {
503 GameObject* linkedGO = new GameObject();
504 if (linkedGO->Create(map->GenerateLowGuid<HighGuid::GameObject>(), linkedEntry, map, phaseMask, x, y, z, ang, rotation, 255, GO_STATE_READY))
505 {
506 SetLinkedTrap(linkedGO);
507 map->AddToMap(linkedGO);
508 }
509 else
510 {
511 delete linkedGO;
512 }
513 }
514
515 // Check if GameObject is Large
516 if (goinfo->IsLargeGameObject())
518
519 // Check if GameObject is Infinite
520 if (goinfo->IsInfiniteGameObject())
522
523 return true;
524}
#define ASSERT
Definition Errors.h:68
GOState
Definition GameObjectData.h:707
#define sObjectMgr
Definition ObjectMgr.h:1731
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:44
GameobjectTypes
Definition SharedDefines.h:1563
@ GAMEOBJECT_TYPE_TRAP
Definition SharedDefines.h:1570
@ GAMEOBJECT_TYPE_FISHINGHOLE
Definition SharedDefines.h:1589
@ GAMEOBJECT_TYPE_FISHINGNODE
Definition SharedDefines.h:1581
@ GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING
Definition SharedDefines.h:1597
@ STEALTH_TRAP
Definition SharedDefines.h:1236
@ INVISIBILITY_TRAP
Definition SharedDefines.h:1246
#define MAX_GAMEOBJECT_TYPE
Definition SharedDefines.h:1602
GameObjectFlags
Definition SharedDefines.h:1606
@ TARGET_CHECK_ENEMY
Definition SpellInfo.h:117
@ TARGET_CHECK_DEFAULT
Definition SpellInfo.h:115
@ TARGET_CHECK_ALLY
Definition SpellInfo.h:118
@ TARGET_OBJECT_TYPE_UNIT
Definition SpellInfo.h:102
void AddFlag(FLAG_TYPE flag)
Definition Object.h:401
void AddValue(FLAG_TYPE flag, T_VALUES value)
Definition Object.h:406
GameObject()
Definition GameObject.cpp:110
void SetGoState(GOState state)
Definition GameObject.cpp:2582
void SetTransportPathRotation(float qx, float qy, float qz, float qw)
Definition GameObject.cpp:2352
void SetGoArtKit(uint8 artkit)
Definition GameObject.cpp:1567
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition GameObject.cpp:2701
void SetGoAnimProgress(uint8 animprogress)
Definition GameObject.h:216
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:323
GameObjectModel * CreateModel()
Definition GameObject.cpp:3062
void SetGoType(GameobjectTypes type)
Definition GameObject.h:210
void SetLinkedTrap(GameObject *linkedTrap)
Definition GameObject.h:269
ObjectGuid::LowType GetSpawnId() const
Definition GameObject.h:149
bool AIM_Initialize()
Definition GameObject.cpp:154
virtual uint32 GetScriptId() const
Definition GameObject.cpp:2299
GameObjectTemplateAddon const * GetTemplateAddon() const
Definition GameObject.cpp:1022
void SetDisplayId(uint32 displayid)
Definition GameObject.cpp:2695
void ReplaceAllGameObjectFlags(GameObjectFlags flags)
Definition GameObject.h:226
bool IsInstanceGameobject() const
Definition GameObject.cpp:2618
void SwitchDoorOrButton(bool activate, bool alternative=false)
Definition GameObject.cpp:1590
void SetWorldRotation(G3D::Quat const &rot)
Definition GameObject.cpp:2340
Definition InstanceScript.h:143
ObjectGuid::LowType GenerateLowGuid()
Definition Map.h:530
uint32 GetId() const
Definition Map.h:234
bool AddToMap(T *, bool checkTransport=false)
Definition Map.cpp:307
void _Create(ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
Definition Object.cpp:128
void SetEntry(uint32 entry)
Definition Object.h:124
virtual void SetObjectScale(float scale)
Definition Object.h:127
void SetUInt32Value(uint16 index, uint32 value)
Definition Object.cpp:648
Definition SpellInfo.h:270
Definition SpellInfo.h:238
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1247
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibility
Definition Object.h:626
uint32 LastUsedScriptID
Definition Object.h:698
void SetName(std::string const &newname)
Definition Object.h:536
void SetZoneScript()
Definition Object.cpp:2438
virtual void SetMap(Map *map)
Definition Object.cpp:2203
void UpdatePositionData()
Definition Object.cpp:1188
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealth
Definition Object.h:623
void SetVisibilityDistanceOverride(VisibilityDistanceType type)
Definition Object.cpp:1117
virtual uint32 GetGameObjectEntry(ObjectGuid::LowType, uint32 entry)
Definition ZoneScript.h:32
Definition GameObjectData.h:699
QuaternionData ParentRotation
Definition GameObjectData.h:700
uint32 InvisibilityValue
Definition GameObjectData.h:702
InvisibilityType invisibilityType
Definition GameObjectData.h:701
Definition GameObjectData.h:667
Definition GameObjectData.h:32
uint32 intactNumHits
Definition GameObjectData.h:352
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 spellId
Definition GameObjectData.h:119
uint32 invisible
Definition GameObjectData.h:127
uint32 damagedNumHits
Definition GameObjectData.h:357
std::string name
Definition GameObjectData.h:36
struct GameObjectTemplate::@237::@244 trap
uint32 maxSuccessOpens
Definition GameObjectData.h:89
float size
Definition GameObjectData.h:40
uint32 displayId
Definition GameObjectData.h:35
struct GameObjectTemplate::@237::@265 building
bool IsPositionValid() const
Definition Position.cpp:183
Definition GameObjectData.h:683
float w
Definition GameObjectData.h:687
float z
Definition GameObjectData.h:686
float y
Definition GameObjectData.h:685
float x
Definition GameObjectData.h:684
uint32 MaxOpens
Definition GameObject.h:65
uint8 TargetSearcherCheckType
Definition GameObject.h:54
struct GameObjectValue::@234 FishingHole
struct GameObjectValue::@236 Building
struct GameObjectValue::@232 Trap
uint32 MaxHealth
Definition GameObject.h:76
uint32 Health
Definition GameObject.h:75

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, GAMEOBJECT_FACTION, GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING, GAMEOBJECT_TYPE_FISHINGHOLE, GAMEOBJECT_TYPE_FISHINGNODE, GAMEOBJECT_TYPE_TRAP, Map::GenerateLowGuid(), ZoneScript::GetGameObjectEntry(), GetGOInfo(), Map::GetId(), WorldObject::GetInstanceScript(), GetScriptId(), GetSpawnId(), GetTemplateAddon(), GO_STATE_READY, GameObjectValue::Health, Infinite, GameObjectTemplate::intactNumHits, INVISIBILITY_TRAP, GameObjectAddon::invisibilityType, GameObjectAddon::InvisibilityValue, GameObjectTemplate::invisible, GameObjectTemplate::IsInfiniteGameObject(), IsInstanceGameobject(), GameObjectTemplate::IsLargeGameObject(), Position::IsPositionValid(), Large, 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, GameObjectAddon::ParentRotation, Position::Relocate(), ReplaceAllGameObjectFlags(), SetDisplayId(), Object::SetEntry(), SetGoAnimProgress(), SetGoArtKit(), SetGoState(), SetGoType(), SetLinkedTrap(), WorldObject::SetMap(), WorldObject::SetName(), Object::SetObjectScale(), SetPhaseMask(), SetTransportPathRotation(), Object::SetUInt32Value(), WorldObject::SetVisibilityDistanceOverride(), SetWorldRotation(), WorldObject::SetZoneScript(), GameObjectTemplate::size, sObjectMgr, GameObjectTemplate::spellId, sSpellMgr, STEALTH_TRAP, GameObjectTemplate::stealthed, SwitchDoorOrButton(), TARGET_CHECK_ALLY, TARGET_CHECK_DEFAULT, TARGET_CHECK_ENEMY, TARGET_OBJECT_TYPE_UNIT, GameObjectValue::TargetSearcherCheckType, GameObjectValue::Trap, GameObjectTemplate::trap, GameObjectTemplate::type, WorldObject::UpdatePositionData(), urand(), QuaternionData::w, QuaternionData::x, QuaternionData::y, and QuaternionData::z.

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
3063{
3064 return GameObjectModel::Create(std::make_unique<GameObjectModelOwnerImpl>(this), sWorld->GetDataPath());
3065}
static GameObjectModel * Create(std::unique_ptr< GameObjectModelOwnerBase > modelOwner, std::string const &dataPath)
Definition GameObjectModel.cpp:161

References GameObjectModel::Create(), and sWorld.

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

◆ Delete()

void GameObject::Delete ( )
1093{
1096
1098
1100
1101 if (GameObjectTemplateAddon const* addon = GetTemplateAddon())
1103
1104 // Xinef: if ritual gameobject is removed, clear anim spells
1107
1108 uint32 poolid = m_spawnId ? sPoolMgr->IsPartOfAPool<GameObject>(m_spawnId) : 0;
1109 if (poolid)
1110 sPoolMgr->UpdatePool<GameObject>(GetMap()->GetPoolData(), poolid, m_spawnId);
1111 else
1113}
#define sPoolMgr
Definition PoolMgr.h:216
@ GAMEOBJECT_TYPE_SUMMONING_RITUAL
Definition SharedDefines.h:1582
void SetLootState(LootState s, Unit *unit=nullptr)
Definition GameObject.cpp:2547
void ClearRitualList()
Definition GameObject.cpp:300
SpawnedPoolData & GetPoolData()
Definition Map.h:384
void AddObjectToRemoveList()
Definition Object.cpp:2239
void SendObjectDeSpawnAnim(ObjectGuid guid)
Definition Object.cpp:2196

References WorldObject::AddObjectToRemoveList(), ClearRitualList(), GAMEOBJECT_TYPE_SUMMONING_RITUAL, GetGOInfo(), Object::GetGUID(), WorldObject::GetMap(), Map::GetPoolData(), 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(), npc_overlord_drakuru_betrayal::DoAction(), go_ahune_ice_stone::GossipSelect(), OutdoorPvPSI::HandleCustomSpell(), go_empowering_blood_orb::HandleObjectUse(), instance_razorfen_downs::instance_razorfen_downs_InstanceMapScript::OnGameObjectCreate(), Unit::RemoveAllGameObjects(), Unit::RemoveGameObject(), go_razorscale_mole_machine::go_razorscale_mole_machineAI::Reset(), Update(), go_blood_drenched_door::go_blood_drenched_doorAI::UpdateAI(), go_celestial_planetarium_access::go_celestial_planetarium_accessAI::UpdateAI(), and Use().

◆ DeleteFromDB()

void GameObject::DeleteFromDB ( )
1288{
1290 sObjectMgr->DeleteGOData(m_spawnId);
1291
1293 stmt->SetData(0, m_spawnId);
1294 WorldDatabase.Execute(stmt);
1295
1296 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_EVENT_GAMEOBJECT);
1297 stmt->SetData(0, m_spawnId);
1298 WorldDatabase.Execute(stmt);
1299}
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
Definition DatabaseEnv.cpp:20
@ WORLD_DEL_EVENT_GAMEOBJECT
Definition WorldDatabase.h:39
@ WORLD_DEL_GAMEOBJECT
Definition WorldDatabase.h:38
void RemoveGORespawnTime(ObjectGuid::LowType dbGuid)
Definition Map.cpp:2558
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition PreparedStatement.h:77
Definition PreparedStatement.h:157

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 
)
1044{
1045 if (delay > 0ms)
1046 {
1047 if (!m_despawnDelay || m_despawnDelay > delay.count())
1048 {
1049 m_despawnDelay = delay.count();
1050 m_despawnRespawnTime = forceRespawnTime;
1051 }
1052 }
1053 else
1054 {
1055 if (m_goData)
1056 {
1057 int32 const respawnDelay = (forceRespawnTime > 0s) ? forceRespawnTime.count() : m_goData->spawntimesecs;
1058 SetRespawnTime(respawnDelay);
1059 }
1060
1061 // Respawn is handled by the gameobject itself.
1062 // If we delete it from world, it simply never respawns...
1063 // Uncomment this and remove the following lines if dynamic spawn is implemented.
1064 // Delete();
1065 {
1069
1070 if (GameObject* trap = GetLinkedTrap())
1071 {
1072 trap->DespawnOrUnsummon();
1073 }
1074
1075 if (GameObjectTemplateAddon const* addon = GetTemplateAddon())
1076 {
1078 }
1079
1080 uint32 poolid = m_spawnId ? sPoolMgr->IsPartOfAPool<GameObject>(m_spawnId) : 0;
1081
1082 // Keep the current pooled gameobject reserved until its respawn timer expires.
1083 // GameObject::Update() will update the pool when the object is ready to respawn.
1084 if (poolid && !m_respawnTime)
1085 {
1086 sPoolMgr->UpdatePool<GameObject>(GetMap()->GetPoolData(), poolid, m_spawnId);
1087 }
1088 }
1089 }
1090}
@ GO_JUST_DEACTIVATED
Definition GameObject.h:118
GameObject * GetLinkedTrap()
Definition GameObject.cpp:2840
void SetRespawnTime(int32 respawn)
Definition GameObject.cpp:1403
int32 spawntimesecs
Definition GameObjectData.h:719

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

Referenced by Spell::EffectActivateObject(), boss_onyxia::HatchNearestEgg(), instance_deadmines::instance_deadmines_InstanceMapScript::OnGameObjectCreate(), instance_ulduar::instance_ulduar_InstanceMapScript::OnGameObjectCreate(), instance_molten_core::OnGameObjectCreate(), instance_hyjal::instance_mount_hyjal_InstanceMapScript::OnGameObjectCreate(), instance_temple_of_ahnqiraj::instance_temple_of_ahnqiraj_InstanceMapScript::OnGameObjectCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnGameObjectCreate(), go_strange_pool::OnGossipHello(), go_southfury_moonstone::OnGossipHello(), go_ancient_skull_pile::OnGossipSelect(), SmartScript::ProcessAction(), go_ahune_ice_spear::Reset(), go_skull_pile::SendActionMenu(), go_firework_show::SpawnNextFirework(), npc_midsummer_bonfire::StampOut(), and Update().

◆ EnableCollision()

void GameObject::EnableCollision ( bool  enable)
2710{
2711 if (!m_model)
2712 return;
2713
2714 /*if (enable && !GetMap()->ContainsGameObjectModel(*m_model))
2715 GetMap()->InsertGameObjectModel(*m_model);*/
2716
2717 uint32 phaseMask = 0;
2718 if (enable && !sDisableMgr->IsDisabledFor(DISABLE_TYPE_GO_LOS, GetEntry(), nullptr))
2719 phaseMask = GetPhaseMask();
2720
2721 m_model->enable(phaseMask);
2722}
#define sDisableMgr
Definition DisableMgr.h:88
@ DISABLE_TYPE_GO_LOS
Definition DisableMgr.h:35
void enable(uint32 ph_mask)
Definition GameObjectModel.h:69
uint32 GetPhaseMask() const
Definition Object.h:523

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

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

◆ EventInform()

void GameObject::EventInform ( uint32  eventId)
2288{
2289 if (!eventId)
2290 return;
2291
2292 if (AI())
2293 AI()->EventInform(eventId);
2294
2295 if (m_zoneScript)
2296 m_zoneScript->ProcessEvent(this, eventId);
2297}
virtual void EventInform(uint32)
Definition GameObjectAI.h:65
GameObjectAI * AI() const
Definition GameObject.h:326
virtual void ProcessEvent(WorldObject *, uint32)
Definition ZoneScript.h:54

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

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

◆ GameobjectStateToInt()

uint8 GameObject::GameobjectStateToInt ( GOState *  state) const
2653{
2654 uint8 m_state = 3;
2655
2656 if (state)
2657 {
2658 switch (*state)
2659 {
2660 case GO_STATE_ACTIVE:
2661 m_state = 0;
2662 return m_state;
2663 case GO_STATE_READY:
2664 m_state = 1;
2665 return m_state;
2667 m_state = 2;
2668 return m_state;
2669 }
2670 }
2671
2672 // Returning any value that is not one of the specified ones
2673 // Which will default into the invalid part of the switch
2674 return m_state;
2675}
@ GO_STATE_ACTIVE
Definition GameObjectData.h:708
@ GO_STATE_ACTIVE_ALTERNATIVE
Definition GameObjectData.h:710

References GO_STATE_ACTIVE, GO_STATE_ACTIVE_ALTERNATIVE, and GO_STATE_READY.

Referenced by SaveStateToDB().

◆ GetAIName()

std::string const & GameObject::GetAIName ( ) const
169{
170 return sObjectMgr->GetGameObjectTemplate(GetEntry())->AIName;
171}

References Object::GetEntry(), and sObjectMgr.

Referenced by GetDebugInfo().

◆ GetDebugInfo()

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

Reimplemented from Object.

Reimplemented in MotionTransport.

3194{
3195 std::stringstream sstr;
3196 sstr << WorldObject::GetDebugInfo() << "\n"
3197 << "SpawnId: " << GetSpawnId() << " GoState: " << std::to_string(GetGoState()) << " ScriptId: " << GetScriptId() << " AIName: " << GetAIName();
3198 return sstr.str();
3199}
std::string const & GetAIName() const
Definition GameObject.cpp:168
std::string GetDebugInfo() const override
Definition Object.cpp:2603

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

Referenced by MotionTransport::GetDebugInfo().

◆ GetDestructibleState()

GameObjectDestructibleState GameObject::GetDestructibleState ( ) const
inline
315 {
321 }
@ GO_FLAG_DESTROYED
Definition SharedDefines.h:1615
@ GO_FLAG_DAMAGED
Definition SharedDefines.h:1614
@ GO_DESTRUCTIBLE_DESTROYED
Definition SharedDefines.h:1633
@ GO_DESTRUCTIBLE_INTACT
Definition SharedDefines.h:1631
@ GO_DESTRUCTIBLE_DAMAGED
Definition SharedDefines.h:1632
bool HasGameObjectFlag(GameObjectFlags flags) const
Definition GameObject.h:223

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

◆ GetDynamicFlags()

uint32 GameObject::GetDynamicFlags ( ) const
inlineoverridevirtual

Reimplemented from Object.

References GAMEOBJECT_DYNAMIC, and Object::GetUInt32Value().

◆ GetFaction()

uint32 GameObject::GetFaction ( ) const
inlineoverridevirtual

Reimplemented from WorldObject.

References GAMEOBJECT_FACTION, and Object::GetUInt32Value().

◆ GetFinalWorldRotation()

G3D::Quat GameObject::GetFinalWorldRotation ( ) const
2366{
2367 G3D::Quat worldRotation = GetWorldRotation();
2368 if (Transport* transport = GetTransport())
2369 {
2370 G3D::Quat transportRotation = transport->GetWorldRotation();
2371
2372 G3D::Quat transportRotationQuat(transportRotation.x, transportRotation.y, transportRotation.z, transportRotation.w);
2373 G3D::Quat worldRotationQuat(worldRotation.x, worldRotation.y, worldRotation.z, worldRotation.w);
2374
2375 G3D::Quat resultRotation = worldRotationQuat * transportRotationQuat;
2376
2377 return G3D::Quat(resultRotation.x, resultRotation.y, resultRotation.z, resultRotation.w);
2378 }
2379 return worldRotation;
2380}
G3D::Quat const & GetWorldRotation() const
Definition GameObject.h:155
Definition Transport.h:30

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

Referenced by IsAtInteractDistance().

◆ GetFishLoot()

void GameObject::GetFishLoot ( Loot *  fishLoot,
Player *  lootOwner,
bool  junk = false 
)
1116{
1117 fishLoot->clear();
1118
1119 uint32 zone, area;
1120 uint32 defaultZone = 1;
1121 GetZoneAndAreaId(zone, area);
1122
1123 uint16 lootMode = junk ? LOOT_MODE_JUNK_FISH : LOOT_MODE_DEFAULT;
1124 // Check to fill loot in the order area - zone - defaultZone.
1125 // This is because area and zone is not set in some places, like Off the coast of Storm Peaks.
1126 uint32 lootZones[] = { area, zone, defaultZone };
1127 for (uint32 fillZone : lootZones)
1128 {
1129 fishLoot->FillLoot(fillZone, LootTemplates_Fishing, lootOwner, true, true, lootMode);
1130
1131 // If the loot is filled and the loot is eligible, then we break out of the loop.
1132 if (!fishLoot->empty() && !fishLoot->isLooted())
1133 break;
1134 }
1135}
LootStore LootTemplates_Fishing("fishing_loot_template", "area id", true)
@ LOOT_MODE_DEFAULT
Definition SharedDefines.h:43
@ LOOT_MODE_JUNK_FISH
Definition SharedDefines.h:48
void GetZoneAndAreaId(uint32 &zoneid, uint32 &areaid) const
Definition Object.cpp:3194
bool empty() const
Definition LootMgr.h:367
bool isLooted() const
Definition LootMgr.h:368
void clear()
Definition LootMgr.h:343
bool FillLoot(uint32 lootId, LootStore const &store, Player *lootOwner, bool personal, bool noEmptyError=false, uint16 lootMode=LOOT_MODE_DEFAULT, WorldObject *lootSource=nullptr)
Definition LootMgr.cpp:540

References Loot::clear(), Loot::empty(), Loot::FillLoot(), WorldObject::GetZoneAndAreaId(), Loot::isLooted(), LOOT_MODE_DEFAULT, 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
215{ return GetByteValue(GAMEOBJECT_BYTES_1, 3); }
@ GAMEOBJECT_BYTES_1
Definition UpdateFields.h:404
uint8 GetByteValue(uint16 index, uint8 offset) const
Definition Object.cpp:321

References GAMEOBJECT_BYTES_1, and Object::GetByteValue().

Referenced by SaveToDB(), Update(), and Use().

◆ GetGoArtKit()

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

References GAMEOBJECT_BYTES_1, and Object::GetByteValue().

Referenced by SaveToDB().

◆ GetGOInfo()

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

References m_goInfo.

Referenced by ActivateToQuest(), BuildValuesUpdate(), Spell::CheckCast(), CheckRitualList(), ClearRitualList(), Create(), StaticTransport::Create(), Delete(), WorldSession::DoLootRelease(), Spell::EffectOpenLock(), MotionTransport::EnableMovement(), BattlegroundSA::EventPlayerDamagedGO(), Player::GetDefaultGossipMenuForSource(), getLevelForTarget(), 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(), IsAtInteractDistance(), IsDestructibleBuilding(), IsMotionTransport(), IsNeverVisible(), IsStaticTransport(), IsTransport(), LoadGameObjectFromDB(), MotionTransport::LoadStaticPassengers(), ModifyHealth(), instance_naxxramas::OnGameObjectCreate(), instance_naxxramas::OnGameObjectRemove(), icecrown_citadel_teleport::OnGossipHello(), go_simon_cluster::OnGossipHello(), go_apexis_relic::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(), ToMotionTransport(), ToStaticTransport(), ToStaticTransport(), ToTransport(), ToTransport(), BfCapturePoint::Update(), OPvPCapturePoint::Update(), MotionTransport::Update(), OPvPCapturePointNA::Update(), Update(), Use(), and UseDoorOrButton().

◆ GetGoState()

◆ GetGoType()

◆ GetGOValue()

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

References m_goValue.

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

◆ GetInteractionDistance()

float GameObject::GetInteractionDistance ( ) const
2978{
2979 switch (GetGoType())
2980 {
2982 return 0.0f;
2988 return 5.5555553f;
2990 return 10.0f;
2993 return 3.0f;
2995 return 100.0f;
2997 return 20.0f + CONTACT_DISTANCE; // max spell range
3003 return 5.0f;
3004 // Following values are not blizzlike
3007 // 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.
3008 // 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.
3009 return 10.0f; // 5.0f is blizzlike
3010 default:
3011 return INTERACTION_DISTANCE;
3012 }
3013}
#define INTERACTION_DISTANCE
Definition ObjectDefines.h:24
#define CONTACT_DISTANCE
Definition ObjectDefines.h:23
@ GAMEOBJECT_TYPE_GUILD_BANK
Definition SharedDefines.h:1598
@ GAMEOBJECT_TYPE_MINI_GAME
Definition SharedDefines.h:1591
@ GAMEOBJECT_TYPE_CAMERA
Definition SharedDefines.h:1577
@ GAMEOBJECT_TYPE_MAP_OBJECT
Definition SharedDefines.h:1578
@ GAMEOBJECT_TYPE_FLAGDROP
Definition SharedDefines.h:1590
@ GAMEOBJECT_TYPE_MAILBOX
Definition SharedDefines.h:1583
@ GAMEOBJECT_TYPE_FLAGSTAND
Definition SharedDefines.h:1588
@ GAMEOBJECT_TYPE_CHAIR
Definition SharedDefines.h:1571
@ GAMEOBJECT_TYPE_TEXT
Definition SharedDefines.h:1573
@ GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY
Definition SharedDefines.h:1595
@ GAMEOBJECT_TYPE_AREADAMAGE
Definition SharedDefines.h:1576
@ GAMEOBJECT_TYPE_BARBER_CHAIR
Definition SharedDefines.h:1596
@ GAMEOBJECT_TYPE_DOOR
Definition SharedDefines.h:1564
@ GAMEOBJECT_TYPE_BINDER
Definition SharedDefines.h:1568

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.

285 {
286 if (Unit* owner = GetOwner())
287 return owner->getLevelForTarget(target);
288
290 {
291 // use the level from the trap template, otherwise match the target
292 // so ownerless utility traps cannot miss through level difference
293 if (GetGOInfo()->trap.level)
294 return GetGOInfo()->trap.level;
295 if (Unit const* targetUnit = target->ToUnit())
296 return targetUnit->GetLevel();
297 }
298
299 return 1;
300 }
Unit * GetOwner() const
Definition GameObject.cpp:1338
Unit * ToUnit()
Definition Object.h:216
Definition Unit.h:670
uint32 level
Definition GameObjectData.h:93

References GAMEOBJECT_TYPE_TRAP, GetGOInfo(), GetGoType(), GetOwner(), GameObjectTemplate::level, Object::ToUnit(), and GameObjectTemplate::trap.

◆ GetLinkedTrap()

GameObject * GameObject::GetLinkedTrap ( )
2841{
2843}
ObjectGuid m_linkedTrap
Definition GameObject.h:427
GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:208

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().

◆ GetLootGenerationTime()

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

References m_lootGenerationTime.

Referenced by Player::SendLoot().

◆ GetLootMode()

uint16 GameObject::GetLootMode ( ) const
inline

◆ GetLootRecipient()

Player * GameObject::GetLootRecipient ( ) const
2738{
2739 if (!m_lootRecipient)
2740 return nullptr;
2742}
ObjectGuid m_lootRecipient
Definition GameObject.h:422
Player * FindConnectedPlayer(ObjectGuid const guid)
Definition ObjectAccessor.cpp:281

References ObjectAccessor::FindConnectedPlayer(), and m_lootRecipient.

◆ GetLootRecipientGroup()

Group * GameObject::GetLootRecipientGroup ( ) const
2745{
2747 return nullptr;
2748 return sGroupMgr->GetGroupByGUID(m_lootRecipientGroup);
2749}
#define sGroupMgr
Definition GroupMgr.h:51

References m_lootRecipientGroup, and sGroupMgr.

Referenced by IsLootAllowedFor().

◆ GetLootRecipientGroupGUID()

ObjectGuid::LowType GameObject::GetLootRecipientGroupGUID ( ) const
inline
258{ return m_lootRecipientGroup; }

References m_lootRecipientGroup.

◆ GetLootRecipientGUID()

ObjectGuid GameObject::GetLootRecipientGUID ( ) const
inline
256{ return m_lootRecipient; }

References m_lootRecipient.

◆ getLootState()

◆ GetNameForLocaleIdx()

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

Reimplemented from WorldObject.

2310{
2311 if (loc_idx != DEFAULT_LOCALE)
2312 {
2313 uint8 uloc_idx = uint8(loc_idx);
2314 if (GameObjectLocale const* cl = sObjectMgr->GetGameObjectLocale(GetEntry()))
2315 if (cl->Name.size() > uloc_idx && !cl->Name[uloc_idx].empty())
2316 return cl->Name[uloc_idx];
2317 }
2318
2319 return GetName();
2320}
#define DEFAULT_LOCALE
Definition Common.h:140
std::string const & GetName() const
Definition Object.h:535
Definition GameObjectData.h:677

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

Referenced by gobject_commandscript::HandleGameObjectRespawn().

◆ GetOwner()

Unit * GameObject::GetOwner ( ) const
1339{
1340 return ObjectAccessor::GetUnit(*this, GetOwnerGUID());
1341}
Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:223

References GetOwnerGUID(), and ObjectAccessor::GetUnit().

Referenced by Spell::EffectOpenLock(), getLevelForTarget(), go_soulwell::go_soulwellAI::GossipHello(), IsAlwaysVisibleFor(), TriggeringLinkedGameObject(), Update(), and Use().

◆ GetOwnerGUID()

◆ GetPackedWorldRotation()

int64 GameObject::GetPackedWorldRotation ( ) const
inline
156{ 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
2946{
2947 if (m_spawnId)
2948 {
2949 if (GameObjectData const* data = sObjectMgr->GetGameObjectData(m_spawnId))
2950 {
2951 x = data->posX;
2952 y = data->posY;
2953 z = data->posZ;
2954 if (ori)
2955 *ori = data->orientation;
2956 return;
2957 }
2958 }
2959
2960 x = GetPositionX();
2961 y = GetPositionY();
2962 z = GetPositionZ();
2963 if (ori)
2964 *ori = GetOrientation();
2965}
Definition GameObjectData.h:715
float GetPositionZ() const
Definition Position.h:123
float GetOrientation() const
Definition Position.h:124
float GetPositionX() const
Definition Position.h:121
float GetPositionY() const
Definition Position.h:122

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

◆ GetRespawnTime()

time_t GameObject::GetRespawnTime ( ) const
inline
190{ return m_respawnTime; }

References m_respawnTime.

Referenced by spell_q9452_cast_net::CheckCast(), and Player::SendLoot().

◆ GetRespawnTimeEx()

time_t GameObject::GetRespawnTimeEx ( ) const
3029{
3030 time_t now = GameTime::GetGameTime().count();
3031 if (m_respawnTime > now)
3032 return m_respawnTime;
3033 else
3034 return now;
3035}
Seconds GetGameTime()
Definition GameTime.cpp:39

References GameTime::GetGameTime(), and m_respawnTime.

Referenced by gobject_commandscript::HandleGameObjectTargetCommand().

◆ GetScriptId()

◆ GetSpawnId()

◆ GetSpellForLock()

SpellInfo const * GameObject::GetSpellForLock ( Player const *  player) const
3115{
3116 if (!player)
3117 {
3118 return nullptr;
3119 }
3120
3121 uint32 lockId = GetGOInfo()->GetLockId();
3122 if (!lockId)
3123 {
3124 return nullptr;
3125 }
3126
3127 LockEntry const* lock = sLockStore.LookupEntry(lockId);
3128 if (!lock)
3129 {
3130 return nullptr;
3131 }
3132
3133 for (uint8 i = 0; i < MAX_LOCK_CASE; ++i)
3134 {
3135 if (!lock->Type[i])
3136 {
3137 continue;
3138 }
3139
3140 if (lock->Type[i] == LOCK_KEY_SPELL)
3141 {
3142 if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(lock->Index[i]))
3143 {
3144 return spell;
3145 }
3146 }
3147
3148 if (lock->Type[i] != LOCK_KEY_SKILL)
3149 {
3150 break;
3151 }
3152
3153 for (auto&& playerSpell : player->GetSpellMap())
3154 {
3155 if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(playerSpell.first))
3156 {
3157 for (auto&& effect : spell->Effects)
3158 {
3159 if (effect.Effect == SPELL_EFFECT_OPEN_LOCK && ((uint32) effect.MiscValue) == lock->Index[i])
3160 {
3161 if (effect.CalcValue(player) >= int32(lock->Skill[i]))
3162 {
3163 return spell;
3164 }
3165 }
3166 }
3167 }
3168 }
3169 }
3170
3171 return nullptr;
3172}
DBCStorage< LockEntry > sLockStore(LockEntryfmt)
#define MAX_LOCK_CASE
Definition DBCStructure.h:1341
@ SPELL_EFFECT_OPEN_LOCK
Definition SharedDefines.h:799
@ LOCK_KEY_SKILL
Definition SharedDefines.h:2590
@ LOCK_KEY_SPELL
Definition SharedDefines.h:2591
uint32 GetLockId() const
Definition GameObjectData.h:428
Definition DBCStructure.h:1344
uint32 Type[MAX_LOCK_CASE]
Definition DBCStructure.h:1346
uint32 Index[MAX_LOCK_CASE]
Definition DBCStructure.h:1347
uint32 Skill[MAX_LOCK_CASE]
Definition DBCStructure.h:1348

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

◆ 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
248{ return m_unique_users.size(); }

References m_unique_users.

Referenced by Update(), and Use().

◆ GetUseCount()

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

References m_usetimes.

Referenced by WorldSession::DoLootRelease().

◆ GetWorldRotation()

G3D::Quat const & GameObject::GetWorldRotation ( ) const
inline
155{ return WorldRotation; }
G3D::Quat WorldRotation
Definition GameObject.h:419

References WorldRotation.

Referenced by GetFinalWorldRotation().

◆ HasGameObjectFlag()

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

References GAMEOBJECT_FLAGS, and Object::HasFlag().

Referenced by GetDestructibleState(), WorldSession::HandleGameobjectReportUse(), and Use().

◆ hasInvolvedQuest()

bool GameObject::hasInvolvedQuest ( uint32  quest_id) const
overridevirtual

Reimplemented from Object.

1316{
1317 QuestRelationBounds qir = sObjectMgr->GetGOQuestInvolvedRelationBounds(GetEntry());
1318 for (QuestRelations::const_iterator itr = qir.first; itr != qir.second; ++itr)
1319 {
1320 if (itr->second == quest_id)
1321 return true;
1322 }
1323 return false;
1324}
std::pair< QuestRelations::const_iterator, QuestRelations::const_iterator > QuestRelationBounds
Definition ObjectMgr.h:531

References Object::GetEntry(), and sObjectMgr.

◆ HasLootMode()

bool GameObject::HasLootMode ( uint16  lootMode) const
inline
235{ 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.

1305{
1306 QuestRelationBounds qr = sObjectMgr->GetGOQuestRelationBounds(GetEntry());
1307 for (QuestRelations::const_iterator itr = qr.first; itr != qr.second; ++itr)
1308 {
1309 if (itr->second == quest_id)
1310 return true;
1311 }
1312 return false;
1313}

References Object::GetEntry(), and sObjectMgr.

◆ IsAllowedToSaveToDB()

bool GameObject::IsAllowedToSaveToDB ( ) const
inline
376{ return m_saveStateOnDb; };

References m_saveStateOnDb.

Referenced by SetGoState().

◆ IsAlwaysVisibleFor()

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

Reimplemented from WorldObject.

1364{
1366 return true;
1367
1369 return true;
1370
1371 if (!seer)
1372 return false;
1373
1374 // Always seen by owner and friendly units
1375 if (ObjectGuid guid = GetOwnerGUID())
1376 {
1377 if (seer->GetGUID() == guid)
1378 return true;
1379
1380 Unit* owner = GetOwner();
1381 if (owner)
1382 {
1383 if (seer->IsUnit() && owner->IsFriendlyTo(seer->ToUnit()))
1384 return true;
1385 }
1386 }
1387
1388 return false;
1389}
bool IsDestructibleBuilding() const
Definition GameObject.cpp:1331
bool IsFriendlyTo(Unit const *unit) const
Definition Unit.cpp:7079
virtual bool IsAlwaysVisibleFor(WorldObject const *) const
Definition Object.h:822

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

◆ IsAtInteractDistance() [1/2]

bool GameObject::IsAtInteractDistance ( Player const *  player,
SpellInfo const *  spell = nullptr 
) const
3068{
3069 if (spell || (spell = GetSpellForLock(player)))
3070 {
3071 float maxRange = spell->GetMaxRange(spell->IsPositive());
3072
3074 {
3075 return maxRange * maxRange >= GetExactDistSq(player);
3076 }
3077
3078 if (sGameObjectDisplayInfoStore.LookupEntry(GetGOInfo()->displayId))
3079 {
3080 return IsAtInteractDistance(*player, maxRange);
3081 }
3082 }
3083
3085}
DBCStorage< GameObjectDisplayInfoEntry > sGameObjectDisplayInfoStore(GameObjectDisplayInfofmt)
bool IsAtInteractDistance(Position const &pos, float radius) const
Definition GameObject.cpp:3087
SpellInfo const * GetSpellForLock(Player const *player) const
Definition GameObject.cpp:3114
float GetInteractionDistance() const
Definition GameObject.cpp:2977
float GetExactDistSq(float x, float y, float z) const
Definition Position.h:174

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
3088{
3089 if (GameObjectDisplayInfoEntry const* displayInfo = sGameObjectDisplayInfoStore.LookupEntry(GetGOInfo()->displayId))
3090 {
3091 float scale = GetObjectScale();
3092
3093 float minX = displayInfo->minX * scale - radius;
3094 float minY = displayInfo->minY * scale - radius;
3095 float minZ = displayInfo->minZ * scale - radius;
3096 float maxX = displayInfo->maxX * scale + radius;
3097 float maxY = displayInfo->maxY * scale + radius;
3098 float maxZ = displayInfo->maxZ * scale + radius;
3099
3100 G3D::Quat finalRotation = GetFinalWorldRotation();
3101 G3D::Quat finalRotationQuat(finalRotation.x, finalRotation.y, finalRotation.z, finalRotation.w);
3102
3103 return G3D::CoordinateFrame {{finalRotationQuat}, {GetPositionX(), GetPositionY(), GetPositionZ()}}.toWorldSpace(G3D::Box {{minX, minY, minZ}, {maxX, maxY, maxZ}}).contains({pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()});
3104 }
3105
3106 return GetExactDist(&pos) <= radius;
3107}
G3D::Quat GetFinalWorldRotation() const
Definition GameObject.cpp:2365
float GetObjectScale() const
Definition Object.h:126
Definition DBCStructure.h:1039
float GetExactDist(float x, float y, float z) const
Definition Position.h:182

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

Referenced by IsAtInteractDistance(), and IsWithinDistInMap().

◆ IsDestructibleBuilding()

bool GameObject::IsDestructibleBuilding ( ) const
1332{
1333 GameObjectTemplate const* gInfo = GetGOInfo();
1334 if (!gInfo) return false;
1336}

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

Referenced by IsAlwaysVisibleFor(), and ModifyHealth().

◆ IsInRange2d()

bool GameObject::IsInRange2d ( float  x,
float  y,
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

2236{
2238 if (!info)
2239 return IsWithinDist2d(x, y, radius);
2240
2241 float sinA = std::sin(GetOrientation());
2242 float cosA = cos(GetOrientation());
2243 float dx = x - GetPositionX();
2244 float dy = y - GetPositionY();
2245 float dist = std::sqrt(dx * dx + dy * dy);
2248 if (G3D::fuzzyEq(dist, 0.0f))
2249 return true;
2250
2251 float scale = GetObjectScale();
2252 float sinB = dx / dist;
2253 float cosB = dy / dist;
2254 dx = dist * (cosA * cosB + sinA * sinB);
2255 dy = dist * (cosA * sinB - sinA * cosB);
2256 return dx < (info->maxX * scale) + radius && dx >(info->minX * scale) - radius
2257 && dy < (info->maxY * scale) + radius && dy >(info->minY * scale) - radius;
2258}
bool IsWithinDist2d(float x, float y, float dist) const
Definition Object.cpp:1364
float maxX
Definition DBCStructure.h:1046
float maxY
Definition DBCStructure.h:1047
float minY
Definition DBCStructure.h:1044
float minX
Definition DBCStructure.h:1043

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

Referenced by IsWithinSightRange().

◆ IsInRange3d()

bool GameObject::IsInRange3d ( 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

2261{
2263 if (!info)
2264 return IsWithinDist3d(x, y, z, radius);
2265
2266 float sinA = std::sin(GetOrientation());
2267 float cosA = cos(GetOrientation());
2268 float dx = x - GetPositionX();
2269 float dy = y - GetPositionY();
2270 float dz = z - GetPositionZ();
2271 float dist = std::sqrt(dx * dx + dy * dy);
2274 if (G3D::fuzzyEq(dist, 0.0f))
2275 return true;
2276
2277 float scale = GetObjectScale();
2278 float sinB = dx / dist;
2279 float cosB = dy / dist;
2280 dx = dist * (cosA * cosB + sinA * sinB);
2281 dy = dist * (cosA * sinB - sinA * cosB);
2282 return dx < (info->maxX * scale) + radius && dx > (info->minX * scale) - radius
2283 && dy < (info->maxY * scale) + radius && dy > (info->minY * scale) - radius
2284 && dz < (info->maxZ * scale) + radius && dz > (info->minZ * scale) - radius;
2285}
bool IsWithinDist3d(float x, float y, float z, float dist) const
Definition Object.cpp:1354
float minZ
Definition DBCStructure.h:1045
float maxZ
Definition DBCStructure.h:1048

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 const &  playerGuid) const
3181{
3182 for (auto const& itr : m_SkillupList)
3183 {
3184 if (itr.first == playerGuid)
3185 {
3186 return true;
3187 }
3188 }
3189
3190 return false;
3191}

References m_SkillupList.

Referenced by Spell::EffectOpenLock().

◆ IsInstanceGameobject()

bool GameObject::IsInstanceGameobject ( ) const
2619{
2620 // Avoid checking for unecessary gameobjects whose
2621 // states don't matter for the dungeon progression
2623 {
2624 return false;
2625 }
2626
2627 if (auto* map = FindMap())
2628 {
2629 if (map->IsDungeon() || map->IsRaid())
2630 {
2631 return true;
2632 }
2633 }
2634 return false;
2635}
bool ValidateGameobjectType() const
Definition GameObject.cpp:2637
Map * FindMap() const
Definition Object.h:638

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

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

◆ IsInvisibleDueToDespawn()

bool GameObject::IsInvisibleDueToDespawn ( ) const
overridevirtual

Reimplemented from WorldObject.

1392{
1394 return true;
1395
1396 // Despawned
1397 if (!isSpawned())
1398 return true;
1399
1400 return false;
1401}
bool isSpawned() const
Definition GameObject.h:196
virtual bool IsInvisibleDueToDespawn() const
Definition Object.h:823

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

◆ IsLootAllowedFor()

bool GameObject::IsLootAllowedFor ( Player const *  player) const
2808{
2810 {
2811 return true;
2812 }
2813
2814 if (player->GetGUID() == m_lootRecipient)
2815 {
2816 return true;
2817 }
2818
2819 if (player->HasPendingBind())
2820 {
2821 return false;
2822 }
2823
2824 // if we dont have a group we arent the recipient
2825 // if go doesnt have group bound it means it was solo killed by someone else
2826 Group const* playerGroup = player->GetGroup();
2827 if (!playerGroup || playerGroup != GetLootRecipientGroup())
2828 {
2829 return false;
2830 }
2831
2832 if (!HasAllowedLooter(player->GetGUID()))
2833 {
2834 return false;
2835 }
2836
2837 return true;
2838}
Group * GetLootRecipientGroup() const
Definition GameObject.cpp:2744
Definition Group.h:178
bool HasAllowedLooter(ObjectGuid guid) const
Definition Object.cpp:3234

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.

1353{
1355 return true;
1356
1357 if (GetGoType() == GAMEOBJECT_TYPE_SPELL_FOCUS && GetGOInfo()->spellFocus.serverOnly == 1)
1358 return true;
1359
1360 return false;
1361}
virtual bool IsNeverVisible() const
Definition Object.h:821
uint32 serverOnly
Definition GameObjectData.h:108

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

◆ IsRespawnCompatibilityMode()

bool GameObject::IsRespawnCompatibilityMode ( ) const
inline
bool _respawnCompatibilityMode
Definition GameObject.h:392

References _respawnCompatibilityMode.

◆ isSpawned()

◆ isSpawnedByDefault()

bool GameObject::isSpawnedByDefault ( ) const
inline

◆ IsStaticTransport()

bool GameObject::IsStaticTransport ( ) const
inline

◆ IsTransport()

◆ IsUpdateNeeded()

bool GameObject::IsUpdateNeeded ( )
overridevirtual

Reimplemented from WorldObject.

3203{
3205 return true;
3206
3207 if (GetMap()->isCellMarked(GetCurrentCell().GetCellCoord().GetId()))
3208 return true;
3209
3210 if (!GetObjectVisibilityContainer().GetVisiblePlayersMap().empty())
3211 return true;
3212
3213 if (IsTransport())
3214 return true;
3215
3216 return false;
3217}
Cell const & GetCurrentCell() const
Definition Object.h:429
virtual bool IsUpdateNeeded()
Definition Object.cpp:3254
ObjectVisibilityContainer & GetObjectVisibilityContainer()
Definition Object.h:744

References MovableMapObject::GetCurrentCell(), WorldObject::GetMap(), WorldObject::GetObjectVisibilityContainer(), IsTransport(), and WorldObject::IsUpdateNeeded().

◆ 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  incOwnRadius = true,
bool  incTargetRadius = true 
) const
1387{
1388 return obj && IsInMap(obj) && InSamePhase(obj) && _IsWithinDist(obj, dist2compare, is3D, incOwnRadius, incTargetRadius);
1389}
bool _IsWithinDist(WorldObject const *obj, float dist2compare, bool, bool, bool) const override
Object distance/size - overridden from Object::_IsWithinDist. Needs to take in account proper GO size...
Definition GameObject.h:439

◆ IsWithinSightRange()

bool GameObject::IsWithinSightRange ( Position const &  pos,
float  dist 
) const
overrideprivatevirtual

Reimplemented from WorldObject.

2336{
2337 return IsInRange2d(pos.GetPositionX(), pos.GetPositionY(), dist);
2338}
bool IsInRange2d(float x, float y, float radius) const
Definition GameObject.cpp:2235

References Position::GetPositionX(), Position::GetPositionY(), and IsInRange2d().

◆ LoadFromDB()

virtual bool GameObject::LoadFromDB ( ObjectGuid::LowType  guid,
Map *  map 
)
inlinevirtual

Reimplemented in StaticTransport.

164{ return LoadGameObjectFromDB(guid, map, false); }
virtual bool LoadGameObjectFromDB(ObjectGuid::LowType guid, Map *map, bool addToMap=true)
Definition GameObject.cpp:1218

References LoadGameObjectFromDB().

Referenced by GridObjectLoader::LoadGameObjects().

◆ LoadGameObjectFromDB()

bool GameObject::LoadGameObjectFromDB ( ObjectGuid::LowType  guid,
Map *  map,
bool  addToMap = true 
)
virtual

Reimplemented in StaticTransport.

1219{
1220 GameObjectData const* data = sObjectMgr->GetGameObjectData(spawnId);
1221
1222 if (!data)
1223 {
1224 LOG_ERROR("sql.sql", "Gameobject (GUID: {}) not found in table `gameobject`, can't load. ", spawnId);
1225 return false;
1226 }
1227
1228 uint32 entry = data->id;
1229 //uint32 map_id = data->mapid; // already used before call
1230 uint32 phaseMask = data->phaseMask;
1231 float x = data->posX;
1232 float y = data->posY;
1233 float z = data->posZ;
1234 float ang = data->orientation;
1235
1236 uint32 animprogress = data->animprogress;
1237 GOState go_state = data->go_state;
1238 uint32 artKit = data->artKit;
1239
1240 m_goData = data;
1241 m_spawnId = spawnId;
1242
1243 // Set respawn compatibility mode based on spawn group flags
1244 SpawnGroupTemplateData const* groupData = sObjectMgr->GetSpawnGroupData(data->spawnGroupId);
1246 || !groupData || (groupData->flags & SPAWNGROUP_FLAG_COMPATIBILITY_MODE);
1247
1248 if (!Create(map->GenerateLowGuid<HighGuid::GameObject>(), entry, map, phaseMask, x, y, z, ang, data->rotation, animprogress, go_state, artKit))
1249 return false;
1250
1251 if (data->spawntimesecs >= 0)
1252 {
1253 m_spawnedByDefault = true;
1254
1256 {
1259 m_respawnTime = 0;
1260 }
1261 else
1262 {
1265
1266 // ready to respawn
1268 {
1269 m_respawnTime = 0;
1271 }
1272 }
1273 }
1274 else
1275 {
1276 m_spawnedByDefault = false;
1278 m_respawnTime = 0;
1279 }
1280
1281 if (addToMap && !GetMap()->AddToMap(this))
1282 return false;
1283
1284 return true;
1285}
@ GO_FLAG_NODESPAWN
Definition SharedDefines.h:1612
@ SPAWNGROUP_FLAG_COMPATIBILITY_MODE
Definition SpawnData.h:45
@ CONFIG_RESPAWN_FORCE_COMPATIBILITY_MODE
Definition WorldConfig.h:403
void SetGameObjectFlag(GameObjectFlags flags)
Definition GameObject.h:224
time_t GetGORespawnTime(ObjectGuid::LowType dbGuid) const
Definition Map.h:425
uint8 artKit
Definition GameObjectData.h:722
G3D::Quat rotation
Definition GameObjectData.h:718
uint32 animprogress
Definition GameObjectData.h:720
uint32 id
Definition GameObjectData.h:717
GOState go_state
Definition GameObjectData.h:721
bool IsDespawnAtAction() const
Definition GameObjectData.h:398
bool GetDespawnPossibility() const
Definition GameObjectData.h:459
float posX
Definition SpawnData.h:71
float posY
Definition SpawnData.h:72
uint32 phaseMask
Definition SpawnData.h:70
float orientation
Definition SpawnData.h:74
uint32 spawnGroupId
Definition SpawnData.h:78
float posZ
Definition SpawnData.h:73
Definition SpawnData.h:58
SpawnGroupFlags flags
Definition SpawnData.h:62

References _respawnCompatibilityMode, GameObjectData::animprogress, GameObjectData::artKit, CONFIG_RESPAWN_FORCE_COMPATIBILITY_MODE, Create(), SpawnGroupTemplateData::flags, GameObject, Map::GenerateLowGuid(), GameObjectTemplate::GetDespawnPossibility(), GameTime::GetGameTime(), GetGOInfo(), Map::GetGORespawnTime(), WorldObject::GetMap(), GO_FLAG_NODESPAWN, GameObjectData::go_state, GameObjectData::id, GameObjectTemplate::IsDespawnAtAction(), LOG_ERROR, m_goData, m_respawnDelayTime, m_respawnTime, m_spawnedByDefault, m_spawnId, SpawnData::orientation, SpawnData::phaseMask, SpawnData::posX, SpawnData::posY, SpawnData::posZ, Map::RemoveGORespawnTime(), GameObjectData::rotation, SetGameObjectFlag(), sObjectMgr, SPAWNGROUP_FLAG_COMPATIBILITY_MODE, SpawnData::spawnGroupId, GameObjectData::spawntimesecs, and sWorld.

Referenced by ObjectMgr::AddGOData(), MotionTransport::CreateGOPassenger(), GameEventMgr::GameEventSpawn(), gobject_commandscript::HandleGameObjectAddCommand(), gobject_commandscript::HandleGameObjectLoadCommand(), gobject_commandscript::HandleGameObjectMoveCommand(), gobject_commandscript::HandleGameObjectTurnCommand(), LoadFromDB(), Map::ProcessGameObjectRespawn(), and Map::SpawnGroupSpawn().

◆ LookupFishingHoleAround()

GameObject * GameObject::LookupFishingHoleAround ( float  range)
1524{
1525 GameObject* ok = nullptr;
1526
1527 Acore::NearestGameObjectFishingHole u_check(*this, range);
1529
1530 Cell::VisitObjects(this, checker, range);
1531 return ok;
1532}
Definition GridNotifiers.h:705
Definition GridNotifiers.h:342
static void VisitObjects(WorldObject const *obj, T &visitor, float radius)
Definition CellImpl.h:165

References Cell::VisitObjects().

Referenced by Use().

◆ ModifyHealth()

void GameObject::ModifyHealth ( int32  change,
Unit *  attackerOrHealer = nullptr,
uint32  spellId = 0 
)
Todo:
: is there any packet for healing?
2383{
2385 return;
2386
2387 // if this building doesn't have health, return
2389 return;
2390
2391 sScriptMgr->OnGameObjectModifyHealth(this, attackerOrHealer, change, sSpellMgr->GetSpellInfo(spellId));
2392
2393 // if the health isn't being changed, return
2394 if (!change)
2395 return;
2396
2398 change = 0;
2399
2400 // prevent double destructions of the same object
2401 if (change < 0 && !m_goValue.Building.Health)
2402 return;
2403
2404 if (int32(m_goValue.Building.Health) + change <= 0)
2408 else
2409 m_goValue.Building.Health += change;
2410
2411 // Set the health bar, value = 255 * healthPct;
2413
2414 Player* player = attackerOrHealer->GetCharmerOrOwnerPlayerOrPlayerItself();
2415
2416 // dealing damage, send packet
2418 if (player)
2419 {
2420 WorldPacket data(SMSG_DESTRUCTIBLE_BUILDING_DAMAGE, 8 + 8 + 8 + 4 + 4);
2421 data << GetPackGUID();
2422 data << attackerOrHealer->GetPackGUID();
2423 data << player->GetPackGUID();
2424 data << uint32(-change); // change < 0 triggers SPELL_BUILDING_HEAL combat log event
2425 // change >= 0 triggers SPELL_BUILDING_DAMAGE event
2426 data << uint32(spellId);
2427 player->SendDirectMessage(&data);
2428 }
2429
2431
2433 newState = GO_DESTRUCTIBLE_DESTROYED;
2434 else if (m_goValue.Building.Health <= GetGOInfo()->building.damagedNumHits)
2435 newState = GO_DESTRUCTIBLE_DAMAGED;
2437 newState = GO_DESTRUCTIBLE_INTACT;
2438
2439 if (newState == GetDestructibleState())
2440 return;
2441
2442 SetDestructibleState(newState, player, false);
2443}
GameObjectDestructibleState
Definition SharedDefines.h:1630
void SetDestructibleState(GameObjectDestructibleState state, Player *eventInvoker=nullptr, bool setHealth=false)
Definition GameObject.cpp:2445
GameObjectDestructibleState GetDestructibleState() const
Definition GameObject.h:314
PackedGuid const & GetPackGUID() const
Definition Object.h:122
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:5886
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition Unit.cpp:7533
Definition WorldPacket.h:26
@ SMSG_DESTRUCTIBLE_BUILDING_DAMAGE
Definition Opcodes.h:80

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

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

◆ Refresh()

void GameObject::Refresh ( )
1028{
1029 // not refresh despawned not casted GO (despawned casted GO destroyed in all cases anyway)
1031 return;
1032
1033 if (isSpawned())
1034 GetMap()->AddToMap(this);
1035}

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

Referenced by BattlegroundSA::ResetObjs().

◆ RemoveFromOwner()

void GameObject::RemoveFromOwner ( )
private
191{
192 ObjectGuid ownerGUID = GetOwnerGUID();
193 if (!ownerGUID)
194 return;
195
196 if (Unit* owner = ObjectAccessor::GetUnit(*this, ownerGUID))
197 {
198 owner->RemoveGameObject(this, false);
200 return;
201 }
202
203 LOG_DEBUG("entities.gameobject", "Delete GameObject ({} Entry: {} SpellId {} LinkedGO {}) that lost references to owner {} GO list.",
204 GetGUID().ToString(), GetGOInfo()->entry, m_spellId, GetGOInfo()->GetLinkedGameObjectEntry(), ownerGUID.ToString());
205
207}
#define LOG_DEBUG(filterType__,...)
Definition Log.h:157
void SetOwnerGUID(ObjectGuid owner)
Definition GameObject.h:169
static ObjectGuid const Empty
Definition ObjectGuid.h:123
std::string ToString() const
Definition ObjectGuid.cpp:49

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

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

◆ RemoveFromWorld()

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

Reimplemented from Object.

238{
240 if (IsInWorld())
241 {
242 sScriptMgr->OnGameObjectRemoveWorld(this);
243
244 if (m_zoneScript)
246
248
249 if (m_model)
250 if (GetMap()->ContainsGameObjectModel(*m_model))
252
253 if (Transport* transport = GetTransport())
254 transport->RemovePassenger(this, true);
255
256 // If linked trap exists, despawn it
257 if (GameObject* linkedTrap = GetLinkedTrap())
258 {
259 linkedTrap->Delete();
260 }
261
263
264 if (m_spawnId)
265 Acore::Containers::MultimapErasePair(GetMap()->GetGameObjectBySpawnIdStore(), m_spawnId, this);
267 }
268}
void RemoveGameObjectModel(GameObjectModel const &model)
Definition Map.h:404
bool Remove(KEY_TYPE const &handle)
Definition TypeContainer.h:183
void RemoveFromWorld() override
Definition Object.cpp:1233
virtual void OnGameObjectRemove(GameObject *)
Definition ZoneScript.h:38
void MultimapErasePair(M< K, V, Rest... > &multimap, K const &key, V const &value)
Definition Containers.h:236

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(), and go_bear_trap::go_bear_trapAI::UpdateAI().

◆ RemoveGameObjectFlag()

◆ RemoveLootMode()

void GameObject::RemoveLootMode ( uint16  lootMode)
inline
238{ 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

References LOOT_MODE_DEFAULT, and m_LootMode.

Referenced by GameObject().

◆ Respawn()

◆ SaveRespawnTime() [1/2]

void GameObject::SaveRespawnTime ( )
inlineoverridevirtual

Reimplemented from WorldObject.

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

References SaveRespawnTime().

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

◆ SaveRespawnTime() [2/2]

void GameObject::SaveRespawnTime ( uint32  forceDelay)
1344{
1345 if (m_goData && m_goData->dbData && (forceDelay || m_respawnTime > GameTime::GetGameTime().count()) && m_spawnedByDefault)
1346 {
1347 time_t respawnTime = forceDelay ? GameTime::GetGameTime().count() + forceDelay : m_respawnTime;
1348 GetMap()->SaveGORespawnTime(m_spawnId, respawnTime);
1349 }
1350}
void SaveGORespawnTime(ObjectGuid::LowType dbGuid, time_t &respawnTime)
Definition Map.cpp:2529
bool dbData
Definition SpawnData.h:77

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

◆ SaveStateToDB()

void GameObject::SaveStateToDB ( )
2678{
2680 {
2681 if (InstanceScript* instance = GetInstanceScript())
2682 {
2683 GOState param = GetGoState();
2684 instance->StoreGameObjectState(GetSpawnId(), GameobjectStateToInt(&param));
2685
2687 stmt->SetData(0, GetInstanceId());
2688 stmt->SetData(1, GetSpawnId());
2689 stmt->SetData(2, GameobjectStateToInt(&param));
2690 CharacterDatabase.Execute(stmt);
2691 }
2692 }
2693}
@ CHAR_INSERT_INSTANCE_SAVED_DATA
Definition CharacterDatabase.h:548
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition DatabaseEnv.cpp:21
uint8 GameobjectStateToInt(GOState *state) const
Definition GameObject.cpp:2652
uint32 GetInstanceId() const
Definition Object.h:520

References CHAR_INSERT_INSTANCE_SAVED_DATA, CharacterDatabase, GameobjectStateToInt(), GetGoState(), WorldObject::GetInstanceId(), WorldObject::GetInstanceScript(), GetSpawnId(), IsInstanceGameobject(), and PreparedStatementBase::SetData().

Referenced by SetGoState().

◆ SaveToDB() [1/2]

void GameObject::SaveToDB ( bool  saveAddon = false)
1138{
1139 // this should only be used when the gameobject has already been loaded
1140 // preferably after adding to map, because mapid may not be valid otherwise
1141 GameObjectData const* data = sObjectMgr->GetGameObjectData(m_spawnId);
1142 if (!data)
1143 {
1144 LOG_ERROR("entities.gameobject", "GameObject::SaveToDB failed, cannot get gameobject data!");
1145 return;
1146 }
1147
1148 SaveToDB(GetMapId(), data->spawnMask, data->phaseMask, saveAddon);
1149}
void SaveToDB(bool saveAddon=false)
Definition GameObject.cpp:1137
uint32 GetMapId() const
Definition Position.h:281
uint8 spawnMask
Definition SpawnData.h:75

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

Referenced by SaveToDB().

◆ SaveToDB() [2/2]

void GameObject::SaveToDB ( uint32  mapid,
uint8  spawnMask,
uint32  phaseMask,
bool  saveAddon = false 
)
1152{
1153 GameObjectTemplate const* goI = GetGOInfo();
1154
1155 if (!goI)
1156 return;
1157
1158 if (!m_spawnId)
1159 m_spawnId = sObjectMgr->GenerateGameObjectSpawnId();
1160
1161 // update in loaded data (changing data only in this place)
1162 GameObjectData& data = sObjectMgr->NewGOData(m_spawnId);
1163
1164 data.id = GetEntry();
1165 data.mapid = mapid;
1166 data.phaseMask = phaseMask;
1167 data.posX = GetPositionX();
1168 data.posY = GetPositionY();
1169 data.posZ = GetPositionZ();
1170 data.orientation = GetOrientation();
1171 data.rotation = WorldRotation;
1174 data.go_state = GetGoState();
1175 data.spawnMask = spawnMask;
1176 data.artKit = GetGoArtKit();
1177
1178 // Update in DB
1179 WorldDatabaseTransaction trans = WorldDatabase.BeginTransaction();
1180
1181 uint8 index = 0;
1182
1184 stmt->SetData(0, m_spawnId);
1185 trans->Append(stmt);
1186
1187 stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_GAMEOBJECT);
1188 stmt->SetData(index++, m_spawnId);
1189 stmt->SetData(index++, GetEntry());
1190 stmt->SetData(index++, uint16(mapid));
1191 stmt->SetData(index++, spawnMask);
1192 stmt->SetData(index++, GetPhaseMask());
1193 stmt->SetData(index++, GetPositionX());
1194 stmt->SetData(index++, GetPositionY());
1195 stmt->SetData(index++, GetPositionZ());
1196 stmt->SetData(index++, GetOrientation());
1197 stmt->SetData(index++, WorldRotation.x);
1198 stmt->SetData(index++, WorldRotation.y);
1199 stmt->SetData(index++, WorldRotation.z);
1200 stmt->SetData(index++, WorldRotation.w);
1201 stmt->SetData(index++, int32(m_respawnDelayTime));
1202 stmt->SetData(index++, GetGoAnimProgress());
1203 stmt->SetData(index++, uint8(GetGoState()));
1204 trans->Append(stmt);
1205
1206 if (saveAddon && !sObjectMgr->GetGameObjectAddon(m_spawnId))
1207 {
1208 index = 0;
1209 stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_GAMEOBJECT_ADDON);
1210 stmt->SetData(index++, m_spawnId);
1211 trans->Append(stmt);
1212 }
1213
1214 WorldDatabase.CommitTransaction(trans);
1215 sScriptMgr->OnGameObjectSaveToDB(this);
1216}
SQLTransaction< WorldDatabaseConnection > WorldDatabaseTransaction
Definition DatabaseEnvFwd.h:71
@ WORLD_INS_GAMEOBJECT
Definition WorldDatabase.h:112
@ WORLD_INS_GAMEOBJECT_ADDON
Definition WorldDatabase.h:119
uint8 GetGoAnimProgress() const
Definition GameObject.h:215
uint8 GetGoArtKit() const
Definition GameObject.h:213
uint16 mapid
Definition SpawnData.h:69

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_respawnDelayTime, m_spawnedByDefault, m_spawnId, SpawnData::mapid, SpawnData::orientation, SpawnData::phaseMask, SpawnData::posX, SpawnData::posY, SpawnData::posZ, GameObjectData::rotation, PreparedStatementBase::SetData(), sObjectMgr, SpawnData::spawnMask, GameObjectData::spawntimesecs, sScriptMgr, WORLD_DEL_GAMEOBJECT, WORLD_INS_GAMEOBJECT, WORLD_INS_GAMEOBJECT_ADDON, WorldDatabase, and WorldRotation.

◆ SendCustomAnim()

void GameObject::SendCustomAnim ( uint32  anim)
2228{
2230 data << GetGUID();
2231 data << uint32(anim);
2232 SendMessageToSet(&data, true);
2233}
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition Object.cpp:2178
@ SMSG_GAMEOBJECT_CUSTOM_ANIM
Definition Opcodes.h:209

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

Referenced by Spell::EffectActivateObject(), spell_onyxia_disturb_lava_fissure::HandleActivateObject(), go_gong_of_bethekk::OnGossipHello(), brann_bronzebeard::SwitchHeadVisual(), Update(), go_suppression_device::UpdateAI(), and Use().

◆ SetDestructibleBuildingModifyState()

void GameObject::SetDestructibleBuildingModifyState ( bool  allow)
inline

◆ SetDestructibleState()

void GameObject::SetDestructibleState ( GameObjectDestructibleState  state,
Player *  eventInvoker = nullptr,
bool  setHealth = false 
)
2446{
2447 // the user calling this must know he is already operating on destructible gameobject
2449
2450 switch (state)
2451 {
2455 if (setHealth)
2456 {
2458 SetGoAnimProgress(255);
2459 }
2460 EnableCollision(true);
2461 break;
2463 {
2465
2466 sScriptMgr->OnGameObjectDamaged(this, eventInvoker);
2467
2468 if (BattlegroundMap* bgMap = GetMap()->ToBattlegroundMap())
2469 if (Battleground* bg = bgMap->GetBG())
2470 bg->EventPlayerDamagedGO(eventInvoker, this, m_goInfo->building.damagedEvent);
2471
2474
2477 if (modelData->DamagedDisplayId)
2478 modelId = modelData->DamagedDisplayId;
2479 SetDisplayId(modelId);
2480
2481 if (setHealth)
2482 {
2484 uint32 maxHealth = m_goValue.Building.MaxHealth;
2485 // in this case current health is 0 anyway so just prevent crashing here
2486 if (!maxHealth)
2487 maxHealth = 1;
2488 SetGoAnimProgress(m_goValue.Building.Health * 255 / maxHealth);
2489 }
2490 break;
2491 }
2493 {
2494 sScriptMgr->OnGameObjectDestroyed(this, eventInvoker);
2495
2497
2498 if (BattlegroundMap* bgMap = GetMap()->ToBattlegroundMap())
2499 {
2500 if (Battleground* bg = bgMap->GetBG())
2501 {
2502 bg->EventPlayerDamagedGO(eventInvoker, this, m_goInfo->building.destroyedEvent);
2503 bg->DestroyGate(eventInvoker, this);
2504 }
2505 }
2506
2509
2512 if (modelData->DestroyedDisplayId)
2513 modelId = modelData->DestroyedDisplayId;
2514 SetDisplayId(modelId);
2515
2516 if (setHealth)
2517 {
2520 }
2521 EnableCollision(false);
2522 break;
2523 }
2525 {
2528
2529 uint32 modelId = m_goInfo->displayId;
2531 if (modelData->RebuildingDisplayId)
2532 modelId = modelData->RebuildingDisplayId;
2533 SetDisplayId(modelId);
2534
2535 // restores to full health
2536 if (setHealth)
2537 {
2539 SetGoAnimProgress(255);
2540 }
2541 EnableCollision(true);
2542 break;
2543 }
2544 }
2545}
DBCStorage< DestructibleModelDataEntry > sDestructibleModelDataStore(DestructibleModelDatafmt)
@ GO_DESTRUCTIBLE_REBUILDING
Definition SharedDefines.h:1634
Definition Map.h:761
void RemoveGameObjectFlag(GameObjectFlags flags)
Definition GameObject.h:225
void EventInform(uint32 eventId)
Definition GameObject.cpp:2287
Definition DBCStructure.h:870
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

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_eye_of_eternity::OnGameObjectCreate(), instance_trial_of_the_crusader::OnGameObjectCreate(), FrozenThroneResetWorker::operator()(), BattlegroundIC::PostUpdateImpl(), and BfWGGameObjectBuilding::Rebuild().

◆ SetDisplayId()

void GameObject::SetDisplayId ( uint32  displayid)

◆ SetGameObjectFlag()

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

References GAMEOBJECT_FLAGS, and Object::SetFlag().

Referenced by go_suppression_device::Deactivate(), go_chromaggus_lever::GossipHello(), go_blood_drenched_door::go_blood_drenched_doorAI::GossipHello(), go_celestial_planetarium_access::go_celestial_planetarium_accessAI::GossipHello(), go_empowering_blood_orb::HandleObjectUse(), go_magtheridons_head::InitializeAI(), 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_ahnkahet::instance_ahnkahet_InstanceScript::OnGameObjectCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnGameObjectCreate(), instance_violet_hold::instance_violet_hold_InstanceMapScript::OnGameObjectCreate(), go_gong_of_bethekk::OnGossipHello(), go_elune_fire::OnGossipHello(), go_razorscale_harpoon::OnGossipHello(), go_palehoof_sphere::OnGossipHello(), go_main_chambers_access_panel::OnGossipHello(), go_razorscale_mole_machine::go_razorscale_mole_machineAI::Reset(), SetDestructibleState(), SwitchDoorOrButton(), and Use().

◆ SetGoAnimProgress()

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

References GAMEOBJECT_BYTES_1, and Object::SetByteValue().

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

◆ SetGoArtKit() [1/2]

void GameObject::SetGoArtKit ( uint8  artkit)
1568{
1570 GameObjectData* data = const_cast<GameObjectData*>(sObjectMgr->GetGameObjectData(m_spawnId));
1571 if (data)
1572 data->artKit = kit;
1573}

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
1576{
1577 GameObjectData const* data = nullptr;
1578 if (go)
1579 {
1580 go->SetGoArtKit(artkit);
1581 data = go->GetGameObjectData();
1582 }
1583 else if (lowguid)
1584 data = sObjectMgr->GetGameObjectData(lowguid);
1585
1586 if (data)
1587 const_cast<GameObjectData*>(data)->artKit = artkit;
1588}

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

◆ SetGoState()

void GameObject::SetGoState ( GOState  state)
2583{
2585
2586 sScriptMgr->OnGameObjectStateChanged(this, state);
2587
2588 if (m_model)
2589 {
2590 if (!IsInWorld())
2591 return;
2592
2593 // pussywizard: this startOpen is unneeded here, collision depends entirely on current GOState
2595 // pussywizard: commented out everything below
2596
2597 // startOpen determines whether we are going to add or remove the LoS on activation
2598 /*bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false);
2599
2600 if (GetGameObjectData() && GetGameObjectData()->go_state == GO_STATE_READY)
2601 startOpen = !startOpen;
2602
2603 if (state == GO_STATE_ACTIVE || state == GO_STATE_ACTIVE_ALTERNATIVE)
2604 EnableCollision(startOpen);
2605 else if (state == GO_STATE_READY)
2606 EnableCollision(!startOpen);*/
2607 }
2608 /* Whenever a gameobject inside an instance changes
2609 * save it's state on the database to be loaded properly
2610 * on server restart or crash.
2611 */
2613 {
2614 SaveStateToDB();
2615 }
2616}
bool IsAllowedToSaveToDB() const
Definition GameObject.h:376
void SaveStateToDB()
Definition GameObject.cpp:2677

References EnableCollision(), GAMEOBJECT_BYTES_1, GO_STATE_READY, IsAllowedToSaveToDB(), IsInstanceGameobject(), Object::IsInWorld(), IsTransport(), m_model, SaveStateToDB(), Object::SetByteValue(), and sScriptMgr.

Referenced by go_suppression_device::Activate(), instance_naxxramas::ActivateWingPortal(), boss_thorim::CloseDoors(), Create(), StaticTransport::Create(), MotionTransport::CreateMoTrans(), boss_thorim::DamageTaken(), go_suppression_device::Deactivate(), Delete(), DespawnOrUnsummon(), go_chromaggus_lever::GossipHello(), InstanceScript::HandleGameObject(), instance_stratholme::instance_stratholme_InstanceMapScript::HandleGateTrapCreate(), go_empowering_blood_orb::HandleObjectUse(), npc_midsummer_bonfire::Ignite(), go_suppression_device::InitializeAI(), go_magtheridons_head::InitializeAI(), 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_zulfarrak::instance_zulfarrak_InstanceMapScript::OnGameObjectCreate(), instance_gundrak::instance_gundrak_InstanceMapScript::OnGameObjectCreate(), instance_ulduar::instance_ulduar_InstanceMapScript::OnGameObjectCreate(), instance_blackrock_depths::OnGameObjectCreate(), instance_karazhan::instance_karazhan_InstanceMapScript::OnGameObjectCreate(), instance_stratholme::instance_stratholme_InstanceMapScript::OnGameObjectCreate(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::OnGameObjectCreate(), instance_ahnkahet::instance_ahnkahet_InstanceScript::OnGameObjectCreate(), instance_pit_of_saron::instance_pit_of_saron_InstanceScript::OnGameObjectCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnGameObjectCreate(), instance_naxxramas::OnGameObjectCreate(), instance_halls_of_stone::instance_halls_of_stone_InstanceMapScript::OnGameObjectCreate(), go_palehoof_sphere::OnGossipHello(), go_bristlelimb_cage::OnGossipHello(), npc_mistress_nagmara::OpenBarDoor(), instance_ulduar::instance_ulduar_InstanceMapScript::OpenIfDone(), FrozenThroneResetWorker::operator()(), npc_wounded_blood_elf::npc_wounded_blood_elfAI::Reset(), instance_halls_of_stone::instance_halls_of_stone_InstanceMapScript::SetData(), BattlegroundIC::StartingEventOpenDoors(), SwitchDoorOrButton(), brann_bronzebeard::SwitchHeadVisual(), boss_flame_leviathan::TurnGates(), MotionTransport::Update(), Update(), InstanceScript::UpdateDoorState(), BattlegroundRV::UpdatePillars(), Use(), and npc_wounded_blood_elf::npc_wounded_blood_elfAI::WaypointReached().

◆ SetGoType()

void GameObject::SetGoType ( GameobjectTypes  type)
inline

◆ SetLinkedTrap()

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

References Object::GetGUID(), and m_linkedTrap.

Referenced by Create().

◆ SetLootGenerationTime()

void GameObject::SetLootGenerationTime ( )
3038{
3040}

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)
2752{
2753 // set the player whose group should receive the right
2754 // to loot the creature after it dies
2755 // should be set to nullptr after the loot disappears
2756 if (!creature)
2757 {
2761 return;
2762 }
2763
2767}
ObjectGuid GetLootRecipientGUID() const
Definition Creature.h:232
ObjectGuid::LowType GetLootRecipientGroupGUID() const
Definition Creature.h:234
void Clear()
Definition ObjectGuid.h:141
void ResetAllowedLooters()
Definition Object.cpp:3229
void SetAllowedLooters(GuidUnorderedSet const looters)
Definition Object.cpp:3224
GuidUnorderedSet const & GetAllowedLooters() const
Definition Object.cpp:3244

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

Referenced by boss_thorim::DamageTaken(), instance_ulduar::instance_ulduar_InstanceMapScript::OnGameObjectCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnGameObjectCreate(), and instance_the_slave_pens::instance_the_slave_pens_InstanceMapScript::OnGameObjectCreate().

◆ SetLootRecipient() [2/2]

void GameObject::SetLootRecipient ( Map *  map)
2770{
2771 Group* group = nullptr;
2772 Map::PlayerList const& PlayerList = map->GetPlayers();
2773 for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
2774 {
2775 if (Player* groupMember = i->GetSource())
2776 {
2777 if (groupMember->IsGameMaster() || groupMember->IsSpectator())
2778 {
2779 continue;
2780 }
2781
2782 if (!m_lootRecipient)
2783 {
2784 m_lootRecipient = groupMember->GetGUID();
2785 }
2786
2787 Group* memberGroup = groupMember->GetGroup();
2788 if (memberGroup && !group)
2789 {
2790 group = memberGroup;
2792 }
2793
2794 if (memberGroup == group)
2795 {
2796 AddAllowedLooter(groupMember->GetGUID());
2797 }
2798 }
2799 }
2800
2801 if (!group)
2802 {
2804 }
2805}
ObjectGuid GetGUID() const
Definition Group.cpp:2548
Definition LinkedList.h:139
Definition MapRefMgr.h:26
iterator begin()
Definition MapRefMgr.h:36
iterator end()
Definition MapRefMgr.h:37
PlayerList const & GetPlayers() const
Definition Map.h:335
LowType GetCounter() const
Definition ObjectGuid.h:149
void AddAllowedLooter(ObjectGuid guid)
Definition Object.cpp:3219

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 
)
2548{
2549 m_lootState = state;
2550
2551 if (unit)
2552 _lootStateUnitGUID = unit->GetGUID();
2553 else
2555
2556 AI()->OnStateChanged(state, unit);
2557 sScriptMgr->OnGameObjectLootStateChanged(this, state, unit);
2558
2559 // Start restock timer if the chest is partially looted or not looted at all
2560 if (GetGoType() == GAMEOBJECT_TYPE_CHEST && state == GO_ACTIVATED && GetGOInfo()->chest.chestRestockTime > 0 && m_restockTime == 0s)
2561 {
2563 }
2564
2565 // 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
2566 /*if (m_model)
2567 {
2568 // startOpen determines whether we are going to add or remove the LoS on activation
2569 bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false);
2570
2571 // Use the current go state
2572 if (GetGoState() == GO_STATE_ACTIVE)
2573 startOpen = !startOpen;
2574
2575 if (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED)
2576 EnableCollision(startOpen);
2577 else if (state == GO_READY)
2578 EnableCollision(!startOpen);
2579 }*/
2580}
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:30
@ GO_ACTIVATED
Definition GameObject.h:117
virtual void OnStateChanged(uint32, Unit *)
Definition GameObjectAI.h:64
ObjectGuid _lootStateUnitGUID
Definition GameObject.h:429
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::Activate(), Delete(), DespawnOrUnsummon(), WorldSession::DoLootRelease(), Spell::EffectOpenLock(), spell_q9452_cast_net::HandleActiveObject(), spell_q10612_10613_the_fel_and_the_furious::HandleScriptEffect(), go_eredar_twins_blaze::InitializeAI(), instance_deadmines::instance_deadmines_InstanceMapScript::OnGameObjectCreate(), instance_oculus::instance_oculus_InstanceMapScript::OnGameObjectCreate(), go_massive_seaforium_charge::OnGossipHello(), go_enchanted_scarlet_thread::OnLootStateChanged(), go_suppression_device::OnStateChanged(), SmartScript::ProcessAction(), go_direbrew_mole_machine::go_direbrew_mole_machineAI::Reset(), ResetDoorOrButton(), Map::ScriptsProcess(), Player::SendLoot(), boss_flame_leviathan::TurnHealStations(), Update(), Use(), and UseDoorOrButton().

◆ SetOwnerGUID()

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

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

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

◆ SetPhaseMask()

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

◆ SetPosition() [1/2]

void GameObject::SetPosition ( float  x,
float  y,
float  z,
float  o 
)
2968{
2969 // pussywizard: do not call for MotionTransport and other gobjects not in grid
2970
2971 if (!Acore::IsValidMapCoord(x, y, z, o))
2972 return;
2973
2974 GetMap()->GameObjectRelocation(this, x, y, z, o);
2975}
void GameObjectRelocation(GameObject *go, float x, float y, float z, float o)
Definition Map.cpp:870
bool IsValidMapCoord(float c)
Definition GridDefines.h:210

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

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

◆ SetPosition() [2/2]

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

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

Referenced by SetPosition().

◆ SetRespawnDelay()

void GameObject::SetRespawnDelay ( int32  respawn)
1414{
1415 m_respawnDelayTime = respawn > 0 ? respawn : 0;
1416}

References m_respawnDelayTime.

Referenced by go_strange_pool::OnGossipHello(), and 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 
)
2353{
2358}
@ GAMEOBJECT_PARENTROTATION
Definition UpdateFields.h:400
void SetFloatValue(uint16 index, float value)
Definition Object.cpp:735

References GAMEOBJECT_PARENTROTATION, and Object::SetFloatValue().

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

◆ SetWorldRotation()

void GameObject::SetWorldRotation ( G3D::Quat const &  rot)
2341{
2342 G3D::Quat rotation = rot;
2343 // If the quaternion is zero (e.g. dynamically spawned GOs with no rotation),
2344 // fall back to computing rotation from orientation to avoid NaN from unitize()
2345 if (G3D::fuzzyEq(rotation.magnitude(), 0.0f))
2346 rotation = G3D::Quat::fromAxisAngleRotation(G3D::Vector3::unitZ(), GetOrientation());
2347 rotation.unitize();
2348 WorldRotation = rotation;
2350}
void UpdatePackedRotation()
Definition GameObject.cpp:2322

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

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

◆ SetWorldRotationAngles()

void GameObject::SetWorldRotationAngles ( float  z_rot,
float  y_rot,
float  x_rot 
)
2361{
2362 SetWorldRotation(G3D::Quat(G3D::Matrix3::fromEulerAnglesZYX(z_rot, y_rot, x_rot)));
2363}

References SetWorldRotation().

Referenced by StaticTransport::Create().

◆ SwitchDoorOrButton()

void GameObject::SwitchDoorOrButton ( bool  activate,
bool  alternative = false 
)
private
1591{
1592 if (activate)
1594 else
1596
1597 if (GetGoState() == GO_STATE_READY) //if closed -> open
1599 else //if open -> close
1601}
@ GO_FLAG_IN_USE
Definition SharedDefines.h:1607

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
348{ 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
345{ 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
inline
342{ if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT || GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<Transport const*>(this); else return nullptr; }

References GAMEOBJECT_TYPE_MO_TRANSPORT, GAMEOBJECT_TYPE_TRANSPORT, and GetGOInfo().

◆ TriggeringLinkedGameObject()

void GameObject::TriggeringLinkedGameObject ( uint32  trapEntry,
Unit *  target 
)
1501{
1502 GameObjectTemplate const* trapInfo = sObjectMgr->GetGameObjectTemplate(trapEntry);
1503 if (!trapInfo || trapInfo->type != GAMEOBJECT_TYPE_TRAP)
1504 return;
1505
1506 SpellInfo const* trapSpell = sSpellMgr->GetSpellInfo(trapInfo->trap.spellId);
1507 if (!trapSpell) // checked at load already
1508 return;
1509
1510 // xinef: many spells have range 0 but radius > 0
1511 float range = float(target->GetSpellMaxRangeForTarget(GetOwner(), trapSpell));
1512 if (range < 1.0f)
1513 range = 5.0f;
1514
1515 // found correct GO
1516 // xinef: we should use the trap (checks for despawn type)
1517 if (GameObject* trapGO = GetLinkedTrap())
1518 {
1519 trapGO->Use(target); // trapGO->CastSpell(target, trapInfo->trap.spellId);
1520 }
1521}
float GetSpellMaxRangeForTarget(Unit const *target, SpellInfo const *spellInfo) const
Definition Unit.cpp:11559

References GAMEOBJECT_TYPE_TRAP, GetLinkedTrap(), GetOwner(), Unit::GetSpellMaxRangeForTarget(), sObjectMgr, GameObjectTemplate::spellId, sSpellMgr, GameObjectTemplate::trap, and GameObjectTemplate::type.

Referenced by Player::SendLoot(), Spell::SendLoot(), and Use().

◆ Update()

void GameObject::Update ( uint32  p_time)
overridevirtual
Todo:
This is activation radius. Casting radius must be selected from spell data.
Todo:
Todo:
Move activated state code to GO_ACTIVATED, in this place just check for activation and set state.

Reimplemented from WorldObject.

Reimplemented in MotionTransport, and StaticTransport.

527{
529
530 if (AI())
531 AI()->UpdateAI(diff);
532 else if (!AIM_Initialize())
533 LOG_ERROR("entities.gameobject", "Could not initialize GameObjectAI");
534
535 if (m_despawnDelay)
536 {
537 if (m_despawnDelay > diff)
538 {
539 m_despawnDelay -= diff;
540 }
541 else
542 {
543 m_despawnDelay = 0;
545 }
546 }
547
548 for (std::unordered_map<ObjectGuid, int32>::iterator itr = m_SkillupList.begin(); itr != m_SkillupList.end();)
549 {
550 if (itr->second > 0)
551 {
552 if (itr->second > static_cast<int32>(diff))
553 {
554 itr->second -= static_cast<int32>(diff);
555 ++itr;
556 }
557 else
558 {
559 itr = m_SkillupList.erase(itr);
560 }
561 }
562 else
563 {
564 ++itr;
565 }
566 }
567
568 switch (m_lootState)
569 {
570 case GO_NOT_READY:
571 {
572 switch (GetGoType())
573 {
575 {
576 // Arming Time for GAMEOBJECT_TYPE_TRAP (6)
577 GameObjectTemplate const* goInfo = GetGOInfo();
578 // Bombs
579 if (goInfo->trap.type == 2)
580 m_cooldownTime = GameTime::GetGameTimeMS().count() + 10 * IN_MILLISECONDS; // Hardcoded tooltip value
581 else if (Unit* owner = GetOwner())
582 if (owner->IsInCombat())
585
587 break;
588 }
590 {
591 // fishing code (bobber ready)
593 {
594 // splash bobber (bobber ready now)
595 Unit* caster = GetOwner();
596 if (caster && caster->IsPlayer())
597 {
600
601 UpdateData udata;
602 WorldPacket packet;
603 BuildValuesUpdateBlockForPlayer(&udata, caster->ToPlayer());
604 udata.BuildPacket(packet);
605 caster->ToPlayer()->SendDirectMessage(&packet);
606
608 }
609
610 m_lootState = GO_READY; // can be successfully open with some chance
611 }
612 return;
613 }
615 {
617 return;
618 GameObjectTemplate const* info = GetGOInfo();
619
621
623 {
625 return;
626 }
627
628 Unit* owner = GetOwner();
629 Unit* spellCaster = owner ? owner : ObjectAccessor::GetPlayer(*this, m_ritualOwnerGUID);
630 if (!spellCaster)
631 {
633 return;
634 }
635
636 uint32 spellId = info->summoningRitual.spellId;
637
638 if (spellId == 62330) // GO store nonexistent spell, replace by expected
639 {
640 // spell have reagent and mana cost but it not expected use its
641 // it triggered spell in fact casted at currently channeled GO
642 spellId = 61993;
643 }
644
645 // Cast casterTargetSpell at a random GO user
646 // on the current DB there is only one gameobject that uses this (Ritual of Doom)
647 // and its required target number is 1 (outter for loop will run once)
648 if (info->summoningRitual.casterTargetSpell && info->summoningRitual.casterTargetSpell != 1) // No idea why this field is a bool in some cases
649 for (uint32 i = 0; i < info->summoningRitual.casterTargetSpellTargets; i++)
650 // m_unique_users can contain only player GUIDs
652 spellCaster->CastSpell(target, info->summoningRitual.casterTargetSpell, true);
653
654 // finish owners spell
655 // xinef: properly process event cooldowns
656 if (owner)
657 {
658 if (Spell* spell = owner->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
659 {
660 spell->SendChannelUpdate(0);
661 spell->finish(false);
662 }
663 }
664
665 // can be deleted now
668 else
670
672
673 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
674 if (spellInfo && IsCastByRitualObject(spellInfo))
675 CastSpell(nullptr, spellInfo, CastSpellExtraArgs(spellCaster->GetGUID()));
676 else
677 spellCaster->CastSpell(spellCaster, spellId, true);
678 return;
679 }
682 {
683 return;
684 }
685 // If there is no restock timer, or if the restock timer passed, the chest becomes ready to loot
686 m_restockTime = 0s;
689 break;
690 default:
691 m_lootState = GO_READY; // for other GOis same switched without delay to GO_READY
692 break;
693 }
694 [[fallthrough]];
695 }
696 case GO_READY:
697 {
698 if (m_respawnTime > 0) // timer on
699 {
700 time_t now = GameTime::GetGameTime().count();
701 if (m_respawnTime <= now) // timer expired
702 {
703 ObjectGuid dbtableHighGuid = ObjectGuid::Create<HighGuid::GameObject>(GetEntry(), m_spawnId);
704 time_t linkedRespawntime = GetMap()->GetLinkedRespawnTime(dbtableHighGuid);
705 if (linkedRespawntime) // Can't respawn, the master is dead
706 {
707 ObjectGuid targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid);
708 if (targetGuid == dbtableHighGuid) // if linking self, never respawn (check delayed to next day)
710 else
711 m_respawnTime = (now > linkedRespawntime ? now : linkedRespawntime) + urand(5, MINUTE); // else copy time from master and add a little
712 SaveRespawnTime(); // also save to DB immediately
713 return;
714 }
715
716 m_respawnTime = 0;
717 m_SkillupList.clear();
718 m_usetimes = 0;
719
720 switch (GetGoType())
721 {
722 case GAMEOBJECT_TYPE_FISHINGNODE: // can't fish now
723 {
724 Unit* caster = GetOwner();
725 if (caster && caster->IsPlayer())
726 {
727 caster->ToPlayer()->RemoveGameObject(this, false);
728
730 caster->ToPlayer()->SendDirectMessage(&data);
731 }
732 // can be deleted
734 return;
735 }
738 //we need to open doors if they are closed (add there another condition if this code breaks some usage, but it need to be here for battlegrounds)
739 if (GetGoState() != GO_STATE_READY)
741 break;
743 // Initialize a new max fish count on respawn
745 break;
746 default:
747 break;
748 }
749
750 if (!m_spawnedByDefault) // despawn timer
751 {
752 // can be despawned or destroyed
754 return;
755 }
756
757 // Xinef: Call AI Reset (required for example in SmartAI to clear one time events)
758 if (AI())
759 AI()->Reset();
760
761 // respawn timer
762 uint32 poolid = m_spawnId ? sPoolMgr->IsPartOfAPool<GameObject>(m_spawnId) : 0;
763 if (poolid)
764 sPoolMgr->UpdatePool<GameObject>(GetMap()->GetPoolData(), poolid, m_spawnId);
765 else
766 GetMap()->AddToMap(this);
767 }
768 }
769
770 if (isSpawned())
771 {
772 // traps can have time and can not have
773 GameObjectTemplate const* goInfo = GetGOInfo();
774 if (goInfo->type == GAMEOBJECT_TYPE_TRAP)
775 {
777 break;
778
779 // Type 2 - Bomb (will go away after casting it's spell)
780 if (goInfo->trap.type == 2)
781 {
783 break;
784 }
785
788 float radius = float(goInfo->trap.diameter) * 0.5f;
789 if (!goInfo->trap.diameter)
790 {
791 // Cast in other case (at some triggering/linked go/etc explicit call)
792 if (goInfo->trap.cooldown != 3 || m_respawnTime > 0)
793 {
794 break;
795 }
796
797 radius = 3.f;
798 }
799
800 // Type 0 and 1 - trap (type 0 will not get removed after casting a spell)
801 Unit* owner = GetOwner();
802 Unit* target = nullptr; // pointer to appropriate target if found any
803
804 if (owner)
805 {
806 // summoned traps: search targets fit to trap spell data
807 if (SpellInfo const* trapSpell = sSpellMgr->GetSpellInfo(goInfo->trap.spellId))
808 {
809 WorldObject* worldObjectTarget = nullptr;
810 TrapTargetCheck checker(this, owner, trapSpell,
812 Acore::WorldObjectLastSearcher<TrapTargetCheck> searcher(this, worldObjectTarget,
814 Cell::VisitObjects(this, searcher, radius);
815 target = worldObjectTarget ? worldObjectTarget->ToUnit() : nullptr;
816 }
817 else
818 {
820 AttackableCheck checker(this, owner, radius);
821 Acore::UnitSearcher<AttackableCheck> searcher(this, target, checker);
822 Cell::VisitObjects(this, searcher, radius);
823 }
824 }
825 else // environmental trap
826 {
827 // environmental damage spells already have around enemies targeting but this not help in case not existed GO casting support
828 // affect only players
829 Player* player = nullptr;
830 Acore::AnyPlayerInObjectRangeCheck checker(this, radius, true, true);
831 Acore::PlayerSearcher<Acore::AnyPlayerInObjectRangeCheck> searcher(this, player, checker);
832 Cell::VisitObjects(this, searcher, radius);
833 target = player;
834 }
835
836 if (target)
837 {
838 SetLootState(GO_ACTIVATED, target);
839 }
840 }
841 else if (uint32 max_charges = goInfo->GetCharges())
842 {
843 if (m_usetimes >= max_charges)
844 {
845 m_usetimes = 0;
846 SetLootState(GO_JUST_DEACTIVATED); // can be despawned or destroyed
847 }
848 }
849 }
850
851 break;
852 }
853 case GO_ACTIVATED:
854 {
855 switch (GetGoType())
856 {
859 if (GetGOInfo()->GetAutoCloseTime() && GameTime::GetGameTimeMS().count() >= m_cooldownTime)
861 break;
864 {
866
868 }
869 break;
872 {
873 if (m_groupLootTimer <= diff)
874 {
875 Group* group = sGroupMgr->GetGroupByGUID(lootingGroupLowGUID);
876 if (group)
877 group->EndRoll(&loot);
880 }
881 else
882 {
883 m_groupLootTimer -= diff;
884 }
885 }
886
887 // Non-consumable chest was partially looted and restock time passed, restock all loot now
889 {
890 m_restockTime = 0s;
893 }
894 break;
896 {
897 GameObjectTemplate const* goInfo = GetGOInfo();
898 if (goInfo->trap.type == 2)
899 {
900 if (goInfo->trap.spellId)
901 {
904 CastSpell(nullptr, goInfo->trap.spellId, args); // FIXME: null target won't work for target type 1
905 }
907 }
908 else if (Unit* target = ObjectAccessor::GetUnit(*this, _lootStateUnitGUID))
909 {
910 if (goInfo->trap.spellId)
911 {
914 CastSpell(target, goInfo->trap.spellId, args);
915 }
916
917 m_cooldownTime = GameTime::GetGameTimeMS().count() + (goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4)) * IN_MILLISECONDS; // template or 4 seconds
918
919 if (goInfo->trap.type == 1)
921 else if (!goInfo->trap.type)
923
924 // Battleground gameobjects have data2 == 0 && data5 == 3
925 if (!goInfo->trap.diameter && goInfo->trap.cooldown == 3)
926 if (Player* player = target->ToPlayer())
927 if (Battleground* bg = player->GetBattleground())
928 bg->HandleTriggerBuff(this);
929 }
930 break;
931 }
932 default:
933 break;
934 }
935 break;
936 }
938 {
939 // If nearby linked trap exists, despawn it
940 if (GameObject* linkedTrap = GetLinkedTrap())
941 {
942 linkedTrap->DespawnOrUnsummon();
943 }
944
945 //if Gameobject should cast spell, then this, but some GOs (type = 10) should be destroyed
947 {
949
950 //any return here in case battleground traps
951 // Xinef: Do not return here for summoned gos that should be deleted few lines below
952 // Xinef: Battleground objects are treated as spawned by default
953 if (GameObjectTemplateAddon const* addon = GetTemplateAddon())
954 if ((addon->flags & GO_FLAG_NODESPAWN) && isSpawnedByDefault())
955 return;
956 }
957
958 loot.clear();
959
960 // Do not delete chests or goobers that are not consumed on loot, while still allowing them to despawn when they expire if summoned
961 bool isSummonedAndExpired = (GetOwner() || GetSpellId()) && m_respawnTime == 0;
962 if ((GetGoType() == GAMEOBJECT_TYPE_CHEST || GetGoType() == GAMEOBJECT_TYPE_GOOBER) && !GetGOInfo()->IsDespawnAtAction() && !isSummonedAndExpired)
963 {
965 {
966 // Start restock timer when the chest is fully looted
970 }
971 else
972 {
974 }
975
977 return;
978 }
979 else if (GetOwnerGUID() || GetSpellId())
980 {
982 Delete();
983 return;
984 }
985
987
988 //burning flags in some battlegrounds, if you find better condition, just add it
989 if (GetGOInfo()->IsDespawnAtAction() || GetGoAnimProgress() > 0)
990 {
992 //reset flags
993 if (GameObjectTemplateAddon const* addon = GetTemplateAddon())
995 }
996
998 return;
999
1000 if (!m_spawnedByDefault)
1001 {
1002 m_respawnTime = 0;
1003 DestroyForVisiblePlayers(); // xinef: old UpdateObjectVisibility();
1004 return;
1005 }
1006
1007 uint32 dynamicRespawnDelay = GetMap()->ApplyDynamicModeRespawnScaling(this, m_respawnDelayTime);
1008 m_respawnTime = GameTime::GetGameTime().count() + dynamicRespawnDelay;
1009
1010 // if option not set then object will be saved at grid unload
1011 if (GetMap()->IsDungeon())
1013
1014 DestroyForVisiblePlayers(); // xinef: old UpdateObjectVisibility();
1015 break;
1016 }
1017 }
1018
1019 sScriptMgr->OnGameObjectUpdate(this, diff);
1020}
constexpr auto DAY
Definition Common.h:49
#define FISHING_BOBBER_READY_TIME
Definition GameObject.h:122
@ GRID_MAP_TYPE_MASK_PLAYER
Definition GridDefines.h:75
@ GRID_MAP_TYPE_MASK_CREATURE
Definition GridDefines.h:72
@ GAMEOBJECT_TYPE_BUTTON
Definition SharedDefines.h:1565
SpellTargetCheckTypes
Definition SpellInfo.h:114
Definition GridNotifiers.h:1380
virtual void UpdateAI(uint32)
Definition GameObjectAI.h:41
virtual void Reset()
Definition GameObjectAI.h:45
void CheckRitualList()
Definition GameObject.cpp:270
void Delete()
Definition GameObject.cpp:1092
uint32 GetUniqueUseCount() const
Definition GameObject.h:248
bool isSpawnedByDefault() const
Definition GameObject.h:202
void SendCustomAnim(uint32 anim)
Definition GameObject.cpp:2227
void ResetDoorOrButton()
Definition GameObject.cpp:1543
void DespawnOrUnsummon(Milliseconds delay=0ms, Seconds forcedRespawnTime=0s)
Definition GameObject.cpp:1043
ObjectGuid m_ritualOwnerGUID
Definition GameObject.h:405
void EndRoll(Loot *loot)
Definition Group.cpp:1576
time_t GetLinkedRespawnTime(ObjectGuid guid) const
Definition Map.cpp:3077
uint32 ApplyDynamicModeRespawnScaling(WorldObject const *obj, uint32 respawnDelay) const
Definition Map.cpp:1758
void BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target)
Definition Object.cpp:255
bool IsPlayer() const
Definition Object.h:207
Player * ToPlayer()
Definition Object.h:208
void AddToObjectUpdateIfNeeded()
Definition Object.cpp:522
void RemoveGameObject(GameObject *gameObj, bool del)
Definition Unit.cpp:6384
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:1378
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition Unit.h:1593
Definition UpdateData.h:52
bool BuildPacket(WorldPacket &packet)
Definition UpdateData.cpp:48
Definition Object.h:482
void DestroyForVisiblePlayers()
Definition Object.cpp:3062
virtual void Update(uint32 diff)
Definition Object.cpp:1077
@ SMSG_FISH_ESCAPED
Definition Opcodes.h:487
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition Containers.h:133
Milliseconds GetGameTimeMS()
Definition GameTime.cpp:44
Definition GridNotifiers.h:533
Definition GridNotifiers.h:412
Definition GridNotifiers.h:242
Definition SpellDefines.h:209
CastSpellExtraArgs & SetOriginalCaster(ObjectGuid const &guid)
Definition SpellDefines.h:230
uint32 startDelay
Definition GameObjectData.h:123
uint32 casterTargetSpell
Definition GameObjectData.h:236
uint32 GetCharges() const
Definition GameObjectData.h:480
uint32 reqParticipants
Definition GameObjectData.h:232
uint32 consumable
Definition GameObjectData.h:87
uint32 cooldown
Definition GameObjectData.h:121
uint32 ritualPersistent
Definition GameObjectData.h:235
uint32 casterTargetSpellTargets
Definition GameObjectData.h:237
uint32 diameter
Definition GameObjectData.h:118

References _lootStateUnitGUID, Map::AddToMap(), Object::AddToObjectUpdateIfNeeded(), AI(), AIM_Initialize(), Map::ApplyDynamicModeRespawnScaling(), UpdateData::BuildPacket(), Object::BuildValuesUpdateBlockForPlayer(), GameObjectTemplate::casterTargetSpell, GameObjectTemplate::casterTargetSpellTargets, Unit::CastSpell(), CastSpell(), CheckRitualList(), GameObjectTemplate::chest, GameObjectTemplate::chestRestockTime, Loot::clear(), ClearRitualList(), GameObjectTemplate::consumable, GameObjectTemplate::cooldown, CURRENT_CHANNELED_SPELL, DAY, Delete(), DespawnOrUnsummon(), WorldObject::DestroyForVisiblePlayers(), GameObjectTemplate::diameter, Group::EndRoll(), FISHING_BOBBER_READY_TIME, GameObjectValue::FishingHole, GAMEOBJECT_TYPE_BUTTON, GAMEOBJECT_TYPE_CHEST, GAMEOBJECT_TYPE_DOOR, GAMEOBJECT_TYPE_FISHINGHOLE, GAMEOBJECT_TYPE_FISHINGNODE, GAMEOBJECT_TYPE_GOOBER, GAMEOBJECT_TYPE_SUMMONING_RITUAL, GAMEOBJECT_TYPE_TRAP, GameObjectTemplate::GetCharges(), Unit::GetCurrentSpell(), Object::GetEntry(), GameTime::GetGameTime(), GameTime::GetGameTimeMS(), GetGoAnimProgress(), GetGOInfo(), GetGoState(), GetGoType(), Object::GetGUID(), Object::GetGUID(), Map::GetLinkedRespawnTime(), GetLinkedTrap(), WorldObject::GetMap(), GetOwner(), GetOwnerGUID(), ObjectAccessor::GetPlayer(), Map::GetPoolData(), GetSpellId(), GetTemplateAddon(), GetUniqueUseCount(), ObjectAccessor::GetUnit(), GO_ACTIVATED, GO_FLAG_IN_USE, GO_FLAG_NODESPAWN, GO_JUST_DEACTIVATED, GO_NOT_READY, GO_READY, GO_STATE_ACTIVE, GO_STATE_READY, GRID_MAP_TYPE_MASK_CREATURE, GRID_MAP_TYPE_MASK_PLAYER, IN_MILLISECONDS, GameObjectTemplate::IsDespawnAtAction(), Object::IsPlayer(), isSpawned(), isSpawnedByDefault(), LOG_ERROR, loot, lootingGroupLowGUID, m_cooldownTime, m_despawnDelay, m_despawnRespawnTime, m_goValue, m_groupLootTimer, m_lootState, m_respawnDelayTime, m_respawnTime, m_restockTime, m_ritualOwnerGUID, m_SkillupList, m_spawnedByDefault, m_spawnId, m_unique_users, m_usetimes, GameObjectValue::MaxOpens, GameObjectTemplate::maxSuccessOpens, GameObjectTemplate::minSuccessOpens, MINUTE, Unit::RemoveGameObject(), RemoveGameObjectFlag(), ReplaceAllGameObjectFlags(), GameObjectTemplate::reqParticipants, GameObjectAI::Reset(), ResetDoorOrButton(), GameObjectTemplate::ritualPersistent, SaveRespawnTime(), Acore::Containers::SelectRandomContainerElement(), SendCustomAnim(), Player::SendDirectMessage(), WorldObject::SendObjectDeSpawnAnim(), SetGoState(), SetLootState(), CastSpellExtraArgs::SetOriginalCaster(), SetRespawnTime(), sGroupMgr, SMSG_FISH_ESCAPED, sObjectMgr, GameObjectTemplate::spellId, sPoolMgr, sScriptMgr, sSpellMgr, GameObjectTemplate::startDelay, GameObjectTemplate::summoningRitual, GameObjectValue::TargetSearcherCheckType, Object::ToPlayer(), Object::ToUnit(), GameObjectValue::Trap, GameObjectTemplate::trap, GameObjectTemplate::type, WorldObject::Update(), GameObjectAI::UpdateAI(), WorldObject::UpdateObjectVisibility(), urand(), and Cell::VisitObjects().

Referenced by StaticTransport::Update().

◆ UpdateModel()

void GameObject::UpdateModel ( )
protected
2725{
2726 if (!IsInWorld())
2727 return;
2728 if (m_model)
2729 if (GetMap()->ContainsGameObjectModel(*m_model))
2731 delete m_model;
2732 m_model = CreateModel();
2733 if (m_model)
2735}

References CreateModel(), WorldObject::GetMap(), Map::InsertGameObjectModel(), Object::IsInWorld(), m_model, and Map::RemoveGameObjectModel().

Referenced by SetDisplayId().

◆ UpdateModelPosition()

void GameObject::UpdateModelPosition ( )

◆ UpdatePackedRotation()

void GameObject::UpdatePackedRotation ( )
private
2323{
2324 static const int32 PACK_YZ = 1 << 20;
2325 static const int32 PACK_X = PACK_YZ << 1;
2326 static const int32 PACK_YZ_MASK = (PACK_YZ << 1) - 1;
2327 static const int32 PACK_X_MASK = (PACK_X << 1) - 1;
2328 int8 w_sign = (WorldRotation.w >= 0.f ? 1 : -1);
2329 int64 x = int32(WorldRotation.x * PACK_X) * w_sign & PACK_X_MASK;
2330 int64 y = int32(WorldRotation.y * PACK_YZ) * w_sign & PACK_YZ_MASK;
2331 int64 z = int32(WorldRotation.z * PACK_YZ) * w_sign & PACK_YZ_MASK;
2332 m_packedRotation = z | (y << 21) | (x << 42);
2333}
std::int8_t int8
Definition Define.h:105
std::int64_t int64
Definition Define.h:102

References m_packedRotation, and WorldRotation.

Referenced by SetWorldRotation().

◆ Use()

void GameObject::Use ( Unit *  user)
1604{
1605 // Xinef: we cannot use go with not selectable flags
1607 return;
1608
1609 // by default spell caster is user
1610 Unit* spellCaster = user;
1611 uint32 spellId = 0;
1612 uint32 triggeredFlags = TRIGGERED_NONE;
1613
1614 if (Player* playerUser = user->ToPlayer())
1615 {
1616 if (sScriptMgr->OnGossipHello(playerUser, this))
1617 return;
1618
1619 if (AI()->GossipHello(playerUser, false))
1620 return;
1621 }
1622
1623 // If cooldown data present in template
1624 if (uint32 cooldown = GetGOInfo()->GetCooldown())
1625 {
1627 return;
1628
1630 }
1631
1632 if (user->IsPlayer() && GetGoType() != GAMEOBJECT_TYPE_TRAP) // workaround for GO casting
1633 if (!m_goInfo->IsUsableMounted())
1635
1636 switch (GetGoType())
1637 {
1638 case GAMEOBJECT_TYPE_DOOR: //0
1639 //doors/buttons never really despawn, only reset to default state/flags
1640 UseDoorOrButton(0, false, user);
1641 return;
1642 case GAMEOBJECT_TYPE_BUTTON: //1
1643 //doors/buttons never really despawn, only reset to default state/flags
1644 UseDoorOrButton(0, false, user);
1645
1646 // Xinef: properly link possible traps
1647 if (uint32 trapEntry = GetGOInfo()->button.linkedTrap)
1648 TriggeringLinkedGameObject(trapEntry, user);
1649 return;
1651 {
1652 if (!user->IsPlayer())
1653 return;
1654
1655 Player* player = user->ToPlayer();
1656
1657 player->PrepareGossipMenu(this, GetGOInfo()->questgiver.gossipID, true);
1658 player->SendPreparedGossip(this);
1659 return;
1660 }
1661 case GAMEOBJECT_TYPE_TRAP: //6
1662 {
1663 GameObjectTemplate const* goInfo = GetGOInfo();
1664 if (goInfo->trap.spellId)
1665 {
1666 CastSpellExtraArgs args;
1668 CastSpell(user, goInfo->trap.spellId, args);
1669 }
1670
1671 m_cooldownTime = GameTime::GetGameTimeMS().count() + (goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4)) * IN_MILLISECONDS; // template or 4 seconds
1672
1673 if (goInfo->trap.type == 1) // Deactivate after trigger
1675
1676 return;
1677 }
1678 //Sitting: Wooden bench, chairs enzz
1679 case GAMEOBJECT_TYPE_CHAIR: //7
1680 {
1681 GameObjectTemplate const* info = GetGOInfo();
1682 if (!info)
1683 return;
1684
1685 if (!user->IsPlayer())
1686 return;
1687
1688 if (ChairListSlots.empty()) // this is called once at first chair use to make list of available slots
1689 {
1690 if (info->chair.slots > 0) // sometimes chairs in DB have error in fields and we dont know number of slots
1691 for (uint32 i = 0; i < info->chair.slots; ++i)
1692 ChairListSlots[i].Clear(); // Last user of current slot set to 0 (none sit here yet)
1693 else
1694 ChairListSlots[0].Clear(); // error in DB, make one default slot
1695 }
1696
1697 Player* player = user->ToPlayer();
1698
1699 // a chair may have n slots. we have to calculate their positions and teleport the player to the nearest one
1700
1701 float lowestDist = DEFAULT_VISIBILITY_DISTANCE;
1702
1703 uint32 nearest_slot = 0;
1704 float x_lowest = GetPositionX();
1705 float y_lowest = GetPositionY();
1706
1707 // the object orientation + 1/2 pi
1708 // every slot will be on that straight line
1709 float orthogonalOrientation = GetOrientation() + M_PI * 0.5f;
1710 // find nearest slot
1711 bool found_free_slot = false;
1712 for (ChairSlotAndUser::iterator itr = ChairListSlots.begin(); itr != ChairListSlots.end(); ++itr)
1713 {
1714 // the distance between this slot and the center of the go - imagine a 1D space
1715 float relativeDistance = (info->size * itr->first) - (info->size * (info->chair.slots - 1) / 2.0f);
1716
1717 float x_i = GetPositionX() + relativeDistance * cos(orthogonalOrientation);
1718 float y_i = GetPositionY() + relativeDistance * std::sin(orthogonalOrientation);
1719
1720 if (itr->second)
1721 {
1722 if (Player* ChairUser = ObjectAccessor::GetPlayer(*this, itr->second))
1723 {
1724 if (ChairUser->IsSitState() && ChairUser->getStandState() != UNIT_STAND_STATE_SIT && ChairUser->GetExactDist2d(x_i, y_i) < 0.1f)
1725 continue; // This seat is already occupied by ChairUser. NOTE: Not sure if the ChairUser->getStandState() != UNIT_STAND_STATE_SIT check is required.
1726 else
1727 itr->second.Clear(); // This seat is unoccupied.
1728 }
1729 else
1730 itr->second.Clear(); // The seat may of had an occupant, but they're offline.
1731 }
1732
1733 found_free_slot = true;
1734
1735 // calculate the distance between the player and this slot
1736 float thisDistance = player->GetDistance2d(x_i, y_i);
1737
1738 if (thisDistance <= lowestDist)
1739 {
1740 nearest_slot = itr->first;
1741 lowestDist = thisDistance;
1742 x_lowest = x_i;
1743 y_lowest = y_i;
1744 }
1745 }
1746
1747 if (found_free_slot)
1748 {
1749 ChairSlotAndUser::iterator itr = ChairListSlots.find(nearest_slot);
1750 if (itr != ChairListSlots.end())
1751 {
1752 itr->second = player->GetGUID(); //this slot in now used by player
1755 return;
1756 }
1757 }
1758
1759 return;
1760 }
1761 //big gun, its a spell/aura
1762 case GAMEOBJECT_TYPE_GOOBER: //10
1763 {
1764 GameObjectTemplate const* info = GetGOInfo();
1765
1766 // xinef: Goober cannot be used with this flag, skip
1768 return;
1769
1770 if (user->IsPlayer())
1771 {
1772 Player* player = user->ToPlayer();
1773
1774 if (info->goober.pageId) // show page...
1775 {
1777 data << GetGUID();
1778 player->SendDirectMessage(&data);
1779 }
1780 else if (info->goober.gossipID)
1781 {
1782 player->PrepareGossipMenu(this, info->goober.gossipID);
1783 player->SendPreparedGossip(this);
1784 }
1785
1786 if (info->goober.eventId)
1787 {
1788 LOG_DEBUG("maps.script", "Goober ScriptStart id {} for GO entry {} (spawnId {}).", info->goober.eventId, GetEntry(), m_spawnId);
1789 GetMap()->ScriptsStart(sEventScripts, info->goober.eventId, player, this);
1790 EventInform(info->goober.eventId);
1791 }
1792
1793 // possible quest objective for active quests
1794 if (info->goober.questId && sObjectMgr->GetQuestTemplate(info->goober.questId))
1795 {
1796 //Quest require to be active for GO using
1798 break;
1799 }
1800
1801 if (Battleground* bg = player->GetBattleground())
1802 bg->EventPlayerUsedGO(player, this);
1803
1804 if (Group* group = player->GetGroup())
1805 {
1806 for (GroupReference const* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
1807 {
1808 if (Player* member = itr->GetSource())
1809 {
1810 if (member->IsAtGroupRewardDistance(this))
1811 {
1812 member->KillCreditGO(info->entry, GetGUID());
1813 }
1814 }
1815 }
1816 }
1817 else
1818 {
1819 player->KillCreditGO(info->entry, GetGUID());
1820 }
1821 }
1822
1823 if (uint32 trapEntry = info->goober.linkedTrapId)
1824 TriggeringLinkedGameObject(trapEntry, user);
1825
1826 if (info->GetAutoCloseTime())
1827 {
1830 if (!info->goober.customAnim)
1832 }
1833
1834 // this appear to be ok, however others exist in addition to this that should have custom (ex: 190510, 188692, 187389)
1835 if (info->goober.customAnim)
1837
1839
1840 // cast this spell later if provided
1841 spellId = info->goober.spellId;
1842 spellCaster = user;
1843
1844 break;
1845 }
1846 case GAMEOBJECT_TYPE_CAMERA: //13
1847 {
1848 GameObjectTemplate const* info = GetGOInfo();
1849 if (!info)
1850 return;
1851
1852 if (!user->IsPlayer())
1853 return;
1854
1855 Player* player = user->ToPlayer();
1856
1857 if (info->camera.cinematicId)
1859
1860 if (info->camera.eventID)
1861 {
1862 GetMap()->ScriptsStart(sEventScripts, info->camera.eventID, player, this);
1863 EventInform(info->camera.eventID);
1864 }
1865
1866 return;
1867 }
1868 //fishing bobber
1870 {
1871 Player* player = user->ToPlayer();
1872 if (!player)
1873 return;
1874
1875 if (player->GetGUID() != GetOwnerGUID())
1876 return;
1877
1878 switch (getLootState())
1879 {
1880 case GO_READY: // ready for loot
1881 {
1882 uint32 zone, subzone;
1883 GetZoneAndAreaId(zone, subzone);
1884
1885 int32 zoneSkill = sObjectMgr->GetFishingBaseSkillLevel(subzone);
1886 if (!zoneSkill)
1887 zoneSkill = sObjectMgr->GetFishingBaseSkillLevel(zone);
1888
1889 //provide error, no fishable zone or area should be 0
1890 if (!zoneSkill)
1891 LOG_ERROR("sql.sql", "Fishable areaId {} are not properly defined in `skill_fishing_base_level`.", subzone);
1892
1893 // no miss skill is zone skill + 95 since at least patch 2.1
1894 int32 const noMissSkill = zoneSkill + 95;
1895
1896 int32 const skill = player->GetSkillValue(SKILL_FISHING);
1897
1898 int32 chance;
1899 // fishing pool catches are 100%
1900 //TODO: find reasonable value for fishing hole search
1901 GameObject* fishingHole = LookupFishingHoleAround(20.0f + CONTACT_DISTANCE);
1902 if (fishingHole)
1903 chance = 100;
1904 else if (skill < noMissSkill)
1905 {
1906 chance = int32(pow((double)skill / noMissSkill, 2) * 100);
1907 if (chance < 1)
1908 chance = 1;
1909 }
1910 else
1911 chance = 100;
1912
1913 int32 const roll = irand(1, 100);
1914
1915 LOG_DEBUG("entities.gameobject", "Fishing check (skill: {} zone min skill: {} no-miss skill: {} chance {} roll: {})", skill, zoneSkill, noMissSkill, chance, roll);
1916
1917 if (sScriptMgr->OnPlayerUpdateFishingSkill(player, skill, zoneSkill, chance, roll))
1918 player->UpdateFishingSkill();
1919 // but you will likely cause junk in areas that require a high fishing skill (not yet implemented)
1920 if (chance >= roll)
1921 {
1922 // Keep the bobber owned while loot is open, but clear the
1923 // spell id so finishing the fishing channel does not delete it.
1924 SetSpellId(0); // prevent removing unintended auras at Unit::RemoveGameObject
1925
1926 // fishing pool catch
1927 if (fishingHole)
1928 {
1929 fishingHole->Use(player);
1931 }
1932 else
1933 player->SendLoot(GetGUID(), LOOT_FISHING);
1934 }
1935 else // else: junk
1937 break;
1938 }
1939 case GO_JUST_DEACTIVATED: // nothing to do, will be deleted at next update
1940 break;
1941 default:
1942 {
1944
1946 player->SendDirectMessage(&data);
1947 break;
1948 }
1949 }
1950 player->FinishSpell(CURRENT_CHANNELED_SPELL, true);
1951 return;
1952 }
1953
1955 {
1956 if (!user->IsPlayer())
1957 return;
1958
1959 Player* player = user->ToPlayer();
1960 Unit* owner = GetOwner();
1961 GameObjectTemplate const* info = GetGOInfo();
1962
1963 // ritual owner is set for GO's without owner (not summoned)
1964 if (!m_ritualOwnerGUID && !owner)
1965 m_ritualOwnerGUID = player->GetGUID();
1966
1967 if (owner)
1968 {
1969 if (!owner->IsPlayer())
1970 return;
1971
1972 // accept only use by player from same group as owner, excluding owner itself (unique use already added in spell effect)
1973 if (player == owner->ToPlayer() || (info->summoningRitual.castersGrouped && !player->IsInSameRaidWith(owner->ToPlayer())))
1974 return;
1975
1976 // expect owner to already be channeling, so if not...
1978 return;
1979 }
1980 else
1981 {
1982 Player* ritualOwner = ObjectAccessor::GetPlayer(*this, m_ritualOwnerGUID);
1983 if (!ritualOwner)
1984 return;
1985 if (player != ritualOwner && (info->summoningRitual.castersGrouped && !player->IsInSameRaidWith(ritualOwner)))
1986 return;
1987 }
1988
1990
1992 return;
1993
1994 SpellCastResult castResult;
1995 if (info->summoningRitual.animSpell)
1996 castResult = player->CastSpell(player, info->summoningRitual.animSpell, true);
1997 else
1998 castResult = player->CastSpell(player, GetSpellId(),
2003
2004 if (castResult != SPELL_CAST_OK)
2005 return;
2006
2007 AddUniqueUse(player);
2008
2009 // full amount unique participants including original summoner
2011 {
2013
2014 // channel ready, maintain this
2016 }
2017
2018 return;
2019 }
2021 {
2022 GameObjectTemplate const* info = GetGOInfo();
2023 if (!info)
2024 return;
2025
2026 if (info->spellcaster.partyOnly)
2027 {
2028 if (!user->IsPlayer())
2029 return;
2030 if (ObjectGuid ownerGuid = GetOwnerGUID())
2031 {
2032 if (user->GetGUID() != ownerGuid)
2033 {
2034 Group* group = user->ToPlayer()->GetGroup();
2035 if (!group)
2036 return;
2037 if (!group->IsMember(ownerGuid))
2038 return;
2039 }
2040 }
2041 }
2042
2043 spellId = info->spellcaster.spellId;
2044 break;
2045 }
2047 {
2048 GameObjectTemplate const* info = GetGOInfo();
2049
2050 if (!user->IsPlayer())
2051 return;
2052
2053 Player* player = user->ToPlayer();
2054
2055 Player* targetPlayer = ObjectAccessor::FindPlayer(player->GetTarget());
2056
2057 // accept only use by player from same raid as caster
2058 if (!targetPlayer || !targetPlayer->IsInSameRaidWith(player))
2059 return;
2060
2061 //required lvl checks!
2062 uint8 level = player->GetLevel();
2063 if (level < info->meetingstone.minLevel)
2064 return;
2065 level = targetPlayer->GetLevel();
2066 if (level < info->meetingstone.minLevel)
2067 return;
2068
2069 spellId = 23598; // Meeting Stone Summon
2070
2071 break;
2072 }
2073
2074 case GAMEOBJECT_TYPE_FLAGSTAND: // 24
2075 {
2076 if (!user->IsPlayer())
2077 return;
2078
2079 Player* player = user->ToPlayer();
2080
2081 if (player->CanUseBattlegroundObject(this))
2082 {
2083 // in battleground check
2084 Battleground* bg = player->GetBattleground();
2085 if (!bg)
2086 return;
2087
2088 if (player->GetVehicle())
2089 return;
2090
2093 // BG flag click
2094 // AB:
2095 // 15001
2096 // 15002
2097 // 15003
2098 // 15004
2099 // 15005
2100 bg->EventPlayerClickedOnFlag(player, this);
2101 return; //we don;t need to delete flag ... it is despawned!
2102 }
2103 break;
2104 }
2105
2106 case GAMEOBJECT_TYPE_FISHINGHOLE: // 25
2107 {
2108 if (!user->IsPlayer())
2109 return;
2110
2111 Player* player = user->ToPlayer();
2112
2113 player->SendLoot(GetGUID(), LOOT_FISHINGHOLE);
2115 return;
2116 }
2117
2118 case GAMEOBJECT_TYPE_FLAGDROP: // 26
2119 {
2120 if (!user->IsPlayer())
2121 return;
2122
2123 Player* player = user->ToPlayer();
2124
2125 if (player->CanUseBattlegroundObject(this))
2126 {
2127 // in battleground check
2128 Battleground* bg = player->GetBattleground();
2129 if (!bg)
2130 return;
2131
2132 if (player->GetVehicle())
2133 return;
2134
2137 // BG flag dropped
2138 // WS:
2139 // 179785 - Silverwing Flag
2140 // 179786 - Warsong Flag
2141 // EotS:
2142 // 184142 - Netherstorm Flag
2143 GameObjectTemplate const* info = GetGOInfo();
2144 if (info)
2145 {
2147 {
2148 GameObject::gameObjectToEventFlag[info->entry](player, this, bg);
2149 }
2150 else
2151 {
2152 switch (info->entry)
2153 {
2154 case 179785: // Silverwing Flag
2155 case 179786: // Warsong Flag
2156 if (bg->GetBgTypeID(true) == BATTLEGROUND_WS)
2157 bg->EventPlayerClickedOnFlag(player, this);
2158 break;
2159 case 184142: // Netherstorm Flag
2160 if (bg->GetBgTypeID(true) == BATTLEGROUND_EY)
2161 bg->EventPlayerClickedOnFlag(player, this);
2162 break;
2163 }
2164 }
2165 }
2166 //this cause to call return, all flags must be deleted here!!
2167 spellId = 0;
2168 Delete();
2169 }
2170 break;
2171 }
2173 {
2174 GameObjectTemplate const* info = GetGOInfo();
2175 if (!info)
2176 return;
2177
2178 if (!user->IsPlayer())
2179 return;
2180
2181 Player* player = user->ToPlayer();
2182
2183 // fallback, will always work
2185
2187 player->SendDirectMessage(&data);
2188
2190 return;
2191 }
2192 default:
2194 LOG_ERROR("entities.gameobject", "GameObject::Use(): unit ({}, name: {}) tries to use object ({}, name: {}) of unknown type ({})",
2195 user->GetGUID().ToString(), user->GetName(), GetGUID().ToString(), GetGOInfo()->name, GetGoType());
2196 break;
2197 }
2198
2199 if (!spellId)
2200 return;
2201
2202 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
2203 if (!spellInfo)
2204 {
2205 if (!user->IsPlayer() || !sOutdoorPvPMgr->HandleCustomSpell(user->ToPlayer(), spellId, this))
2206 LOG_ERROR("entities.gameobject", "WORLD: unknown spell id {} at use action for gameobject (Entry: {} GoType: {})", spellId, GetEntry(), GetGoType());
2207 else
2208 LOG_DEBUG("outdoorpvp", "WORLD: {} non-dbc spell was handled by OutdoorPvP", spellId);
2209 return;
2210 }
2211
2214
2215 if (Player* player = user->ToPlayer())
2216 sOutdoorPvPMgr->HandleCustomSpell(player, spellId, this);
2217
2218 if (spellCaster)
2219 {
2220 if ((spellCaster->CastSpell(user, spellInfo, TriggerCastFlags(triggeredFlags)) == SPELL_CAST_OK) && GetGoType() == GAMEOBJECT_TYPE_SPELLCASTER)
2221 AddUse();
2222 }
2223 else
2224 CastSpell(user, spellId);
2225}
@ ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT
Definition DBCEnums.h:183
@ LOOT_FISHING_JUNK
Definition LootMgr.h:91
@ LOOT_FISHING
Definition LootMgr.h:82
@ LOOT_FISHINGHOLE
Definition LootMgr.h:89
#define DEFAULT_VISIBILITY_DISTANCE
Definition ObjectDefines.h:39
ScriptMapMap sEventScripts
Definition ObjectMgr.cpp:61
#define sOutdoorPvPMgr
Definition OutdoorPvPMgr.h:102
@ TELE_TO_NOT_LEAVE_COMBAT
Definition Player.h:817
@ TELE_TO_NOT_UNSUMMON_PET
Definition Player.h:818
@ TELE_TO_NOT_LEAVE_TRANSPORT
Definition Player.h:816
int32 irand(int32 min, int32 max)
Definition Random.cpp:37
@ GAMEOBJECT_TYPE_MEETINGSTONE
Definition SharedDefines.h:1587
@ GAMEOBJECT_TYPE_SPELLCASTER
Definition SharedDefines.h:1586
@ BATTLEGROUND_WS
Definition SharedDefines.h:3738
@ BATTLEGROUND_EY
Definition SharedDefines.h:3743
SpellCastResult
Definition SharedDefines.h:936
@ SPELL_CAST_OK
Definition SharedDefines.h:1126
@ SKILL_FISHING
Definition SharedDefines.h:3190
@ SPELL_AURA_MOD_INVISIBILITY
Definition SpellAuraDefines.h:81
@ SPELL_AURA_MOUNTED
Definition SpellAuraDefines.h:141
@ SPELL_AURA_MOD_STEALTH
Definition SpellAuraDefines.h:79
TriggerCastFlags
Definition SpellDefines.h:140
@ TRIGGERED_IGNORE_POWER_AND_REAGENT_COST
Will ignore Spell and Category cooldowns.
Definition SpellDefines.h:144
@ TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD
Will ignore GCD.
Definition SpellDefines.h:143
@ TRIGGERED_CAST_DIRECTLY
Will ignore combo point requirement.
Definition SpellDefines.h:149
@ TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE
Will ignore caster aura states including combat requirements and death state.
Definition SpellDefines.h:154
@ TRIGGERED_IGNORE_EFFECTS
Periodic aura tick wont be reset on override.
Definition SpellDefines.h:161
@ TRIGGERED_NONE
Definition SpellDefines.h:141
@ UNIT_STAND_STATE_SIT_LOW_CHAIR
Definition UnitDefines.h:39
@ UNIT_STAND_STATE_SIT
Definition UnitDefines.h:36
virtual void EventPlayerClickedOnFlag(Player *, GameObject *)
Definition Battleground.h:521
BattlegroundTypeId GetBgTypeID(bool GetRandom=false) const
Definition Battleground.h:330
void StartCinematic(uint32 const cinematicSequenceId)
Definition CinematicMgr.cpp:31
void UseDoorOrButton(uint32 time_to_restore=0, bool alternative=false, Unit *user=nullptr)
Definition GameObject.cpp:1553
static std::unordered_map< int, goEventFlag > gameObjectToEventFlag
Definition GameObject.h:3042
LootState getLootState() const
Definition GameObject.h:230
ChairSlotAndUser ChairListSlots
Definition GameObject.h:410
void TriggeringLinkedGameObject(uint32 trapEntry, Unit *target)
Definition GameObject.cpp:1500
GameObject * LookupFishingHoleAround(float range)
Definition GameObject.cpp:1523
void Use(Unit *user)
Definition GameObject.cpp:1603
void AddUniqueUse(Player *player)
Definition GameObject.cpp:1037
void SetSpellId(uint32 id)
Definition GameObject.h:183
Definition GroupReference.h:27
bool IsMember(ObjectGuid guid) const
Definition Group.cpp:2578
void ScriptsStart(std::map< uint32, std::multimap< uint32, ScriptInfo > > const &scripts, uint32 id, Object *source, Object *target)
Put scripts in the execution queue.
Definition MapScripts.cpp:31
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
Definition PlayerUpdates.cpp:2232
bool IsInSameRaidWith(Player const *p) const
Definition Player.h:1915
bool UpdateFishingSkill()
Definition PlayerUpdates.cpp:906
uint16 GetSkillValue(uint32 skill) const
Definition Player.cpp:5644
bool CanUseBattlegroundObject(GameObject *gameobject) const
Definition Player.cpp:13614
CinematicMgr & GetCinematicMgr()
Definition Player.h:1403
void SendPreparedGossip(WorldObject *source)
Definition PlayerGossip.cpp:214
void SendLoot(ObjectGuid guid, LootType loot_type)
Definition Player.cpp:8007
Group * GetGroup()
Definition Player.h:2518
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0, Unit *target=nullptr, bool newInstance=false)
Definition Player.cpp:1402
void KillCreditGO(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition PlayerQuest.cpp:2130
void PrepareGossipMenu(WorldObject *source, uint32 menuId=0, bool showQuests=false)
Definition PlayerGossip.cpp:32
Vehicle * GetVehicle() const
Definition Unit.h:1948
void FinishSpell(CurrentSpellTypes spellType, bool ok=true)
Definition Unit.cpp:4037
void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
Definition Unit.cpp:5178
void SetStandState(uint8 state)
Definition Unit.cpp:12801
ObjectGuid GetTarget() const
Definition Unit.h:867
uint8 GetLevel() const
Definition Unit.h:1117
float GetDistance2d(WorldObject const *obj) const
Definition Object.cpp:1322
@ SMSG_GAMEOBJECT_PAGETEXT
Definition Opcodes.h:509
@ SMSG_ENABLE_BARBER_SHOP
Definition Opcodes.h:1093
@ SMSG_FISH_NOT_HOOKED
Definition Opcodes.h:486
Player * FindPlayer(ObjectGuid const guid)
Definition ObjectAccessor.cpp:269
uint32 castersGrouped
Definition GameObjectData.h:238
uint32 height
Definition GameObjectData.h:136
struct GameObjectTemplate::@237::@255 spellcaster
uint32 gossipID
Definition GameObjectData.h:73
uint32 GetAutoCloseTime() const
Definition GameObjectData.h:511
uint32 linkedTrap
Definition GameObjectData.h:60
uint32 slots
Definition GameObjectData.h:135
bool IsUsableMounted() const
Definition GameObjectData.h:411
struct GameObjectTemplate::@237::@245 chair
uint32 partyOnly
Definition GameObjectData.h:254
uint32 chairheight
Definition GameObjectData.h:346
uint32 eventId
Definition GameObjectData.h:90
uint32 pageId
Definition GameObjectData.h:169
struct GameObjectTemplate::@237::@251 camera
uint32 eventID
Definition GameObjectData.h:210
struct GameObjectTemplate::@237::@264 barberChair
uint32 cinematicId
Definition GameObjectData.h:209
uint32 customAnim
Definition GameObjectData.h:74
uint32 linkedTrapId
Definition GameObjectData.h:91

References ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT, AddUniqueUse(), AddUse(), AI(), GameObjectTemplate::animSpell, GameObjectTemplate::barberChair, BATTLEGROUND_EY, BATTLEGROUND_WS, GameObjectTemplate::camera, Player::CanUseBattlegroundObject(), GameObjectTemplate::castersGrouped, Unit::CastSpell(), CastSpell(), GameObjectTemplate::chair, GameObjectTemplate::chairheight, ChairListSlots, CheckRitualList(), GameObjectTemplate::cinematicId, CONTACT_DISTANCE, GameObjectTemplate::cooldown, CURRENT_CHANNELED_SPELL, GameObjectTemplate::customAnim, DEFAULT_VISIBILITY_DISTANCE, Delete(), GameObjectTemplate::entry, GameObjectTemplate::eventId, GameObjectTemplate::eventID, EventInform(), Battleground::EventPlayerClickedOnFlag(), ObjectAccessor::FindPlayer(), Unit::FinishSpell(), GAMEOBJECT_TYPE_BARBER_CHAIR, GAMEOBJECT_TYPE_BUTTON, GAMEOBJECT_TYPE_CAMERA, GAMEOBJECT_TYPE_CHAIR, GAMEOBJECT_TYPE_DOOR, GAMEOBJECT_TYPE_FISHINGHOLE, GAMEOBJECT_TYPE_FISHINGNODE, GAMEOBJECT_TYPE_FLAGDROP, GAMEOBJECT_TYPE_FLAGSTAND, GAMEOBJECT_TYPE_GOOBER, GAMEOBJECT_TYPE_MEETINGSTONE, GAMEOBJECT_TYPE_QUESTGIVER, GAMEOBJECT_TYPE_SPELLCASTER, GAMEOBJECT_TYPE_SUMMONING_RITUAL, GAMEOBJECT_TYPE_TRAP, gameObjectToEventFlag, GameObjectTemplate::GetAutoCloseTime(), Player::GetBattleground(), Battleground::GetBgTypeID(), Player::GetCinematicMgr(), Unit::GetCurrentSpell(), WorldObject::GetDistance2d(), Object::GetEntry(), GameTime::GetGameTimeMS(), GetGoAnimProgress(), GetGOInfo(), GetGoType(), Player::GetGroup(), Object::GetGUID(), Object::GetGUID(), Unit::GetLevel(), getLootState(), WorldObject::GetMap(), WorldLocation::GetMapId(), WorldObject::GetName(), Position::GetOrientation(), GetOwner(), GetOwnerGUID(), ObjectAccessor::GetPlayer(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Player::GetQuestStatus(), Player::GetSkillValue(), GetSpellId(), Unit::GetTarget(), GetUniqueUseCount(), Unit::GetVehicle(), WorldObject::GetZoneAndAreaId(), GO_ACTIVATED, GO_FLAG_IN_USE, GO_FLAG_NOT_SELECTABLE, GO_JUST_DEACTIVATED, GO_NOT_READY, GO_READY, GO_STATE_ACTIVE, GameObjectTemplate::goober, GameObjectTemplate::gossipID, HasGameObjectFlag(), GameObjectTemplate::height, IN_MILLISECONDS, irand(), Player::IsInSameRaidWith(), Group::IsMember(), Object::IsPlayer(), GameObjectTemplate::IsUsableMounted(), Player::KillCreditGO(), GameObjectTemplate::linkedTrap, GameObjectTemplate::linkedTrapId, LOG_DEBUG, LOG_ERROR, LookupFishingHoleAround(), LOOT_FISHING, LOOT_FISHING_JUNK, LOOT_FISHINGHOLE, m_cooldownTime, m_goInfo, m_ritualOwnerGUID, m_spawnId, MAX_GAMEOBJECT_TYPE, GameObjectTemplate::pageId, GameObjectTemplate::partyOnly, Player::PrepareGossipMenu(), QUEST_STATUS_INCOMPLETE, GameObjectTemplate::questId, Unit::RemoveAurasByType(), GameObjectTemplate::reqParticipants, Map::ScriptsStart(), SendCustomAnim(), Player::SendDirectMessage(), Player::SendLoot(), Player::SendPreparedGossip(), SetGameObjectFlag(), SetGoState(), SetLootState(), CastSpellExtraArgs::SetOriginalCaster(), SetSpellId(), Unit::SetStandState(), sEventScripts, GameObjectTemplate::size, SKILL_FISHING, GameObjectTemplate::slots, SMSG_ENABLE_BARBER_SHOP, SMSG_FISH_NOT_HOOKED, SMSG_GAMEOBJECT_PAGETEXT, sObjectMgr, sOutdoorPvPMgr, SPELL_AURA_MOD_INVISIBILITY, SPELL_AURA_MOD_STEALTH, SPELL_AURA_MOUNTED, SPELL_CAST_OK, GameObjectTemplate::spellcaster, GameObjectTemplate::spellId, sScriptMgr, sSpellMgr, CinematicMgr::StartCinematic(), GameObjectTemplate::summoningRitual, TELE_TO_NOT_LEAVE_COMBAT, TELE_TO_NOT_LEAVE_TRANSPORT, TELE_TO_NOT_UNSUMMON_PET, Player::TeleportTo(), Object::ToPlayer(), ObjectGuid::ToString(), Position::ToString(), GameObjectTemplate::trap, TRIGGERED_CAST_DIRECTLY, TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE, TRIGGERED_IGNORE_EFFECTS, TRIGGERED_IGNORE_POWER_AND_REAGENT_COST, TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD, TRIGGERED_NONE, TriggeringLinkedGameObject(), GameObjectTemplate::type, UNIT_STAND_STATE_SIT, UNIT_STAND_STATE_SIT_LOW_CHAIR, Player::UpdateAchievementCriteria(), Player::UpdateFishingSkill(), Use(), and UseDoorOrButton().

Referenced by Spell::EffectActivateObject(), spell_onyxia_disturb_lava_fissure::HandleActivateObject(), spell_q9452_cast_net::HandleActiveObject(), go_sand_trap::Reset(), Spell::SendLoot(), npc_valiance_keep_cannoneer::npc_valiance_keep_cannoneerAI::UpdateAI(), and Use().

◆ UseDoorOrButton()

◆ ValidateGameobjectType()

bool GameObject::ValidateGameobjectType ( ) const
2638{
2639 switch (m_goInfo->type)
2640 {
2646 return true;
2647 default:
2648 return false;
2649 }
2650}
@ GAMEOBJECT_TYPE_TRAPDOOR
Definition SharedDefines.h:1599

References GAMEOBJECT_TYPE_BUTTON, GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING, GAMEOBJECT_TYPE_DOOR, GAMEOBJECT_TYPE_TRAP, GAMEOBJECT_TYPE_TRAPDOOR, m_goInfo, and GameObjectTemplate::type.

Referenced by IsInstanceGameobject().

Member Data Documentation

◆ _lootStateUnitGUID

ObjectGuid GameObject::_lootStateUnitGUID
protected

Referenced by SetLootState(), and Update().

◆ _respawnCompatibilityMode

bool GameObject::_respawnCompatibilityMode {true}
protected
392{true};

Referenced by IsRespawnCompatibilityMode(), and LoadGameObjectFromDB().

◆ ChairListSlots

ChairSlotAndUser GameObject::ChairListSlots
protected

Referenced by Use().

◆ gameObjectToEventFlag

std::unordered_map< int, goEventFlag > GameObject::gameObjectToEventFlag = { }
static
3091{
3092 //6 GAMEOBJECT_TYPE_TRAP
3093 struct
3094 {
3095 uint8 TargetSearcherCheckType; // SpellTargetCheckTypes
3096 } Trap;
3097 //11 GAMEOBJECT_TYPE_TRANSPORT
3098 struct
3099 {
3100 uint32 PathProgress;
3101 TransportAnimation const* AnimationInfo;
3102 } Transport;
3103 //25 GAMEOBJECT_TYPE_FISHINGHOLE
3104 struct
3105 {
3106 uint32 MaxOpens;
3107 } FishingHole;
3108 //29 GAMEOBJECT_TYPE_CAPTURE_POINT
3109 struct
3110 {
3111 OPvPCapturePoint* OPvPObj;
3112 } CapturePoint;
3113 //33 GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING
3114 struct
3115 {
3116 uint32 Health;
3117 uint32 MaxHealth;
3118 } Building;
3119};
3120
3121enum class GameObjectActions : uint32
3122{
3123 // Name from client executable // Comments
3124 None, // -NONE-
3125 AnimateCustom0, // Animate Custom0
3126 AnimateCustom1, // Animate Custom1
3127 AnimateCustom2, // Animate Custom2
3128 AnimateCustom3, // Animate Custom3
3129 Disturb, // Disturb // Triggers trap
3130 Unlock, // Unlock // Resets GO_FLAG_LOCKED
3131 Lock, // Lock // Sets GO_FLAG_LOCKED
3132 Open, // Open // Sets GO_STATE_ACTIVE
3133 OpenAndUnlock, // Open + Unlock // Sets GO_STATE_ACTIVE and resets GO_FLAG_LOCKED
3134 Close, // Close // Sets GO_STATE_READY
3135 ToggleOpen, // Toggle Open
3136 Destroy, // Destroy // Sets GO_STATE_DESTROYED
3137 Rebuild, // Rebuild // Resets from GO_STATE_DESTROYED
3138 Creation, // Creation
3139 Despawn, // Despawn
3140 MakeInert, // Make Inert // Disables interactions
3141 MakeActive, // Make Active // Enables interactions
3142 CloseAndLock, // Close + Lock // Sets GO_STATE_READY and sets GO_FLAG_LOCKED
3143 UseArtKit0, // Use ArtKit0 // 46904: 121
3144 UseArtKit1, // Use ArtKit1 // 36639: 81, 46903: 122
3145 UseArtKit2, // Use ArtKit2
3146 UseArtKit3, // Use ArtKit3
3147 SetTapList, // Set Tap List
3148};
3149
3150// For containers: [GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY -> ...
3151// For bobber: GO_NOT_READY ->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED-><deleted>
3152// For door(closed):[GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY(close) -> ...
3153// For door(open): [GO_NOT_READY]->GO_READY (open) ->GO_ACTIVATED (close)->GO_JUST_DEACTIVATED->GO_READY(open) -> ...
3154enum LootState
3155{
3157 GO_READY, // can be ready but despawned, and then not possible activate until spawn
3160};
3161
3162// 5 sec for bobber catch
3163#define FISHING_BOBBER_READY_TIME 5
3164
3165class GameObject : public WorldObject, public GridObject<GameObject>, public MovableMapObject, public UpdatableMapObject
3166{
3167public:
3168 explicit GameObject();
3169 ~GameObject() override;
3170
3171 void BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target) override;
3172
3173 void AddToWorld() override;
3174 void RemoveFromWorld() override;
3175 void CleanupsBeforeDelete(bool finalCleanup = true) override;
3176
3177 uint32 GetDynamicFlags() const override { return GetUInt32Value(GAMEOBJECT_DYNAMIC); }
3178 void ReplaceAllDynamicFlags(uint32 flag) override { SetUInt32Value(GAMEOBJECT_DYNAMIC, flag); }
3179
3180 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);
3181 void Update(uint32 p_time) override;
3182 [[nodiscard]] GameObjectTemplate const* GetGOInfo() const { return m_goInfo; }
3183 [[nodiscard]] GameObjectTemplateAddon const* GetTemplateAddon() const;
3184 [[nodiscard]] GameObjectData const* GetGameObjectData() const { return m_goData; }
3185 [[nodiscard]] GameObjectValue const* GetGOValue() const { return &m_goValue; }
3186
3187 [[nodiscard]] bool IsTransport() const;
3188 [[nodiscard]] bool IsDestructibleBuilding() const;
3189
3190 [[nodiscard]] ObjectGuid::LowType GetSpawnId() const { return m_spawnId; }
3191
3192 // z_rot, y_rot, x_rot - rotation angles around z, y and x axes
3193 void SetWorldRotationAngles(float z_rot, float y_rot, float x_rot);
3194 void SetWorldRotation(G3D::Quat const& rot);
3195 void SetTransportPathRotation(float qx, float qy, float qz, float qw);
3196 [[nodiscard]] G3D::Quat const& GetWorldRotation() const { return WorldRotation; }
3197 [[nodiscard]] int64 GetPackedWorldRotation() const { return m_packedRotation; }
3198 [[nodiscard]] G3D::Quat GetFinalWorldRotation() const;
3199
3200 // overwrite WorldObject function for proper name localization
3201 [[nodiscard]] std::string const& GetNameForLocaleIdx(LocaleConstant locale_idx) const override;
3202
3203 void SaveToDB(bool saveAddon = false);
3204 void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask, bool saveAddon = false);
3205 virtual bool LoadFromDB(ObjectGuid::LowType guid, Map* map) { return LoadGameObjectFromDB(guid, map, false); }
3206 virtual bool LoadGameObjectFromDB(ObjectGuid::LowType guid, Map* map, bool addToMap = true);
3207 [[nodiscard]] bool IsRespawnCompatibilityMode() const { return _respawnCompatibilityMode; }
3208 void DeleteFromDB();
3209
3210 void SetOwnerGUID(ObjectGuid owner)
3211 {
3212 // Owner already found and different than expected owner - remove object from old owner
3213 if (owner && GetOwnerGUID() && GetOwnerGUID() != owner)
3214 {
3215 ABORT();
3216 }
3217 m_spawnedByDefault = false; // all object with owner is despawned after delay
3219 }
3220 [[nodiscard]] ObjectGuid GetOwnerGUID() const override { return GetGuidValue(OBJECT_FIELD_CREATED_BY); }
3221 [[nodiscard]] uint32 GetFaction() const override { return GetUInt32Value(GAMEOBJECT_FACTION); }
3222 [[nodiscard]] Unit* GetOwner() const;
3223
3224 void SetSpellId(uint32 id)
3225 {
3226 m_spawnedByDefault = false; // all summoned object is despawned after delay
3227 m_spellId = id;
3228 }
3229 [[nodiscard]] uint32 GetSpellId() const { return m_spellId;}
3230
3231 [[nodiscard]] time_t GetRespawnTime() const { return m_respawnTime; }
3232 [[nodiscard]] time_t GetRespawnTimeEx() const;
3233
3234 void SetRespawnTime(int32 respawn);
3235 void SetRespawnDelay(int32 respawn);
3236 void Respawn();
3237 [[nodiscard]] bool isSpawned() const
3238 {
3239 return m_respawnDelayTime == 0 ||
3242 }
3243 [[nodiscard]] bool isSpawnedByDefault() const { return m_spawnedByDefault; }
3244 void SetSpawnedByDefault(bool b) { m_spawnedByDefault = b; }
3245 [[nodiscard]] uint32 GetRespawnDelay() const { return m_respawnDelayTime; }
3246 void Refresh();
3247 void DespawnOrUnsummon(Milliseconds delay = 0ms, Seconds forcedRespawnTime = 0s);
3248 void Delete();
3249 void GetFishLoot(Loot* fishLoot, Player* lootOwner, bool junk = false);
3250 [[nodiscard]] GameobjectTypes GetGoType() const { return GameobjectTypes(GetByteValue(GAMEOBJECT_BYTES_1, 1)); }
3252 [[nodiscard]] GOState GetGoState() const { return GOState(GetByteValue(GAMEOBJECT_BYTES_1, 0)); }
3253 void SetGoState(GOState state);
3254 [[nodiscard]] uint8 GetGoArtKit() const { return GetByteValue(GAMEOBJECT_BYTES_1, 2); }
3255 void SetGoArtKit(uint8 artkit);
3256 [[nodiscard]] uint8 GetGoAnimProgress() const { return GetByteValue(GAMEOBJECT_BYTES_1, 3); }
3257 void SetGoAnimProgress(uint8 animprogress) { SetByteValue(GAMEOBJECT_BYTES_1, 3, animprogress); }
3258 static void SetGoArtKit(uint8 artkit, GameObject* go, ObjectGuid::LowType lowguid = 0);
3259
3260 void SetPhaseMask(uint32 newPhaseMask, bool update) override;
3261 void EnableCollision(bool enable);
3262
3264 bool HasGameObjectFlag(GameObjectFlags flags) const { return HasFlag(GAMEOBJECT_FLAGS, flags) != 0; }
3268
3269 void Use(Unit* user);
3270
3271 [[nodiscard]] LootState getLootState() const { return m_lootState; }
3272 // Note: unit is only used when s = GO_ACTIVATED
3273 void SetLootState(LootState s, Unit* unit = nullptr);
3274
3275 [[nodiscard]] uint16 GetLootMode() const { return m_LootMode; }
3276 [[nodiscard]] bool HasLootMode(uint16 lootMode) const { return m_LootMode & lootMode; }
3277 void SetLootMode(uint16 lootMode) { m_LootMode = lootMode; }
3278 void AddLootMode(uint16 lootMode) { m_LootMode |= lootMode; }
3279 void RemoveLootMode(uint16 lootMode) { m_LootMode &= ~lootMode; }
3281
3282 void AddToSkillupList(ObjectGuid const& playerGuid);
3283 [[nodiscard]] bool IsInSkillupList(ObjectGuid const& playerGuid) const;
3284
3285 void AddUniqueUse(Player* player);
3286 void AddUse() { ++m_usetimes; }
3287
3288 [[nodiscard]] uint32 GetUseCount() const { return m_usetimes; }
3289 [[nodiscard]] uint32 GetUniqueUseCount() const { return m_unique_users.size(); }
3290
3291 void SaveRespawnTime() override { SaveRespawnTime(0); }
3292 void SaveRespawnTime(uint32 forceDelay);
3293
3294 Loot loot;
3295
3296 [[nodiscard]] Player* GetLootRecipient() const;
3297 [[nodiscard]] ObjectGuid GetLootRecipientGUID() const { return m_lootRecipient; }
3298 [[nodiscard]] Group* GetLootRecipientGroup() const;
3300 void SetLootRecipient(Creature* creature);
3301 void SetLootRecipient(Map* map);
3302 bool IsLootAllowedFor(Player const* player) const;
3303 [[nodiscard]] bool HasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; }
3304 uint32 m_groupLootTimer; // (msecs)timer used for group loot
3305 uint32 lootingGroupLowGUID; // used to find group which is looting
3306 void SetLootGenerationTime();
3307 [[nodiscard]] uint32 GetLootGenerationTime() const { return m_lootGenerationTime; }
3308
3309 [[nodiscard]] GameObject* GetLinkedTrap();
3310 void SetLinkedTrap(GameObject* linkedTrap) { m_linkedTrap = linkedTrap->GetGUID(); }
3311
3312 [[nodiscard]] bool hasQuest(uint32 quest_id) const override;
3313 [[nodiscard]] bool hasInvolvedQuest(uint32 quest_id) const override;
3314 bool ActivateToQuest(Player* target) const;
3315 void UseDoorOrButton(uint32 time_to_restore = 0, bool alternative = false, Unit* user = nullptr);
3316 // 0 = use `gameobject`.`spawntimesecs`
3317 void ResetDoorOrButton();
3318
3319 void TriggeringLinkedGameObject(uint32 trapEntry, Unit* target);
3320
3321 [[nodiscard]] bool IsNeverVisible() const override;
3322 bool IsAlwaysVisibleFor(WorldObject const* seer) const override;
3323 [[nodiscard]] bool IsInvisibleDueToDespawn() const override;
3324
3325 uint8 getLevelForTarget(WorldObject const* target) const override
3326 {
3327 if (Unit* owner = GetOwner())
3328 return owner->getLevelForTarget(target);
3329
3331 {
3332 // use the level from the trap template, otherwise match the target
3333 // so ownerless utility traps cannot miss through level difference
3334 if (GetGOInfo()->trap.level)
3335 return GetGOInfo()->trap.level;
3336 if (Unit const* targetUnit = target->ToUnit())
3337 return targetUnit->GetLevel();
3338 }
3339
3340 return 1;
3341 }
3342
3343 GameObject* LookupFishingHoleAround(float range);
3344
3346 void CastSpell(Unit* target, uint32 spellId);
3347 void SendCustomAnim(uint32 anim);
3348 bool IsInRange2d(float x, float y, float radius) const;
3349 bool IsInRange3d(float x, float y, float z, float radius) const;
3350
3351 void ModifyHealth(int32 change, Unit* attackerOrHealer = nullptr, uint32 spellId = 0);
3353 // sets GameObject type 33 destruction flags and optionally default health for that state
3354 void SetDestructibleState(GameObjectDestructibleState state, Player* eventInvoker = nullptr, bool setHealth = false);
3356 {
3362 }
3363
3364 void EventInform(uint32 eventId);
3365
3366 [[nodiscard]] virtual uint32 GetScriptId() const;
3367 [[nodiscard]] GameObjectAI* AI() const { return m_AI; }
3368
3369 [[nodiscard]] std::string const& GetAIName() const;
3370 void SetDisplayId(uint32 displayid);
3371 [[nodiscard]] uint32 GetDisplayId() const { return GetUInt32Value(GAMEOBJECT_DISPLAYID); }
3372
3374 void GetRespawnPosition(float& x, float& y, float& z, float* ori = nullptr) const;
3375
3376 void SetPosition(float x, float y, float z, float o);
3377 void SetPosition(Position const& pos) { SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); }
3378
3379 [[nodiscard]] bool IsStaticTransport() const { return GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT; }
3380 [[nodiscard]] bool IsMotionTransport() const { return GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT; }
3381
3382 Transport* ToTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT || GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<Transport*>(this); else return nullptr; }
3383 [[nodiscard]] Transport const* ToTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT || GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<Transport const*>(this); else return nullptr; }
3384
3385 StaticTransport* ToStaticTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<StaticTransport*>(this); else return nullptr; }
3386 [[nodiscard]] StaticTransport const* ToStaticTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<StaticTransport const*>(this); else return nullptr; }
3387
3388 MotionTransport* ToMotionTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT) return reinterpret_cast<MotionTransport*>(this); else return nullptr; }
3389 [[nodiscard]] MotionTransport const* ToMotionTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT) return reinterpret_cast<MotionTransport const*>(this); else return nullptr; }
3390
3391 [[nodiscard]] float GetStationaryX() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionX(); return GetPositionX(); }
3392 [[nodiscard]] float GetStationaryY() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionY(); return GetPositionY(); }
3393 [[nodiscard]] float GetStationaryZ() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionZ(); return GetPositionZ(); }
3394 [[nodiscard]] float GetStationaryO() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetOrientation(); return GetOrientation(); }
3395
3396 [[nodiscard]] float GetInteractionDistance() const;
3397
3398 void UpdateModelPosition();
3399
3400 [[nodiscard]] bool IsAtInteractDistance(Position const& pos, float radius) const;
3401 [[nodiscard]] bool IsAtInteractDistance(Player const* player, SpellInfo const* spell = nullptr) const;
3402
3403 [[nodiscard]] bool IsWithinDistInMap(Player const* player) const;
3405
3406 [[nodiscard]] SpellInfo const* GetSpellForLock(Player const* player) const;
3407
3408 static std::unordered_map<int, goEventFlag> gameObjectToEventFlag; // Gameobject -> event flag
3409
3410 [[nodiscard]] bool ValidateGameobjectType() const;
3411 [[nodiscard]] bool IsInstanceGameobject() const;
3412 [[nodiscard]] uint8 GameobjectStateToInt(GOState* state) const;
3413
3414 /* A check to verify if this object is available to be saved on the DB when
3415 * a state change occurs
3416 */
3417 [[nodiscard]] bool IsAllowedToSaveToDB() const { return m_saveStateOnDb; };
3418
3419 /* Enable or Disable the ability to save on the database this gameobject's state
3420 * whenever it changes
3421 */
3422 void AllowSaveToDB(bool enable) { m_saveStateOnDb = enable; };
3423
3424 void SaveStateToDB();
3425
3426 std::string GetDebugInfo() const override;
3427
3428 bool IsUpdateNeeded() override;
3429protected:
3430 bool AIM_Initialize();
3432 void UpdateModel(); // updates model in case displayId were changed
3433 bool _respawnCompatibilityMode{true};
3435 time_t m_respawnTime; // (secs) time of next respawn (or despawn if GO have owner()),
3436 uint32 m_respawnDelayTime; // (secs) if 0 then current GO state no dependent from timer
3438 Seconds m_despawnRespawnTime; // override respawn time after delayed despawn
3441 bool m_spawnedByDefault;
3442 uint32 m_cooldownTime; // used as internal reaction delay time store (not state change reaction).
3443 // For traps this: spell casting cooldown, for doors/buttons: reset time.
3444 std::unordered_map<ObjectGuid, int32> m_SkillupList;
3445
3446 ObjectGuid m_ritualOwnerGUID; // used for GAMEOBJECT_TYPE_SUMMONING_RITUAL where GO is not summoned (no owner)
3449
3450 typedef std::map<uint32, ObjectGuid> ChairSlotAndUser;
3452
3455 GameObjectData const* m_goData;
3458
3460 G3D::Quat WorldRotation;
3462
3465 uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable
3467
3469
3471
3472private:
3473 void CheckRitualList();
3474 void ClearRitualList();
3475 void RemoveFromOwner();
3476 void SwitchDoorOrButton(bool activate, bool alternative = false);
3477 void UpdatePackedRotation();
3478
3480 bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool /*is3D*/, bool /*incOwnRadius = true*/, bool /*incTargetRadius = true*/) const override
3481 {
3483 dist2compare += obj->GetObjectSize();
3484 return IsInRange3d(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), dist2compare);
3485 }
3486
3487 bool IsWithinSightRange(Position const& pos, float dist) const override;
3488
3490
3491 bool m_saveStateOnDb = false;
3492};
3493#endif
LocaleConstant
Definition Common.h:125
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:27
LootState
Definition GameObject.h:114
GameObjectActions
Definition GameObject.h:81
std::set< ObjectGuid > GuidSet
Definition ObjectGuid.h:257
Definition Creature.h:47
Definition GameObjectAI.h:33
Definition GameObjectModel.h:55
void GetRespawnPosition(float &x, float &y, float &z, float *ori=nullptr) const
Definition GameObject.cpp:2945
uint32 GetRespawnDelay() const
Definition GameObject.h:204
bool IsWithinDistInMap(Player const *player) const
Definition GameObject.cpp:3109
bool IsRespawnCompatibilityMode() const
Definition GameObject.h:166
void AddLootMode(uint16 lootMode)
Definition GameObject.h:237
~GameObject() override
Definition GameObject.cpp:146
bool IsUpdateNeeded() override
Definition GameObject.cpp:3202
void DeleteFromDB()
Definition GameObject.cpp:1287
std::string GetDebugInfo() const override
Definition GameObject.cpp:3193
bool hasInvolvedQuest(uint32 quest_id) const override
Definition GameObject.cpp:1315
float GetStationaryZ() const override
Definition GameObject.h:352
uint32 GetFaction() const override
Definition GameObject.h:180
uint32 GetDynamicFlags() const override
Definition GameObject.h:136
uint8 getLevelForTarget(WorldObject const *target) const override
Definition GameObject.h:284
float GetStationaryY() const override
Definition GameObject.h:351
void GetFishLoot(Loot *fishLoot, Player *lootOwner, bool junk=false)
Definition GameObject.cpp:1115
bool HasLootMode(uint16 lootMode) const
Definition GameObject.h:235
GameObjectValue const * GetGOValue() const
Definition GameObject.h:144
Player * GetLootRecipient() const
Definition GameObject.cpp:2737
bool IsAlwaysVisibleFor(WorldObject const *seer) const override
Definition GameObject.cpp:1363
time_t GetRespawnTime() const
Definition GameObject.h:190
uint32 GetLootGenerationTime() const
Definition GameObject.h:266
ObjectGuid GetLootRecipientGUID() const
Definition GameObject.h:256
float GetStationaryX() const override
Definition GameObject.h:350
void RemoveLootMode(uint16 lootMode)
Definition GameObject.h:238
void SetSpawnedByDefault(bool b)
Definition GameObject.h:203
bool IsInSkillupList(ObjectGuid const &playerGuid) const
Definition GameObject.cpp:3180
void SetLootRecipient(Creature *creature)
Definition GameObject.cpp:2751
int64 GetPackedWorldRotation() const
Definition GameObject.h:156
void SetDestructibleBuildingModifyState(bool allow)
Definition GameObject.h:311
bool IsMotionTransport() const
Definition GameObject.h:339
bool IsWithinSightRange(Position const &pos, float dist) const override
Definition GameObject.cpp:2335
void Respawn()
Definition GameObject.cpp:1418
void Refresh()
Definition GameObject.cpp:1027
time_t GetRespawnTimeEx() const
Definition GameObject.cpp:3028
bool hasQuest(uint32 quest_id) const override
Definition GameObject.cpp:1304
GameObjectFlags GetGameObjectFlags() const
Definition GameObject.h:222
uint32 GetDisplayId() const
Definition GameObject.h:330
void UpdateModelPosition()
Definition GameObject.cpp:3015
bool IsStaticTransport() const
Definition GameObject.h:338
void SetLootMode(uint16 lootMode)
Definition GameObject.h:236
uint32 GetUseCount() const
Definition GameObject.h:247
void SetWorldRotationAngles(float z_rot, float y_rot, float x_rot)
Definition GameObject.cpp:2360
void SetLootGenerationTime()
Definition GameObject.cpp:3037
ObjectGuid::LowType GetLootRecipientGroupGUID() const
Definition GameObject.h:258
std::map< uint32, ObjectGuid > ChairSlotAndUser
Definition GameObject.h:409
bool IsNeverVisible() const override
Definition GameObject.cpp:1352
virtual bool LoadFromDB(ObjectGuid::LowType guid, Map *map)
Definition GameObject.h:164
std::string const & GetNameForLocaleIdx(LocaleConstant locale_idx) const override
Definition GameObject.cpp:2309
void BuildValuesUpdate(uint8 updateType, ByteBuffer *data, Player *target) override
Definition GameObject.cpp:2845
void AddToSkillupList(ObjectGuid const &playerGuid)
Definition GameObject.cpp:3174
void CleanupsBeforeDelete(bool finalCleanup=true) override
Definition GameObject.cpp:173
uint16 GetLootMode() const
Definition GameObject.h:234
bool IsInvisibleDueToDespawn() const override
Definition GameObject.cpp:1391
void AddToWorld() override
Definition GameObject.cpp:209
void Update(uint32 p_time) override
Definition GameObject.cpp:526
float GetStationaryO() const override
Definition GameObject.h:353
void ModifyHealth(int32 change, Unit *attackerOrHealer=nullptr, uint32 spellId=0)
Definition GameObject.cpp:2382
void AllowSaveToDB(bool enable)
Definition GameObject.h:381
void ReplaceAllDynamicFlags(uint32 flag) override
Definition GameObject.h:137
Definition Object.h:369
Definition Map.h:168
Definition Object.h:421
Definition OutdoorPvP.h:91
uint32 LowType
Definition ObjectGuid.h:125
Definition Object.h:439
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1386
float GetObjectSize() const
Definition Object.cpp:2904
Definition LootMgr.h:313
Definition Position.h:27
Definition TransportMgr.h:88
Definition GameObject.h:50

Referenced by Use().

◆ loot

◆ lootingGroupLowGUID

uint32 GameObject::lootingGroupLowGUID

Referenced by GameObject(), and Update().

◆ m_AI

GameObjectAI* GameObject::m_AI
private

Referenced by AI(), AIM_Initialize(), and ~GameObject().

◆ m_allowModifyDestructibleBuilding

bool GameObject::m_allowModifyDestructibleBuilding
protected

◆ m_cooldownTime

uint32 GameObject::m_cooldownTime
protected

◆ m_despawnDelay

uint32 GameObject::m_despawnDelay
protected

◆ m_despawnRespawnTime

Seconds GameObject::m_despawnRespawnTime
protected

◆ m_goData

◆ m_goInfo

◆ m_goValue

◆ m_groupLootTimer

uint32 GameObject::m_groupLootTimer

Referenced by GameObject(), and Update().

◆ m_linkedTrap

ObjectGuid GameObject::m_linkedTrap
protected

Referenced by GetLinkedTrap(), and SetLinkedTrap().

◆ m_lootGenerationTime

uint32 GameObject::m_lootGenerationTime
protected

◆ m_LootMode

uint16 GameObject::m_LootMode
protected

◆ m_lootRecipient

◆ m_lootRecipientGroup

◆ m_lootState

LootState GameObject::m_lootState
protected

◆ m_model

◆ m_packedRotation

int64 GameObject::m_packedRotation
protected

◆ m_respawnDelayTime

uint32 GameObject::m_respawnDelayTime
protected

◆ m_respawnTime

◆ m_restockTime

Seconds GameObject::m_restockTime
protected

Referenced by GameObject(), SetLootState(), and Update().

◆ m_ritualOwnerGUID

ObjectGuid GameObject::m_ritualOwnerGUID
protected

Referenced by Update(), and Use().

◆ m_saveStateOnDb

bool GameObject::m_saveStateOnDb = false
private

◆ m_SkillupList

std::unordered_map<ObjectGuid, int32> GameObject::m_SkillupList
protected

◆ m_spawnedByDefault

◆ m_spawnId

◆ m_spellId

uint32 GameObject::m_spellId
protected

◆ m_stationaryPosition

◆ m_unique_users

GuidSet GameObject::m_unique_users
protected

◆ m_usetimes

uint32 GameObject::m_usetimes
protected

◆ WorldRotation

G3D::Quat GameObject::WorldRotation
protected

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