TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GameObject Class Reference

#include <GameObject.h>

Public Member Functions

 GameObject ()
 
 ~GameObject ()
 
void BuildValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const override
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void CleanupsBeforeDelete (bool finalCleanup=true) override
 
bool Create (ObjectGuid::LowType guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 artKit=0)
 
void Update (uint32 p_time) override
 
GameObjectTemplate constGetGOInfo () const
 
GameObjectData constGetGOData () const
 
GameObjectValue constGetGOValue () const
 
bool IsTransport () const
 
bool IsDynTransport () const
 
bool IsDestructibleBuilding () const
 
ObjectGuid::LowType GetSpawnId () const
 
void UpdateRotationFields (float rotation2=0.0f, float rotation3=0.0f)
 
std::string constGetNameForLocaleIdx (LocaleConstant locale_idx) const override
 
void SaveToDB ()
 
void SaveToDB (uint32 mapid, uint32 spawnMask, uint32 phaseMask)
 
bool LoadFromDB (ObjectGuid::LowType spawnId, Map *map)
 
bool LoadGameObjectFromDB (ObjectGuid::LowType spawnId, Map *map, bool addToMap=true)
 
void DeleteFromDB ()
 
void SetOwnerGUID (ObjectGuid owner)
 
ObjectGuid GetOwnerGUID () const
 
UnitGetOwner () const
 
void SetSpellId (uint32 id)
 
uint32 GetSpellId () const
 
time_t GetRespawnTime () const
 
time_t GetRespawnTimeEx () const
 
void SetRespawnTime (int32 respawn)
 
void Respawn ()
 
bool isSpawned () const
 
bool isSpawnedByDefault () const
 
void SetSpawnedByDefault (bool b)
 
uint32 GetRespawnDelay () const
 
void Refresh ()
 
void Delete ()
 
void getFishLoot (Loot *loot, Player *loot_owner)
 
void getFishLootJunk (Loot *loot, Player *loot_owner)
 
GameobjectTypes GetGoType () const
 
void SetGoType (GameobjectTypes type)
 
GOState GetGoState () const
 
void SetGoState (GOState state)
 
virtual uint32 GetTransportPeriod () const
 
void SetTransportState (GOState state, uint32 stopFrame=0)
 
uint8 GetGoArtKit () const
 
void SetGoArtKit (uint8 artkit)
 
uint8 GetGoAnimProgress () const
 
void SetGoAnimProgress (uint8 animprogress)
 
bool SetInPhase (uint32 id, bool update, bool apply) override
 
void EnableCollision (bool enable)
 
void Use (Unit *user)
 
LootState getLootState () const
 
void SetLootState (LootState s, Unit *unit=NULL)
 
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 &PlayerGuidLow)
 
bool IsInSkillupList (ObjectGuid const &playerGuid) const
 
void ClearSkillupList ()
 
void AddUniqueUse (Player *player)
 
void AddUse ()
 
uint32 GetUseCount () const
 
uint32 GetUniqueUseCount () const
 
void SaveRespawnTime () override
 
PlayerGetLootRecipient () const
 
GroupGetLootRecipientGroup () const
 
void SetLootRecipient (Unit *unit)
 
bool IsLootAllowedFor (Player const *player) const
 
bool HasLootRecipient () const
 
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=NULL)
 
void ResetDoorOrButton ()
 
void TriggeringLinkedGameObject (uint32 trapEntry, Unit *target)
 
bool IsNeverVisible () const override
 
bool IsAlwaysVisibleFor (WorldObject const *seer) const override
 
bool IsInvisibleDueToDespawn () const override
 
uint8 getLevelForTarget (WorldObject const *target) const override
 
GameObjectLookupFishingHoleAround (float range)
 
void CastSpell (Unit *target, uint32 spell, bool triggered=true)
 
void SendCustomAnim (uint32 anim)
 
bool IsInRange (float x, float y, float z, float radius) const
 
void ModifyHealth (int32 change, Unit *attackerOrHealer=NULL, uint32 spellId=0)
 
void SetDestructibleState (GameObjectDestructibleState state, Player *eventInvoker=NULL, bool setHealth=false)
 
GameObjectDestructibleState GetDestructibleState () const
 
void EventInform (uint32 eventId, WorldObject *invoker=NULL)
 
uint64 GetRotation () const
 
virtual uint32 GetScriptId () const
 
GameObjectAIAI () const
 
std::string GetAIName () const
 
void SetDisplayId (uint32 displayid)
 
uint32 GetDisplayId () const
 
uint32 GetFaction () const
 
void SetFaction (uint32 faction)
 
void GetRespawnPosition (float &x, float &y, float &z, float *ori=NULL) const
 
TransportToTransport ()
 
Transport constToTransport () const
 
float GetStationaryX () const override
 
float GetStationaryY () const override
 
float GetStationaryZ () const override
 
float GetStationaryO () const override
 
void RelocateStationaryPosition (float x, float y, float z, float o)
 
float GetInteractionDistance () const
 
void UpdateModelPosition ()
 
uint16 GetAIAnimKitId () const override
 
void SetAnimKitId (uint16 animKitId, bool oneshot)
 
- Public Member Functions inherited from WorldObject
virtual ~WorldObject ()
 
void GetNearPoint2D (float &x, float &y, float distance, float absAngle) const
 
void GetNearPoint (WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle) const
 
void GetClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float angle=0) const
 
void MovePosition (Position &pos, float dist, float angle)
 
Position GetNearPosition (float dist, float angle)
 
void MovePositionToFirstCollision (Position &pos, float dist, float angle)
 
Position GetFirstCollisionPosition (float dist, float angle)
 
Position GetRandomNearPosition (float radius)
 
void GetContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
float GetObjectSize () const
 
void UpdateGroundPositionZ (float x, float y, float &z) const
 
void UpdateAllowedPositionZ (float x, float y, float &z) 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
 
virtual void SetPhaseMask (uint32 newPhaseMask, bool update)
 
void CopyPhaseFrom (WorldObject *obj, bool update=false)
 
void UpdateAreaPhase ()
 
void ClearPhases (bool update=false)
 
void RebuildTerrainSwaps ()
 
void RebuildWorldMapAreaSwaps ()
 
bool HasInPhaseList (uint32 phase)
 
uint32 GetPhaseMask () const
 
bool IsInPhase (uint32 phase) const
 
bool IsInPhase (WorldObject const *obj) const
 
bool IsInTerrainSwap (uint32 terrainSwap) const
 
std::set< uint32 > constGetPhases () const
 
std::set< uint32 > constGetTerrainSwaps () const
 
std::set< uint32 > constGetWorldMapAreaSwaps () const
 
int32 GetDBPhase () const
 
void SetDBPhase (int32 p)
 
uint32 GetZoneId () const
 
uint32 GetAreaId () const
 
void GetZoneAndAreaId (uint32 &zoneid, uint32 &areaid) const
 
InstanceScriptGetInstanceScript ()
 
std::string constGetName () 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) const
 
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true) const
 
bool IsWithinLOS (float x, float y, float z) const
 
bool IsWithinLOSInMap (WorldObject const *obj) const
 
bool GetDistanceOrder (WorldObject const *obj1, WorldObject const *obj2, bool is3D=true) const
 
bool IsInRange (WorldObject const *obj, float minRange, float maxRange, bool is3D=true) const
 
bool IsInRange2d (float x, float y, float minRange, float maxRange) const
 
bool IsInRange3d (float x, float y, float z, float minRange, float maxRange) const
 
bool isInFront (WorldObject const *target, float arc=float(M_PI)) const
 
bool isInBack (WorldObject const *target, float arc=float(M_PI)) const
 
bool IsInBetween (WorldObject const *obj1, WorldObject const *obj2, float size=0) const
 
virtual void SendMessageToSet (WorldPacket const *data, bool self)
 
virtual void SendMessageToSetInRange (WorldPacket const *data, float dist, bool self)
 
virtual void SendMessageToSet (WorldPacket const *data, Player const *skipped_rcvr)
 
void PlayDistanceSound (uint32 sound_id, Player *target=NULL)
 
void PlayDirectSound (uint32 sound_id, Player *target=NULL)
 
void SendObjectDeSpawnAnim (ObjectGuid guid)
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
float GetSightRange (WorldObject const *target=NULL) const
 
bool CanSeeOrDetect (WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
 
virtual void SetMap (Map *map)
 
virtual void ResetMap ()
 
MapGetMap () const
 
MapFindMap () const
 
Map constGetBaseMap () const
 
void SetZoneScript ()
 
ZoneScriptGetZoneScript () const
 
TempSummonSummonCreature (uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
 
TempSummonSummonCreature (uint32 id, float x, float y, float z, float ang=0, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0) const
 
GameObjectSummonGameObject (uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
 
CreatureSummonTrigger (float x, float y, float z, float ang, uint32 dur, CreatureAI *(*GetAI)(Creature *)=NULL)
 
void SummonCreatureGroup (uint8 group, std::list< TempSummon * > *list=NULL)
 
CreatureFindNearestCreature (uint32 entry, float range, bool alive=true) const
 
GameObjectFindNearestGameObject (uint32 entry, float range) const
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetPlayerListInGrid (std::list< Player * > &lList, float fMaxSearchRange) const
 
void DestroyForNearbyPlayers ()
 
virtual void UpdateObjectVisibility (bool forced=true)
 
void BuildUpdate (UpdateDataMapType &) override
 
void AddToObjectUpdate () override
 
void RemoveFromObjectUpdate () override
 
void AddToNotify (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)
 
void SetWorldObject (bool apply)
 
bool IsPermanentWorldObject () const
 
bool IsWorldObject () const
 
template<class NOTIFIER >
void VisitNearbyObject (float const &radius, NOTIFIER &notifier) const
 
template<class NOTIFIER >
void VisitNearbyGridObject (float const &radius, NOTIFIER &notifier) const
 
template<class NOTIFIER >
void VisitNearbyWorldObject (float const &radius, NOTIFIER &notifier) const
 
TransportGetTransport () const
 
float GetTransOffsetX () const
 
float GetTransOffsetY () const
 
float GetTransOffsetZ () const
 
float GetTransOffsetO () const
 
uint32 GetTransTime () const
 
int8 GetTransSeat () const
 
virtual ObjectGuid GetTransGUID () const
 
void SetTransport (Transport *t)
 
virtual uint16 GetMovementAnimKitId () const
 
virtual uint16 GetMeleeAnimKitId () const
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
ObjectGuid constGetGUID () const
 
PackedGuid constGetPackGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
virtual void SetObjectScale (float scale)
 
TypeID GetTypeId () const
 
bool isType (uint16 mask) const
 
virtual void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target) const
 
void SendUpdateToPlayer (Player *player)
 
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player *target) const
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
virtual void DestroyForPlayer (Player *target) 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 constGetGuidValue (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 SetGuidValue (uint16 index, ObjectGuid const &value)
 
void SetStatFloatValue (uint16 index, float value)
 
void SetStatInt32Value (uint16 index, int32 value)
 
bool AddGuidValue (uint16 index, ObjectGuid const &value)
 
bool RemoveGuidValue (uint16 index, ObjectGuid const &value)
 
void ApplyModUInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModUInt16Value (uint16 index, uint8 offset, int16 val, bool apply)
 
void ApplyModPositiveFloatValue (uint16 index, float val, bool apply)
 
void ApplyModSignedFloatValue (uint16 index, float val, bool apply)
 
void ApplyPercentModFloatValue (uint16 index, float val, bool apply)
 
void SetFlag (uint16 index, uint32 newFlag)
 
void RemoveFlag (uint16 index, uint32 oldFlag)
 
void ToggleFlag (uint16 index, uint32 flag)
 
bool HasFlag (uint16 index, uint32 flag) const
 
void ApplyModFlag (uint16 index, uint32 flag, bool apply)
 
void SetByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void RemoveByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void ToggleByteFlag (uint16 index, uint8 offset, uint8 flag)
 
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)
 
std::vector< uint32 > constGetDynamicValues (uint16 index) const
 
void AddDynamicValue (uint16 index, uint32 value)
 
void RemoveDynamicValue (uint16 index, uint32 value)
 
void ClearDynamicValue (uint16 index)
 
void SetDynamicValue (uint16 index, uint8 offset, uint32 value)
 
void ClearUpdateMask (bool remove)
 
uint16 GetValuesCount () const
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &) const
 
void SetFieldNotifyFlag (uint16 flag)
 
void RemoveFieldNotifyFlag (uint16 flag)
 
void ForceValuesUpdateAtIndex (uint32)
 
PlayerToPlayer ()
 
Player constToPlayer () const
 
CreatureToCreature ()
 
Creature constToCreature () const
 
UnitToUnit ()
 
Unit constToUnit () const
 
GameObjectToGameObject ()
 
GameObject constToGameObject () const
 
CorpseToCorpse ()
 
Corpse constToCorpse () const
 
DynamicObjectToDynObject ()
 
DynamicObject constToDynObject () const
 
AreaTriggerToAreaTrigger ()
 
AreaTrigger constToAreaTrigger () 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 (WorldLocation const &loc)
 
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)
 
WorldLocation GetWorldLocation () const
 
uint32 GetMapId () const
 
- Public Member Functions inherited from Position
 Position (float x=0, float y=0, float z=0, float o=0)
 
 Position (Position const &loc)
 
bool operator== (Position const &a)
 
bool operator!= (Position const &a)
 
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 Relocate (G3D::Vector3 const &pos)
 
void RelocateOffset (Position const &offset)
 
void SetOrientation (float orientation)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
float GetOrientation () const
 
void GetPosition (float &x, float &y) const
 
void GetPosition (float &x, float &y, float &z) const
 
void GetPosition (float &x, float &y, float &z, float &o) const
 
Position GetPosition () const
 
Position::PositionXYStreamer PositionXYStream ()
 
Position::PositionXYZStreamer PositionXYZStream ()
 
Position::PositionXYZOStreamer PositionXYZOStream ()
 
bool IsPositionValid () const
 
float GetExactDist2dSq (float x, float y) const
 
float GetExactDist2d (const float x, const float y) const
 
float GetExactDist2dSq (Position const *pos) const
 
float GetExactDist2d (Position const *pos) const
 
float GetExactDistSq (float x, float y, float z) const
 
float GetExactDist (float x, float y, float z) const
 
float GetExactDistSq (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 GetRelativeAngle (Position const *pos) const
 
float GetRelativeAngle (float x, float y) 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 (const Position &center, float xradius, float yradius, float zradius) const
 
bool HasInArc (float arcangle, Position const *pos, float border=2.0f) const
 
bool HasInLine (Position const *pos, float width) const
 
std::string ToString () const
 
- Public Member Functions inherited from GridObject< GameObject >
virtual ~GridObject ()
 
bool IsInGrid () const
 
void AddToGrid (GridRefManager< GameObject > &m)
 
void RemoveFromGrid ()
 

Static Public Member Functions

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

Public Attributes

Loot loot
 
uint32 m_groupLootTimer
 
ObjectGuid lootingGroupLowGUID
 
GameObjectModelm_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
 
- Public Attributes inherited from WorldLocation
uint32 m_mapId
 
- Public Attributes inherited from Position
float m_positionX
 
float m_positionY
 
float m_positionZ
 

Protected Types

typedef std::map< uint32,
ObjectGuid
ChairSlotAndUser
 

Protected Member Functions

bool AIM_Initialize ()
 
GameObjectModelCreateModel ()
 
void UpdateModel ()
 
- Protected Member Functions inherited from WorldObject
 WorldObject (bool isWorldObject)
 
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 const &guid)
 
std::string _ConcatFields (uint16 startIndex, uint16 size) const
 
void _LoadIntoDataField (std::string const &data, uint32 startOffset, uint32 count)
 
uint32 GetUpdateFieldData (Player const *target, uint32 *&flags) const
 
uint32 GetDynamicUpdateFieldData (Player const *target, uint32 *&flags) const
 
void BuildMovementUpdate (ByteBuffer *data, uint32 flags) const
 
virtual void BuildDynamicValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const
 
void AddToObjectUpdateIfNeeded ()
 
- Protected Member Functions inherited from MapObject
 MapObject ()
 

Protected Attributes

uint32 m_spellId
 
time_t m_respawnTime
 
uint32 m_respawnDelayTime
 
LootState m_lootState
 
ObjectGuid m_lootStateUnitGUID
 
bool m_spawnedByDefault
 
time_t m_cooldownTime
 
GuidSet m_SkillupList
 
ObjectGuid m_ritualOwnerGUID
 
GuidSet m_unique_users
 
uint32 m_usetimes
 
ChairSlotAndUser ChairListSlots
 
ObjectGuid::LowType m_spawnId
 For new or temporary gameobjects is 0 for saved it is lowguid. More...
 
GameObjectTemplate constm_goInfo
 
GameObjectData constm_goData
 
GameObjectValue m_goValue
 
uint64 m_rotation
 
Position m_stationaryPosition
 
ObjectGuid m_lootRecipient
 
ObjectGuid m_lootRecipientGroup
 
uint16 m_LootMode
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
const bool m_isWorldObject
 
ZoneScriptm_zoneScript
 
Transportm_transport
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
TypeID m_objectTypeId
 
uint32 m_updateFlag
 
union {
   int32 *   m_int32Values
 
   uint32 *   m_uint32Values
 
   float *   m_floatValues
 
}; 
 
std::vector< uint32 > * _dynamicValues
 
UpdateMask _changesMask
 
UpdateMask _dynamicChangesMask
 
UpdateMask_dynamicChangesArrayMask
 
uint16 m_valuesCount
 
uint16 _dynamicValuesCount
 
uint16 _fieldNotifyFlags
 
bool m_objectUpdated
 

Private Member Functions

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

Private Attributes

GameObjectAIm_AI
 
uint16 _animKitId
 

Member Typedef Documentation

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

Constructor & Destructor Documentation

GameObject::GameObject ( )
explicit
38  : WorldObject(false), MapObject(),
40 {
43 
45 
48  m_respawnTime = 0;
49  m_respawnDelayTime = 300;
51  m_spawnedByDefault = true;
52  m_usetimes = 0;
53  m_spellId = 0;
54  m_cooldownTime = 0;
55  m_goInfo = NULL;
56  m_goData = NULL;
57 
58  m_spawnId = UI64LIT(0);
59  m_rotation = 0;
60 
61  m_groupLootTimer = 0;
62 
63  ResetLootMode(); // restore default loot mode
64  m_stationaryPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
65 }
LootState m_lootState
Definition: GameObject.h:1096
uint32 m_usetimes
Definition: GameObject.h:1105
Definition: UpdateFields.h:329
uint32 m_respawnDelayTime
Definition: GameObject.h:1095
uint16 _dynamicValuesCount
Definition: Object.h:246
Position m_stationaryPosition
Definition: GameObject.h:1116
Definition: UpdateData.h:46
GameObjectAI * m_AI
Definition: GameObject.h:1132
#define UI64LIT(N)
Definition: Define.h:138
arena_t NULL
Definition: jemalloc_internal.h:624
GameObjectData const * m_goData
Definition: GameObject.h:1112
uint16 m_objectType
Definition: Object.h:227
Definition: UpdateFields.h:335
GameObjectTemplate const * m_goInfo
Definition: GameObject.h:1111
time_t m_cooldownTime
Definition: GameObject.h:1099
time_t m_respawnTime
Definition: GameObject.h:1094
GameObjectModel * m_model
Definition: GameObject.h:1070
Definition: ObjectGuid.h:51
void Relocate(float x, float y)
Definition: Position.h:67
TypeID m_objectTypeId
Definition: Object.h:229
GameObjectValue m_goValue
Definition: GameObject.h:1113
MapObject()
Definition: Object.h:404
Definition: ObjectGuid.h:34
uint32 m_groupLootTimer
Definition: GameObject.h:1014
uint64 m_rotation
Definition: GameObject.h:1115
WorldObject(bool isWorldObject)
Definition: Object.cpp:1445
bool m_spawnedByDefault
Definition: GameObject.h:1098
uint32 m_spellId
Definition: GameObject.h:1093
Definition: GameObject.h:868
uint16 m_valuesCount
Definition: Object.h:245
Definition: UpdateData.h:43
void ResetLootMode()
Definition: GameObject.h:990
ObjectGuid::LowType m_spawnId
For new or temporary gameobjects is 0 for saved it is lowguid.
Definition: GameObject.h:1110
uint16 _animKitId
Definition: GameObject.h:1133
uint32 m_updateFlag
Definition: Object.h:230

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

GameObject::~GameObject ( )
68 {
69  delete m_AI;
70  delete m_model;
73  //if (m_uint32Values) // field array can be not exist if GameOBject not loaded
74  // CleanupsBeforeDelete();
75 }
GameObjectAI * m_AI
Definition: GameObject.h:1132
struct GameObjectValue::@273 Transport
GameObjectTemplate const * m_goInfo
Definition: GameObject.h:1111
GameObjectModel * m_model
Definition: GameObject.h:1070
GameObjectValue m_goValue
Definition: GameObject.h:1113
std::vector< uint32 > * StopFrames
Definition: GameObject.h:782
Definition: SharedDefines.h:2076
uint32 type
Definition: GameObject.h:37

Member Function Documentation

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

1127  {
1129  return IsInRange(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), dist2compare);
1130  }
bool IsInRange(float x, float y, float z, float radius) const
Definition: GameObject.cpp:1887

+ Here is the call graph for this function:

bool GameObject::ActivateToQuest ( Player target) const
1079 {
1080  if (target->HasQuestForGO(GetEntry()))
1081  return true;
1082 
1083  if (!sObjectMgr->IsGameObjectForQuests(GetEntry()))
1084  return false;
1085 
1086  switch (GetGoType())
1087  {
1089  {
1090  GameObject* go = const_cast<GameObject*>(this);
1091  QuestGiverStatus questStatus = target->GetQuestDialogStatus(go);
1092  if (questStatus > DIALOG_STATUS_UNAVAILABLE)
1093  return true;
1094  break;
1095  }
1096  case GAMEOBJECT_TYPE_CHEST:
1097  {
1098  // scan GO chest with loot including quest items
1099  if (LootTemplates_Gameobject.HaveQuestLootForPlayer(GetGOInfo()->GetLootId(), target))
1100  {
1101  if (Battleground const* bg = target->GetBattleground())
1102  return bg->CanActivateGO(GetEntry(), target->GetTeam());
1103  return true;
1104  }
1105  break;
1106  }
1108  {
1109  if (target->GetQuestStatus(GetGOInfo()->generic.questID) == QUEST_STATUS_INCOMPLETE)
1110  return true;
1111  break;
1112  }
1114  {
1115  if (target->GetQuestStatus(GetGOInfo()->goober.questID) == QUEST_STATUS_INCOMPLETE)
1116  return true;
1117  break;
1118  }
1119  default:
1120  break;
1121  }
1122 
1123  return false;
1124 }
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32 questID
Definition: GameObject.h:105
LootStore LootTemplates_Gameobject("gameobject_loot_template","gameobject entry", true)
bool HaveQuestLootForPlayer(uint32 loot_id, Player *player) const
Definition: LootMgr.cpp:208
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:894
Definition: GameObject.h:880
QuestGiverStatus
Definition: QuestDef.h:120
Definition: SharedDefines.h:2067
GameobjectTypes GetGoType() const
Definition: GameObject.h:964
Definition: SharedDefines.h:2075
Definition: QuestDef.h:113
Definition: SharedDefines.h:2068
Definition: Battleground.h:235
uint32 GetEntry() const
Definition: Object.h:107
Definition: QuestDef.h:124
Definition: SharedDefines.h:2070

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void GameObject::AddLootMode ( uint16  lootMode)
inline
988 { m_LootMode |= lootMode; }
uint16 m_LootMode
Definition: GameObject.h:1120
void GameObject::AddToSkillupList ( ObjectGuid const PlayerGuidLow)
inline
992 { m_SkillupList.insert(PlayerGuidLow); }
GuidSet m_SkillupList
Definition: GameObject.h:1101

+ Here is the caller graph for this function:

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

Reimplemented from Object.

126 {
128  if (!IsInWorld())
129  {
130  if (m_zoneScript)
132 
134  if (m_spawnId)
135  GetMap()->GetGameObjectBySpawnIdStore().insert(std::make_pair(m_spawnId, this));
136 
137  // The state can be changed after GameObject::Create but before GameObject::AddToWorld
138  bool toggledState = GetGoType() == GAMEOBJECT_TYPE_CHEST ? getLootState() == GO_READY : (GetGoState() == GO_STATE_READY || IsTransport());
139  if (m_model)
140  {
141  if (Transport* trans = ToTransport())
142  trans->SetDelayedAddModelToMap();
143  else
145  }
146 
147  EnableCollision(toggledState);
149  }
150 }
bool Insert(KEY_TYPE const &handle, SPECIFIC_TYPE *obj)
Definition: TypeContainer.h:119
GOState GetGoState() const
Definition: GameObject.h:966
LootState getLootState() const
Definition: GameObject.h:981
Map * GetMap() const
Definition: Object.h:543
virtual void OnGameObjectCreate(GameObject *)
Definition: ZoneScript.h:38
Definition: Transport.h:28
GameObjectModel * m_model
Definition: GameObject.h:1070
ZoneScript * m_zoneScript
Definition: Object.h:627
Transport * ToTransport()
Definition: GameObject.h:1073
bool IsTransport() const
Definition: GameObject.cpp:979
void EnableCollision(bool enable)
Definition: GameObject.cpp:2203
Definition: GameObject.h:880
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:466
virtual void AddToWorld()
Definition: Object.cpp:142
Definition: GameObject.h:823
ObjectGuid const & GetGUID() const
Definition: Object.h:105
GameobjectTypes GetGoType() const
Definition: GameObject.h:964
GameObjectBySpawnIdContainer & GetGameObjectBySpawnIdStore()
Definition: Map.h:472
Definition: SharedDefines.h:2068
bool IsInWorld() const
Definition: Object.h:100
Definition: GameObject.h:869
void InsertGameObjectModel(const GameObjectModel &model)
Definition: Map.h:506
ObjectGuid::LowType m_spawnId
For new or temporary gameobjects is 0 for saved it is lowguid.
Definition: GameObject.h:1110

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void GameObject::AddUniqueUse ( Player player)
721 {
722  AddUse();
723  m_unique_users.insert(player->GetGUID());
724 }
GuidSet m_unique_users
Definition: GameObject.h:1104
void AddUse()
Definition: GameObject.h:1000

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void GameObject::AddUse ( )
inline
1000 { ++m_usetimes; }
uint32 m_usetimes
Definition: GameObject.h:1105

+ Here is the caller graph for this function:

GameObjectAI* GameObject::AI ( ) const
inline
1061 { return m_AI; }
GameObjectAI * m_AI
Definition: GameObject.h:1132

+ Here is the caller graph for this function:

bool GameObject::AIM_Initialize ( )
protected
78 {
79  delete m_AI;
80 
82 
83  if (!m_AI)
84  return false;
85 
86  m_AI->InitializeAI();
87  return true;
88 }
GameObjectAI * m_AI
Definition: GameObject.h:1132
GameObjectAI * SelectGameObjectAI(GameObject *go)
Definition: CreatureAISelector.cpp:128
virtual void InitializeAI()
Definition: GameObjectAI.h:39

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Reimplemented from Object.

2282 {
2283  if (!target)
2284  return;
2285 
2286  bool isStoppableTransport = GetGoType() == GAMEOBJECT_TYPE_TRANSPORT && !m_goValue.Transport.StopFrames->empty();
2287  bool forcedFlags = GetGoType() == GAMEOBJECT_TYPE_CHEST && GetGOInfo()->chest.usegrouplootrules && HasLootRecipient();
2288  bool targetIsGM = target->IsGameMaster();
2289 
2290  ByteBuffer fieldBuffer;
2291 
2292  UpdateMask updateMask;
2293  updateMask.SetCount(m_valuesCount);
2294 
2296  uint32 visibleFlag = UF_FLAG_PUBLIC;
2297  if (GetOwnerGUID() == target->GetGUID())
2298  visibleFlag |= UF_FLAG_OWNER;
2299 
2300  for (uint16 index = 0; index < m_valuesCount; ++index)
2301  {
2302  if (_fieldNotifyFlags & flags[index] ||
2303  ((updateType == UPDATETYPE_VALUES ? _changesMask.GetBit(index) : m_uint32Values[index]) && (flags[index] & visibleFlag)) ||
2304  (index == GAMEOBJECT_FLAGS && forcedFlags))
2305  {
2306  updateMask.SetBit(index);
2307 
2308  if (index == OBJECT_DYNAMIC_FLAGS)
2309  {
2310  uint16 dynFlags = 0;
2311  int16 pathProgress = -1;
2312  switch (GetGoType())
2313  {
2315  if (ActivateToQuest(target))
2316  dynFlags |= GO_DYNFLAG_LO_ACTIVATE;
2317  break;
2318  case GAMEOBJECT_TYPE_CHEST:
2320  if (ActivateToQuest(target))
2322  else if (targetIsGM)
2323  dynFlags |= GO_DYNFLAG_LO_ACTIVATE;
2324  break;
2326  if (ActivateToQuest(target))
2327  dynFlags |= GO_DYNFLAG_LO_SPARKLE;
2328  break;
2331  {
2332  if (uint32 transportPeriod = GetTransportPeriod())
2333  {
2334  float timer = float(m_goValue.Transport.PathProgress % transportPeriod);
2335  pathProgress = int16(timer / float(transportPeriod) * 65535.0f);
2336  }
2337  break;
2338  }
2339  default:
2340  break;
2341  }
2342 
2343  fieldBuffer << uint16(dynFlags);
2344  fieldBuffer << int16(pathProgress);
2345  }
2346  else if (index == GAMEOBJECT_FLAGS)
2347  {
2350  if (GetGOInfo()->chest.usegrouplootrules && !IsLootAllowedFor(target))
2352 
2353  fieldBuffer << goFlags;
2354  }
2355  else if (index == GAMEOBJECT_LEVEL)
2356  {
2357  if (isStoppableTransport)
2358  fieldBuffer << uint32(m_goValue.Transport.PathProgress);
2359  else
2360  fieldBuffer << m_uint32Values[index];
2361  }
2362  else if (index == GAMEOBJECT_BYTES_1)
2363  {
2364  uint32 bytes1 = m_uint32Values[index];
2365  if (isStoppableTransport && GetGoState() == GO_STATE_TRANSPORT_ACTIVE)
2366  {
2367  if ((m_goValue.Transport.StateUpdateTimer / 20000) & 1)
2368  {
2369  bytes1 &= 0xFFFFFF00;
2370  bytes1 |= GO_STATE_TRANSPORT_STOPPED;
2371  }
2372  }
2373 
2374  fieldBuffer << bytes1;
2375  }
2376  else
2377  fieldBuffer << m_uint32Values[index]; // other cases
2378  }
2379  }
2380 
2381  *data << uint8(updateMask.GetBlockCount());
2382  updateMask.AppendToPacket(data);
2383  data->append(fieldBuffer);
2384 }
Definition: SharedDefines.h:2138
Definition: UpdateMask.h:26
Definition: GameObject.h:825
Definition: ByteBuffer.h:70
UpdateMask _changesMask
Definition: Object.h:241
GOState GetGoState() const
Definition: GameObject.h:966
uint32 * m_uint32Values
Definition: Object.h:235
int16_t int16
Definition: g3dmath.h:165
Definition: SharedDefines.h:2125
uint32 GameObjectUpdateFieldFlags[GAMEOBJECT_END]
Definition: UpdateFieldFlags.cpp:3875
Definition: UpdateFieldFlags.h:27
Definition: GameObject.h:826
uint32 GetBlockCount() const
Definition: UpdateMask.h:64
struct GameObjectValue::@273 Transport
uint32 StateUpdateTimer
Definition: GameObject.h:783
void AppendToPacket(ByteBuffer *data)
Definition: UpdateMask.h:51
uint16_t uint16
Definition: g3dmath.h:166
bool ActivateToQuest(Player *target) const
Definition: GameObject.cpp:1078
Definition: UpdateFields.h:323
Definition: SharedDefines.h:2080
GameObjectValue m_goValue
Definition: GameObject.h:1113
struct GameObjectTemplate::@221::@226 chest
Definition: UpdateFields.h:322
Definition: SharedDefines.h:2122
uint32_t uint32
Definition: Define.h:150
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:894
uint16_t uint16
Definition: Define.h:151
std::vector< uint32 > * StopFrames
Definition: GameObject.h:782
ObjectGuid GetOwnerGUID() const
Definition: GameObject.h:925
void append(T value)
Definition: ByteBuffer.h:143
Definition: UpdateFields.h:319
uint32 usegrouplootrules
Definition: GameObject.h:112
bool HasLootRecipient() const
Definition: GameObject.h:1013
uint8_t uint8
Definition: g3dmath.h:164
bool IsLootAllowedFor(Player const *player) const
Definition: GameObject.cpp:2266
Definition: SharedDefines.h:2067
GameobjectTypes GetGoType() const
Definition: GameObject.h:964
Definition: SharedDefines.h:2075
Definition: UpdateFieldFlags.h:29
void SetCount(uint32 valuesCount)
Definition: UpdateMask.h:67
uint16 m_valuesCount
Definition: Object.h:245
uint32 PathProgress
Definition: GameObject.h:779
Definition: UpdateFields.h:30
Definition: SharedDefines.h:2068
int16_t int16
Definition: Define.h:147
bool GetBit(uint32 index) const
Definition: UpdateMask.h:49
uint32_t uint32
Definition: g3dmath.h:168
uint8 flags
Definition: DisableMgr.cpp:44
Definition: SharedDefines.h:2135
virtual uint32 GetTransportPeriod() const
Definition: GameObject.cpp:2155
Definition: SharedDefines.h:2070
void SetBit(uint32 index)
Definition: UpdateMask.h:47
Definition: SharedDefines.h:2076
Definition: UpdateData.h:30
uint16 _fieldNotifyFlags
Definition: Object.h:248

+ Here is the call graph for this function:

void GameObject::CastSpell ( Unit target,
uint32  spell,
bool  triggered = true 
)
1834 {
1835  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
1836  if (!spellInfo)
1837  return;
1838 
1839  bool self = false;
1840  for (SpellEffectInfo const* effect : spellInfo->GetEffectsForDifficulty(GetMap()->GetDifficultyID()))
1841  {
1842  if (effect && effect->TargetA.GetTarget() == TARGET_UNIT_CASTER)
1843  {
1844  self = true;
1845  break;
1846  }
1847  }
1848 
1849  if (self)
1850  {
1851  if (target)
1852  target->CastSpell(target, spellInfo, triggered);
1853  return;
1854  }
1855 
1856  //summon world trigger
1857  Creature* trigger = SummonTrigger(GetPositionX(), GetPositionY(), GetPositionZ(), 0, spellInfo->CalcCastTime() + 100);
1858  if (!trigger)
1859  return;
1860 
1861  if (Unit* owner = GetOwner())
1862  {
1863  trigger->setFaction(owner->getFaction());
1864  if (owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE))
1866  // needed for GO casts for proper target validation checks
1867  trigger->SetOwnerGUID(owner->GetGUID());
1868  trigger->CastSpell(target ? target : trigger, spellInfo, triggered, nullptr, nullptr, owner->GetGUID());
1869  }
1870  else
1871  {
1872  trigger->setFaction(14);
1873  // Set owner guid for target if no owner available - needed by trigger auras
1874  // - trigger gets despawned and there's no caster avalible (see AuraEffect::TriggerSpell())
1875  trigger->CastSpell(target ? target : trigger, spellInfo, triggered, nullptr, nullptr, target ? target->GetGUID() : ObjectGuid::Empty);
1876  }
1877 }
Unit * GetOwner() const
Definition: GameObject.cpp:1009
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
Map * GetMap() const
Definition: Object.h:543
Definition: SpellInfo.h:326
uint32 CalcCastTime(uint8 level=0, Spell *spell=NULL) const
Definition: SpellInfo.cpp:2504
Definition: Creature.h:467
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
void setFaction(uint32 faction)
Definition: Unit.h:1467
float GetPositionY() const
Definition: Position.h:105
#define sSpellMgr
Definition: SpellMgr.h:756
Definition: SpellInfo.h:238
float GetPositionZ() const
Definition: Position.h:106
void SetOwnerGUID(ObjectGuid owner)
Definition: Unit.cpp:7517
Definition: Unit.h:676
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: UpdateFields.h:109
Creature * SummonTrigger(float x, float y, float z, float ang, uint32 dur, CreatureAI *(*GetAI)(Creature *)=NULL)
Definition: Object.cpp:2404
SpellEffectInfoVector GetEffectsForDifficulty(uint32 difficulty) const
Definition: SpellInfo.cpp:3311
Definition: SharedDefines.h:1875
float GetPositionX() const
Definition: Position.h:104
Definition: Unit.h:1305
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Reimplemented from WorldObject.

Reimplemented in Transport.

99 {
100  WorldObject::CleanupsBeforeDelete(finalCleanup);
101 
102  if (m_uint32Values) // field array can be not exist if GameOBject not loaded
103  RemoveFromOwner();
104 }
uint32 * m_uint32Values
Definition: Object.h:235
virtual void CleanupsBeforeDelete(bool finalCleanup=true)
Definition: Object.cpp:1506
void RemoveFromOwner()
Definition: GameObject.cpp:106

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void GameObject::ClearSkillupList ( )
inline
997 { m_SkillupList.clear(); }
GuidSet m_SkillupList
Definition: GameObject.h:1101
bool GameObject::Create ( ObjectGuid::LowType  guidlow,
uint32  name_id,
Map map,
uint32  phaseMask,
float  x,
float  y,
float  z,
float  ang,
float  rotation0,
float  rotation1,
float  rotation2,
float  rotation3,
uint32  animprogress,
GOState  go_state,
uint32  artKit = 0 
)
174 {
175  ASSERT(map);
176  SetMap(map);
177 
178  Relocate(x, y, z, ang);
180  if (!IsPositionValid())
181  {
182  TC_LOG_ERROR("misc", "Gameobject (GUID: " UI64FMTD " Spawn id: " UI64FMTD " Entry: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow, GetSpawnId(), name_id, x, y);
183  return false;
184  }
185 
186  SetZoneScript();
187  if (m_zoneScript)
188  {
189  name_id = m_zoneScript->GetGameObjectEntry(guidlow, name_id);
190  if (!name_id)
191  return false;
192  }
193 
194  GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(name_id);
195  if (!goinfo)
196  {
197  TC_LOG_ERROR("sql.sql", "Gameobject (GUID: " UI64FMTD " Spawn id: " UI64FMTD " Entry: %u) not created: non-existing entry in `gameobject_template`. Map: %u (X: %f Y: %f Z: %f)", guidlow, GetSpawnId(), name_id, map->GetId(), x, y, z);
198  return false;
199  }
200 
202  {
203  TC_LOG_ERROR("sql.sql", "Gameobject (GUID: " UI64FMTD " Spawn id: " UI64FMTD " Entry: %u) not created: gameobject type GAMEOBJECT_TYPE_MAP_OBJ_TRANSPORT cannot be manually created.", guidlow, GetSpawnId(), name_id);
204  return false;
205  }
206 
207  if (goinfo->type == GAMEOBJECT_TYPE_TRANSPORT)
209 
210  Object::_Create(ObjectGuid::Create<HighGuid::GameObject>(map->GetId(), goinfo->entry, guidlow));
211 
212  m_goInfo = goinfo;
213 
214  if (goinfo->type >= MAX_GAMEOBJECT_TYPE)
215  {
216  TC_LOG_ERROR("sql.sql", "Gameobject (GUID: " UI64FMTD " Spawn id: " UI64FMTD " Entry: %u) not created: non-existing GO type '%u' in `gameobject_template`. It will crash client if created.", guidlow, GetSpawnId(), name_id, goinfo->type);
217  return false;
218  }
219 
222 
223  UpdateRotationFields(rotation2, rotation3); // GAMEOBJECT_FACING, GAMEOBJECT_ROTATION, GAMEOBJECT_PARENTROTATION+2/3
224 
225  SetObjectScale(goinfo->size);
226 
229 
230  SetEntry(goinfo->entry);
231 
232  // set name for logs usage, doesn't affect anything ingame
233  SetName(goinfo->name);
234 
235  SetDisplayId(goinfo->displayId);
236 
237  m_model = CreateModel();
238  // GAMEOBJECT_BYTES_1, index at 0, 1, 2 and 3
239  SetGoType(GameobjectTypes(goinfo->type));
240  SetGoState(go_state);
241  SetGoArtKit(artKit);
242 
243  switch (goinfo->type)
244  {
246  SetGoAnimProgress(animprogress);
247  m_goValue.FishingHole.MaxOpens = urand(GetGOInfo()->fishingHole.minRestock, GetGOInfo()->fishingHole.maxRestock);
248  break;
250  // TODO: Get the values somehow, no longer in gameobject_template
251  m_goValue.Building.Health = 20000/*goinfo->destructibleBuilding.intactNumHits + goinfo->destructibleBuilding.damagedNumHits*/;
253  SetGoAnimProgress(255);
255  break;
257  {
258  m_goValue.Transport.AnimationInfo = sTransportMgr->GetTransportAnimInfo(goinfo->entry);
264  m_goValue.Transport.StopFrames = new std::vector<uint32>();
265  if (goinfo->transport.Timeto2ndfloor > 0)
266  m_goValue.Transport.StopFrames->push_back(goinfo->transport.Timeto2ndfloor);
267  if (goinfo->transport.Timeto3rdfloor > 0)
268  m_goValue.Transport.StopFrames->push_back(goinfo->transport.Timeto3rdfloor);
269  if (goinfo->transport.Timeto4thfloor > 0)
270  m_goValue.Transport.StopFrames->push_back(goinfo->transport.Timeto4thfloor);
271  if (goinfo->transport.Timeto5thfloor > 0)
272  m_goValue.Transport.StopFrames->push_back(goinfo->transport.Timeto5thfloor);
273  if (goinfo->transport.Timeto6thfloor > 0)
274  m_goValue.Transport.StopFrames->push_back(goinfo->transport.Timeto6thfloor);
275  if (goinfo->transport.Timeto7thfloor > 0)
276  m_goValue.Transport.StopFrames->push_back(goinfo->transport.Timeto7thfloor);
277  if (goinfo->transport.Timeto8thfloor > 0)
278  m_goValue.Transport.StopFrames->push_back(goinfo->transport.Timeto8thfloor);
279  if (goinfo->transport.Timeto9thfloor > 0)
280  m_goValue.Transport.StopFrames->push_back(goinfo->transport.Timeto9thfloor);
281  if (goinfo->transport.Timeto10thfloor > 0)
282  m_goValue.Transport.StopFrames->push_back(goinfo->transport.Timeto10thfloor);
283  if (goinfo->transport.startOpen)
285  else
287 
288  SetGoAnimProgress(animprogress);
289  break;
290  }
293  break;
295  if (GetGOInfo()->trap.stealthed)
296  {
299  }
300 
301  if (GetGOInfo()->trap.stealthAffected)
302  {
305  }
306  break;
307  default:
308  SetGoAnimProgress(animprogress);
309  break;
310  }
311 
312  if (GameObjectAddon const* addon = sObjectMgr->GetGameObjectAddon(GetSpawnId()))
313  {
314  if (addon->InvisibilityValue)
315  {
316  m_invisibility.AddFlag(addon->invisibilityType);
317  m_invisibility.AddValue(addon->invisibilityType, addon->InvisibilityValue);
318  }
319  }
320 
322  AIM_Initialize();
323 
324  // Initialize loot duplicate count depending on raid difficulty
325  if (map->Is25ManRaid())
326  loot.maxDuplicates = 3;
327 
328  return true;
329 }
#define MAX_GAMEOBJECT_TYPE
Definition: SharedDefines.h:2116
bool AIM_Initialize()
Definition: GameObject.cpp:77
Definition: GameObject.h:825
Definition: UpdateFields.h:320
void _Create(ObjectGuid const &guid)
Definition: Object.cpp:125
TransportAnimation const * AnimationInfo
Definition: GameObject.h:780
uint32 minRestock
Definition: GameObject.h:101
Definition: GameObject.h:811
Definition: SharedDefines.h:1700
void SetGoType(GameobjectTypes type)
Definition: GameObject.h:965
Position m_stationaryPosition
Definition: GameObject.h:1116
Definition: GameObject.h:826
virtual void SetMap(Map *map)
Definition: Object.cpp:2169
uint32 getMSTime()
Definition: Timer.h:24
Definition: GameObject.h:34
#define sTransportMgr
Definition: TransportMgr.h:162
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
struct GameObjectValue::@273 Transport
bool Is25ManRaid() const
Definition: Map.h:400
void SetTransportState(GOState state, uint32 stopFrame=0)
Definition: GameObject.cpp:2164
struct GameObjectValue::@276 Building
uint32 StateUpdateTimer
Definition: GameObject.h:783
uint32 displayId
Definition: GameObject.h:38
GameObjectModel * CreateModel()
Definition: GameObject.cpp:2475
void SetEntry(uint32 entry)
Definition: Object.h:108
uint32 faction
Definition: GameObject.h:43
ObjectGuid::LowType GetSpawnId() const
Definition: GameObject.h:902
Definition: SharedDefines.h:2082
void SetName(std::string const &newname)
Definition: Object.h:480
float size
Definition: GameObject.h:45
void SetGoAnimProgress(uint8 animprogress)
Definition: GameObject.h:973
#define sObjectMgr
Definition: ObjectMgr.h:1567
GameObjectTemplate const * m_goInfo
Definition: GameObject.h:1111
GameobjectTypes
Definition: SharedDefines.h:2063
uint32 CurrentSeg
Definition: GameObject.h:781
uint32 GetId(void) const
Definition: Map.h:325
struct GameObjectTemplate::@221::@234 transport
void SetDisplayId(uint32 displayid)
Definition: GameObject.cpp:2188
GameObjectModel * m_model
Definition: GameObject.h:1070
void Relocate(float x, float y)
Definition: Position.h:67
uint32 stealthAffected
Definition: GameObject.h:162
uint32 MaxOpens
Definition: GameObject.h:788
ZoneScript * m_zoneScript
Definition: Object.h:627
uint32 maxRestock
Definition: GameObject.h:102
Definition: SharedDefines.h:2080
GameObjectValue m_goValue
Definition: GameObject.h:1113
G3D::int16 z
Definition: Vector3int16.h:46
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
#define UI64FMTD
Definition: Define.h:137
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:894
G3D::int16 y
Definition: Vector2int16.h:38
Loot loot
Definition: GameObject.h:1007
struct GameObjectValue::@274 FishingHole
virtual uint32 GetGameObjectEntry(ObjectGuid::LowType, uint32 entry)
Definition: ZoneScript.h:33
Definition: SharedDefines.h:1690
void AddValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:384
uint32 entry
Definition: GameObject.h:36
std::vector< uint32 > * StopFrames
Definition: GameObject.h:782
uint32 ScriptId
Definition: GameObject.h:625
Definition: UpdateData.h:40
Definition: UpdateFields.h:321
Definition: UpdateFields.h:319
void AddFlag(FLAG_TYPE flag)
Definition: Object.h:379
Definition: SharedDefines.h:2090
struct GameObjectTemplate::@221::@256 destructibleBuilding
void SetGoState(GOState state)
Definition: GameObject.cpp:2137
uint8 maxDuplicates
Definition: LootMgr.h:326
std::string name
Definition: GameObject.h:39
virtual void SetObjectScale(float scale)
Definition: Object.h:111
void SetZoneScript()
Definition: Object.cpp:2330
uint32 Health
Definition: GameObject.h:798
void SetFloatValue(uint16 index, float value)
Definition: Object.cpp:1067
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealth
Definition: Object.h:532
#define ASSERT
Definition: Errors.h:55
uint32 PathProgress
Definition: GameObject.h:779
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibility
Definition: Object.h:535
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
bool IsPositionValid() const
Definition: Position.cpp:40
uint32 flags
Definition: GameObject.h:44
virtual uint32 GetTransportPeriod() const
Definition: GameObject.cpp:2155
void SetGoArtKit(uint8 artkit)
Definition: GameObject.cpp:1196
G3D::int16 x
Definition: Vector2int16.h:37
uint32 stealthed
Definition: GameObject.h:160
Definition: SharedDefines.h:2098
Definition: SharedDefines.h:2076
Definition: SharedDefines.h:2071
uint32 MaxHealth
Definition: GameObject.h:799
uint32 type
Definition: GameObject.h:37
uint32 LastUsedScriptID
Definition: Object.h:599
uint32 m_updateFlag
Definition: Object.h:230
void UpdateRotationFields(float rotation2=0.0f, float rotation3=0.0f)
Definition: GameObject.cpp:1943

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

GameObjectModel * GameObject::CreateModel ( )
protected
2476 {
2477  return GameObjectModel::Create(Trinity::make_unique<GameObjectModelOwnerImpl>(this), sWorld->GetDataPath());
2478 }
static GameObjectModel * Create(std::unique_ptr< GameObjectModelOwnerBase > modelOwner, std::string const &dataPath)
Definition: GameObjectModel.cpp:144
#define sWorld
Definition: World.h:887

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void GameObject::Delete ( )
727 {
729  RemoveFromOwner();
730 
732 
735 
736  uint32 poolid = GetSpawnId() ? sPoolMgr->IsPartOfAPool<GameObject>(GetSpawnId()) : 0;
737  if (poolid)
738  sPoolMgr->UpdatePool<GameObject>(poolid, GetSpawnId());
739  else
741 }
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
ObjectGuid::LowType GetSpawnId() const
Definition: GameObject.h:902
void RemoveFromOwner()
Definition: GameObject.cpp:106
void SetLootState(LootState s, Unit *unit=NULL)
Definition: GameObject.cpp:2112
void SendObjectDeSpawnAnim(ObjectGuid guid)
Definition: Object.cpp:2162
#define sPoolMgr
Definition: PoolMgr.h:166
void AddObjectToRemoveList()
Definition: Object.cpp:2205
uint32_t uint32
Definition: Define.h:150
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:894
Definition: GameObject.h:880
Definition: UpdateFields.h:319
Definition: GameObject.h:823
void SetGoState(GOState state)
Definition: GameObject.cpp:2137
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: GameObject.h:868
uint8 flags
Definition: DisableMgr.cpp:44

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void GameObject::DeleteFromDB ( )
937 {
939  sObjectMgr->DeleteGOData(m_spawnId);
940 
942 
943  stmt->setUInt64(0, m_spawnId);
944 
945  WorldDatabase.Execute(stmt);
946 
948 
949  stmt->setUInt64(0, m_spawnId);
950 
951  WorldDatabase.Execute(stmt);
952 }
Definition: WorldDatabase.h:39
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
Map * GetMap() const
Definition: Object.h:543
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
Definition: WorldDatabase.h:38
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: PreparedStatement.h:74
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
ObjectGuid::LowType m_spawnId
For new or temporary gameobjects is 0 for saved it is lowguid.
Definition: GameObject.h:1110
void RemoveGORespawnTime(ObjectGuid::LowType dbGuid)
Definition: Map.cpp:3619

+ Here is the call graph for this function:

void GameObject::EnableCollision ( bool  enable)
2204 {
2205  if (!m_model)
2206  return;
2207 
2208  /*if (enable && !GetMap()->ContainsGameObjectModel(*m_model))
2209  GetMap()->InsertGameObjectModel(*m_model);*/
2210 
2211  m_model->enable(enable ? GetPhaseMask() : 0);
2212 }
GameObjectModel * m_model
Definition: GameObject.h:1070
uint32 GetPhaseMask() const
Definition: Object.h:461
void enable(uint32 ph_mask)
Definition: GameObjectModel.h:64

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void GameObject::EventInform ( uint32  eventId,
WorldObject invoker = NULL 
)
1914 {
1915  if (!eventId)
1916  return;
1917 
1918  if (AI())
1919  AI()->EventInform(eventId);
1920 
1921  if (GetZoneScript())
1922  GetZoneScript()->ProcessEvent(this, eventId);
1923 
1924  if (BattlegroundMap* bgMap = GetMap()->ToBattlegroundMap())
1925  if (bgMap->GetBG())
1926  bgMap->GetBG()->ProcessEvent(this, eventId, invoker);
1927 }
GameObjectAI * AI() const
Definition: GameObject.h:1061
Map * GetMap() const
Definition: Object.h:543
Definition: Map.h:790
ZoneScript * GetZoneScript() const
Definition: Object.h:551
virtual void EventInform(uint32)
Definition: GameObjectAI.h:63
virtual void ProcessEvent(WorldObject *, uint32)
Definition: ZoneScript.h:54

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint16 GameObject::GetAIAnimKitId ( ) const
inlineoverridevirtual

Reimplemented from WorldObject.

1086 { return _animKitId; }
uint16 _animKitId
Definition: GameObject.h:1133
std::string GameObject::GetAIName ( ) const
91 {
92  if (GameObjectTemplate const* got = sObjectMgr->GetGameObjectTemplate(GetEntry()))
93  return got->AIName;
94 
95  return "";
96 }
Definition: GameObject.h:34
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32 GetEntry() const
Definition: Object.h:107

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

GameObjectDestructibleState GameObject::GetDestructibleState ( ) const
inline
1049  {
1053  return GO_DESTRUCTIBLE_DAMAGED;
1054  return GO_DESTRUCTIBLE_INTACT;
1055  }
Definition: SharedDefines.h:2128
Definition: SharedDefines.h:2145
Definition: SharedDefines.h:2144
Definition: SharedDefines.h:2146
Definition: SharedDefines.h:2129
Definition: UpdateFields.h:319
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.cpp:1239

+ Here is the caller graph for this function:

uint32 GameObject::GetDisplayId ( ) const
inline
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
Definition: UpdateFields.h:318

+ Here is the caller graph for this function:

uint32 GameObject::GetFaction ( ) const
inline
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
Definition: UpdateFields.h:321
void GameObject::getFishLoot ( Loot loot,
Player loot_owner 
)
744 {
745  fishloot->clear();
746 
747  uint32 zone, subzone;
748  uint32 defaultzone = 1;
749  GetZoneAndAreaId(zone, subzone);
750 
751  // if subzone loot exist use it
752  fishloot->FillLoot(subzone, LootTemplates_Fishing, loot_owner, true, true);
753  if (fishloot->empty()) //use this becase if zone or subzone has set LOOT_MODE_JUNK_FISH,Even if no normal drop, fishloot->FillLoot return true. it wrong.
754  {
755  //subzone no result,use zone loot
756  fishloot->FillLoot(zone, LootTemplates_Fishing, loot_owner, true, true);
757  //use zone 1 as default, somewhere fishing got nothing,becase subzone and zone not set, like Off the coast of Storm Peaks.
758  if (fishloot->empty())
759  fishloot->FillLoot(defaultzone, LootTemplates_Fishing, loot_owner, true, true);
760  }
761 }
LootStore LootTemplates_Fishing("fishing_loot_template","area id", true)
uint32_t uint32
Definition: Define.h:150
void GetZoneAndAreaId(uint32 &zoneid, uint32 &areaid) const
Definition: Object.cpp:1535

+ Here is the call graph for this function:

void GameObject::getFishLootJunk ( Loot loot,
Player loot_owner 
)
764 {
765  fishloot->clear();
766 
767  uint32 zone, subzone;
768  uint32 defaultzone = 1;
769  GetZoneAndAreaId(zone, subzone);
770 
771  // if subzone loot exist use it
772  fishloot->FillLoot(subzone, LootTemplates_Fishing, loot_owner, true, true, LOOT_MODE_JUNK_FISH);
773  if (fishloot->empty()) //use this becase if zone or subzone has normal mask drop, then fishloot->FillLoot return true.
774  {
775  //use zone loot
776  fishloot->FillLoot(zone, LootTemplates_Fishing, loot_owner, true, true, LOOT_MODE_JUNK_FISH);
777  if (fishloot->empty())
778  //use zone 1 as default
779  fishloot->FillLoot(defaultzone, LootTemplates_Fishing, loot_owner, true, true, LOOT_MODE_JUNK_FISH);
780  }
781 }
LootStore LootTemplates_Fishing("fishing_loot_template","area id", true)
uint32_t uint32
Definition: Define.h:150
void GetZoneAndAreaId(uint32 &zoneid, uint32 &areaid) const
Definition: Object.cpp:1535
Definition: SharedDefines.h:74

+ Here is the call graph for this function:

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

+ Here is the caller graph for this function:

uint8 GameObject::GetGoArtKit ( ) const
inline
970 { return GetByteValue(GAMEOBJECT_BYTES_1, 2); }
Definition: UpdateFields.h:323
uint8 GetByteValue(uint16 index, uint8 offset) const
Definition: Object.cpp:318

+ Here is the caller graph for this function:

GameObjectData const* GameObject::GetGOData ( ) const
inline
895 { return m_goData; }
GameObjectData const * m_goData
Definition: GameObject.h:1112

+ Here is the caller graph for this function:

GameObjectTemplate const* GameObject::GetGOInfo ( ) const
inline
894 { return m_goInfo; }
GameObjectTemplate const * m_goInfo
Definition: GameObject.h:1111

+ Here is the caller graph for this function:

GOState GameObject::GetGoState ( ) const
inline
966 { return GOState(GetByteValue(GAMEOBJECT_BYTES_1, 0)); }
Definition: UpdateFields.h:323
GOState
Definition: GameObject.h:820
uint8 GetByteValue(uint16 index, uint8 offset) const
Definition: Object.cpp:318

+ Here is the caller graph for this function:

GameobjectTypes GameObject::GetGoType ( ) const
inline
GameobjectTypes
Definition: SharedDefines.h:2063
Definition: UpdateFields.h:323
uint8 GetByteValue(uint16 index, uint8 offset) const
Definition: Object.cpp:318

+ Here is the caller graph for this function:

GameObjectValue const* GameObject::GetGOValue ( ) const
inline
896 { return &m_goValue; }
GameObjectValue m_goValue
Definition: GameObject.h:1113

+ Here is the caller graph for this function:

float GameObject::GetInteractionDistance ( ) const
Todo:
find out how the client calculates the maximal usage distance to spellless working
2409 {
2410  switch (GetGoType())
2411  {
2413  // gameobjects like guildbanks and mailboxes - 10.0 is a just an abitrary choosen number
2416  return 10.0f;
2419  return 20.0f + CONTACT_DISTANCE; // max spell range
2420  default:
2421  return INTERACTION_DISTANCE;
2422  }
2423 }
#define INTERACTION_DISTANCE
Definition: Object.h:34
Definition: SharedDefines.h:2082
Definition: SharedDefines.h:2099
Definition: SharedDefines.h:2084
Definition: SharedDefines.h:2090
GameobjectTypes GetGoType() const
Definition: GameObject.h:964
#define CONTACT_DISTANCE
Definition: Object.h:33

+ Here is the call graph for this function:

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

Reimplemented from WorldObject.

1032  {
1033  if (Unit* owner = GetOwner())
1034  return owner->getLevelForTarget(target);
1035 
1036  return 1;
1037  }
Unit * GetOwner() const
Definition: GameObject.cpp:1009
Definition: Unit.h:1305
uint16 GameObject::GetLootMode ( ) const
inline
985 { return m_LootMode; }
uint16 m_LootMode
Definition: GameObject.h:1120
Player * GameObject::GetLootRecipient ( ) const
2228 {
2229  if (!m_lootRecipient)
2230  return NULL;
2232 }
arena_t NULL
Definition: jemalloc_internal.h:624
ObjectGuid m_lootRecipient
Definition: GameObject.h:1118
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215

+ Here is the call graph for this function:

Group * GameObject::GetLootRecipientGroup ( ) const
2235 {
2236  if (!m_lootRecipientGroup)
2237  return NULL;
2238  return sGroupMgr->GetGroupByGUID(m_lootRecipientGroup);
2239 }
arena_t NULL
Definition: jemalloc_internal.h:624
#define sGroupMgr
Definition: GroupMgr.h:59
ObjectGuid m_lootRecipientGroup
Definition: GameObject.h:1119

+ Here is the caller graph for this function:

LootState GameObject::getLootState ( ) const
inline
981 { return m_lootState; }
LootState m_lootState
Definition: GameObject.h:1096

+ Here is the caller graph for this function:

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

Reimplemented from WorldObject.

1931 {
1932  if (loc_idx != DEFAULT_LOCALE)
1933  {
1934  uint8 uloc_idx = uint8(loc_idx);
1935  if (GameObjectLocale const* cl = sObjectMgr->GetGameObjectLocale(GetEntry()))
1936  if (cl->Name.size() > uloc_idx && !cl->Name[uloc_idx].empty())
1937  return cl->Name[uloc_idx];
1938  }
1939 
1940  return GetName();
1941 }
std::string const & GetName() const
Definition: Object.h:479
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: GameObject.h:803
uint8_t uint8
Definition: g3dmath.h:164
uint8_t uint8
Definition: Define.h:152
uint32 GetEntry() const
Definition: Object.h:107
#define DEFAULT_LOCALE
Definition: Common.h:134

+ Here is the call graph for this function:

Unit * GameObject::GetOwner ( ) const
1010 {
1011  return ObjectAccessor::GetUnit(*this, GetOwnerGUID());
1012 }
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:163
ObjectGuid GetOwnerGUID() const
Definition: GameObject.h:925

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ObjectGuid GameObject::GetOwnerGUID ( ) const
inline
Definition: UpdateFields.h:317
ObjectGuid const & GetGuidValue(uint16 index) const
Definition: Object.cpp:332

+ Here is the caller graph for this function:

uint32 GameObject::GetRespawnDelay ( ) const
inline
959 { return m_respawnDelayTime; }
uint32 m_respawnDelayTime
Definition: GameObject.h:1095

+ Here is the caller graph for this function:

void GameObject::GetRespawnPosition ( float &  x,
float &  y,
float &  z,
float *  ori = NULL 
) const
2387 {
2388  if (m_spawnId)
2389  {
2390  if (GameObjectData const* data = sObjectMgr->GetGOData(GetSpawnId()))
2391  {
2392  x = data->posX;
2393  y = data->posY;
2394  z = data->posZ;
2395  if (ori)
2396  *ori = data->orientation;
2397  return;
2398  }
2399  }
2400 
2401  x = GetPositionX();
2402  y = GetPositionY();
2403  z = GetPositionZ();
2404  if (ori)
2405  *ori = GetOrientation();
2406 }
ObjectGuid::LowType GetSpawnId() const
Definition: GameObject.h:902
#define sObjectMgr
Definition: ObjectMgr.h:1567
float GetOrientation() const
Definition: Position.h:107
float GetPositionY() const
Definition: Position.h:105
G3D::int16 z
Definition: Vector3int16.h:46
float GetPositionZ() const
Definition: Position.h:106
G3D::int16 y
Definition: Vector2int16.h:38
Definition: GameObject.h:833
G3D::int16 x
Definition: Vector2int16.h:37
float GetPositionX() const
Definition: Position.h:104
ObjectGuid::LowType m_spawnId
For new or temporary gameobjects is 0 for saved it is lowguid.
Definition: GameObject.h:1110

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

time_t GameObject::GetRespawnTime ( ) const
inline
935 { return m_respawnTime; }
time_t m_respawnTime
Definition: GameObject.h:1094

+ Here is the caller graph for this function:

time_t GameObject::GetRespawnTimeEx ( ) const
inline
937  {
938  time_t now = time(NULL);
939  if (m_respawnTime > now)
940  return m_respawnTime;
941  else
942  return now;
943  }
arena_t NULL
Definition: jemalloc_internal.h:624
time_t m_respawnTime
Definition: GameObject.h:1094

+ Here is the caller graph for this function:

uint64 GameObject::GetRotation ( ) const
inline
1059 { return m_rotation; }
uint64 m_rotation
Definition: GameObject.h:1115
virtual uint32 GameObject::GetScriptId ( ) const
inlinevirtual
1060 { return GetGOInfo()->ScriptId; }
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:894
uint32 ScriptId
Definition: GameObject.h:625

+ Here is the caller graph for this function:

ObjectGuid::LowType GameObject::GetSpawnId ( ) const
inline
902 { return m_spawnId; }
ObjectGuid::LowType m_spawnId
For new or temporary gameobjects is 0 for saved it is lowguid.
Definition: GameObject.h:1110

+ Here is the caller graph for this function:

uint32 GameObject::GetSpellId ( ) const
inline
933 { return m_spellId;}
uint32 m_spellId
Definition: GameObject.h:1093

+ Here is the caller graph for this function:

float GameObject::GetStationaryO ( ) const
inlineoverridevirtual

Reimplemented from WorldObject.

Position m_stationaryPosition
Definition: GameObject.h:1116
float GetOrientation() const
Definition: Position.h:107
Definition: SharedDefines.h:2080
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:894
float GameObject::GetStationaryX ( ) const
inlineoverridevirtual

Reimplemented from WorldObject.

Position m_stationaryPosition
Definition: GameObject.h:1116
Definition: SharedDefines.h:2080
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:894
float GetPositionX() const
Definition: Position.h:104
float GameObject::GetStationaryY ( ) const
inlineoverridevirtual

Reimplemented from WorldObject.

Position m_stationaryPosition
Definition: GameObject.h:1116
Definition: SharedDefines.h:2080
float GetPositionY() const
Definition: Position.h:105
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:894
float GameObject::GetStationaryZ ( ) const
inlineoverridevirtual

Reimplemented from WorldObject.

Position m_stationaryPosition
Definition: GameObject.h:1116
Definition: SharedDefines.h:2080
float GetPositionZ() const
Definition: Position.h:106
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:894
uint32 GameObject::GetTransportPeriod ( ) const
virtual

Reimplemented in Transport.

2156 {
2160 
2161  return 0;
2162 }
TransportAnimation const * AnimationInfo
Definition: GameObject.h:780
struct GameObjectValue::@273 Transport
GameObjectValue m_goValue
Definition: GameObject.h:1113
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:894
#define ASSERT
Definition: Errors.h:55
Definition: SharedDefines.h:2076
uint32 TotalTime
Definition: TransportMgr.h:92

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 GameObject::GetUniqueUseCount ( ) const
inline
1003 { return uint32(m_unique_users.size()); }
GuidSet m_unique_users
Definition: GameObject.h:1104
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the caller graph for this function:

uint32 GameObject::GetUseCount ( ) const
inline
1002 { return m_usetimes; }
uint32 m_usetimes
Definition: GameObject.h:1105

+ Here is the caller graph for this function:

bool GameObject::hasInvolvedQuest ( uint32  quest_id) const
overridevirtual

Reimplemented from Object.

969 {
970  QuestRelationBounds qir = sObjectMgr->GetGOQuestInvolvedRelationBounds(GetEntry());
971  for (QuestRelations::const_iterator itr = qir.first; itr != qir.second; ++itr)
972  {
973  if (itr->second == quest_id)
974  return true;
975  }
976  return false;
977 }
std::pair< QuestRelations::const_iterator, QuestRelations::const_iterator > QuestRelationBounds
Definition: ObjectMgr.h:442
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32 GetEntry() const
Definition: Object.h:107

+ Here is the call graph for this function:

bool GameObject::HasLootMode ( uint16  lootMode) const
inline
986 { return (m_LootMode & lootMode) != 0; }
uint16 m_LootMode
Definition: GameObject.h:1120
bool GameObject::HasLootRecipient ( ) const
inline
ObjectGuid m_lootRecipientGroup
Definition: GameObject.h:1119
ObjectGuid m_lootRecipient
Definition: GameObject.h:1118
bool IsEmpty() const
Definition: ObjectGuid.h:242

+ Here is the caller graph for this function:

bool GameObject::hasQuest ( uint32  quest_id) const
overridevirtual

Reimplemented from Object.

958 {
959  QuestRelationBounds qr = sObjectMgr->GetGOQuestRelationBounds(GetEntry());
960  for (QuestRelations::const_iterator itr = qr.first; itr != qr.second; ++itr)
961  {
962  if (itr->second == quest_id)
963  return true;
964  }
965  return false;
966 }
std::pair< QuestRelations::const_iterator, QuestRelations::const_iterator > QuestRelationBounds
Definition: ObjectMgr.h:442
#define qr(a_type)
Definition: qr.h:2
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32 GetEntry() const
Definition: Object.h:107

+ Here is the call graph for this function:

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

Reimplemented from WorldObject.

1032 {
1034  return true;
1035 
1037  return true;
1038 
1039  if (!seer)
1040  return false;
1041 
1042  // Always seen by owner and friendly units
1043  if (!GetOwnerGUID().IsEmpty())
1044  {
1045  if (seer->GetGUID() == GetOwnerGUID())
1046  return true;
1047 
1048  Unit* owner = GetOwner();
1049  if (Unit const* unitSeer = seer->ToUnit())
1050  if (owner && owner->IsFriendlyTo(unitSeer))
1051  return true;
1052  }
1053 
1054  return false;
1055 }
Unit * GetOwner() const
Definition: GameObject.cpp:1009
virtual bool IsAlwaysVisibleFor(WorldObject const *) const
Definition: Object.h:639
bool IsDestructibleBuilding() const
Definition: GameObject.cpp:1000
bool IsFriendlyTo(Unit const *unit) const
Definition: Unit.cpp:7170
bool IsTransport() const
Definition: GameObject.cpp:979
ObjectGuid GetOwnerGUID() const
Definition: GameObject.h:925
Definition: Unit.h:1305
Unit * ToUnit()
Definition: Object.h:197

+ Here is the call graph for this function:

bool GameObject::IsDestructibleBuilding ( ) const
1001 {
1002  GameObjectTemplate const* gInfo = GetGOInfo();
1003  if (!gInfo)
1004  return false;
1005 
1007 }
Definition: GameObject.h:34
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:894
Definition: SharedDefines.h:2098
uint32 type
Definition: GameObject.h:37

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool GameObject::IsDynTransport ( ) const
991 {
992  // If something is marked as a transport, don't transmit an out of range packet for it.
993  GameObjectTemplate const* gInfo = GetGOInfo();
994  if (!gInfo)
995  return false;
996 
998 }
Definition: GameObject.h:34
struct GameObjectValue::@273 Transport
Definition: SharedDefines.h:2080
GameObjectValue m_goValue
Definition: GameObject.h:1113
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:894
std::vector< uint32 > * StopFrames
Definition: GameObject.h:782
Definition: SharedDefines.h:2076
uint32 type
Definition: GameObject.h:37

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

1888 {
1890  if (!info)
1891  return IsWithinDist3d(x, y, z, radius);
1892 
1893  float sinA = std::sin(GetOrientation());
1894  float cosA = std::cos(GetOrientation());
1895  float dx = x - GetPositionX();
1896  float dy = y - GetPositionY();
1897  float dz = z - GetPositionZ();
1898  float dist = std::sqrt(dx*dx + dy*dy);
1901  if (G3D::fuzzyEq(dist, 0.0f))
1902  return true;
1903 
1904  float sinB = dx / dist;
1905  float cosB = dy / dist;
1906  dx = dist * (cosA * cosB + sinA * sinB);
1907  dy = dist * (cosA * sinB - sinA * cosB);
1908  return dx < info->GeoBoxMax.X + radius && dx > info->GeoBoxMin.X - radius
1909  && dy < info->GeoBoxMax.Y + radius && dy > info->GeoBoxMin.Y - radius
1910  && dz < info->GeoBoxMax.Z + radius && dz > info->GeoBoxMin.Z - radius;
1911 }
DBCPosition3D GeoBoxMin
Definition: DBCStructure.h:492
float Z
Definition: DBCEnums.h:36
float Y
Definition: DBCEnums.h:35
uint32 displayId
Definition: GameObject.h:38
GameObjectTemplate const * m_goInfo
Definition: GameObject.h:1111
float GetOrientation() const
Definition: Position.h:107
float GetPositionY() const
Definition: Position.h:105
G3D::int16 z
Definition: Vector3int16.h:46
Definition: DBCStructure.h:487
float GetPositionZ() const
Definition: Position.h:106
G3D::int16 y
Definition: Vector2int16.h:38
float X
Definition: DBCEnums.h:34
bool IsWithinDist3d(float x, float y, float z, float dist) const
Definition: Object.cpp:1638
DBCStorage< GameObjectDisplayInfoEntry > sGameObjectDisplayInfoStore(GameObjectDisplayInfofmt)
DBCPosition3D GeoBoxMax
Definition: DBCStructure.h:493
G3D::int16 x
Definition: Vector2int16.h:37
float GetPositionX() const
Definition: Position.h:104
bool fuzzyEq(double a, double b)
Definition: g3dmath.h:857

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool GameObject::IsInSkillupList ( ObjectGuid const playerGuid) const
inline
994  {
995  return m_SkillupList.count(playerGuid) > 0;
996  }
GuidSet m_SkillupList
Definition: GameObject.h:1101

+ Here is the caller graph for this function:

bool GameObject::IsInvisibleDueToDespawn ( ) const
overridevirtual

Reimplemented from WorldObject.

1058 {
1060  return true;
1061 
1062  // Despawned
1063  if (!isSpawned())
1064  return true;
1065 
1066  return false;
1067 }
virtual bool IsInvisibleDueToDespawn() const
Definition: Object.h:640
bool isSpawned() const
Definition: GameObject.h:951

+ Here is the call graph for this function:

bool GameObject::IsLootAllowedFor ( Player const player) const
2267 {
2269  return true;
2270 
2271  if (player->GetGUID() == m_lootRecipient)
2272  return true;
2273 
2274  Group const* playerGroup = player->GetGroup();
2275  if (!playerGroup || playerGroup != GetLootRecipientGroup()) // if we dont have a group we arent the recipient
2276  return false; // if go doesnt have group bound it means it was solo killed by someone else
2277 
2278  return true;
2279 }
Group * GetLootRecipientGroup() const
Definition: GameObject.cpp:2234
ObjectGuid m_lootRecipientGroup
Definition: GameObject.h:1119
ObjectGuid m_lootRecipient
Definition: GameObject.h:1118
Definition: Group.h:191

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool GameObject::IsNeverVisible ( ) const
overridevirtual

Reimplemented from WorldObject.

1021 {
1023  return true;
1024 
1025  if (GetGoType() == GAMEOBJECT_TYPE_SPELL_FOCUS && GetGOInfo()->spellFocus.serverOnly == 1)
1026  return true;
1027 
1028  return false;
1029 }
virtual bool IsNeverVisible() const
Definition: Object.h:638
Definition: SharedDefines.h:2073
uint32 serverOnly
Definition: GameObject.h:140
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:894
GameobjectTypes GetGoType() const
Definition: GameObject.h:964

+ Here is the call graph for this function:

bool GameObject::isSpawned ( ) const
inline
952  {
953  return m_respawnDelayTime == 0 ||
954  (m_respawnTime > 0 && !m_spawnedByDefault) ||
956  }
uint32 m_respawnDelayTime
Definition: GameObject.h:1095
time_t m_respawnTime
Definition: GameObject.h:1094
bool m_spawnedByDefault
Definition: GameObject.h:1098

+ Here is the caller graph for this function:

bool GameObject::isSpawnedByDefault ( ) const
inline
957 { return m_spawnedByDefault; }
bool m_spawnedByDefault
Definition: GameObject.h:1098

+ Here is the caller graph for this function: