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

#include "Map.h"

Inheritance diagram for Map:
GridRefMgr< MapGridType > RefMgr< TO, FROM > LinkedListHead BattlegroundMap InstanceMap MapInstanced TestMap

Classes

struct  RespawnEntry
 

Public Types

enum  EnterState {
  CAN_ENTER = 0 ,
  CANNOT_ENTER_ALREADY_IN_MAP = 1 ,
  CANNOT_ENTER_NO_ENTRY ,
  CANNOT_ENTER_UNINSTANCED_DUNGEON ,
  CANNOT_ENTER_DIFFICULTY_UNAVAILABLE ,
  CANNOT_ENTER_NOT_IN_RAID ,
  CANNOT_ENTER_CORPSE_IN_DIFFERENT_INSTANCE ,
  CANNOT_ENTER_INSTANCE_BIND_MISMATCH ,
  CANNOT_ENTER_TOO_MANY_INSTANCES ,
  CANNOT_ENTER_MAX_PLAYERS ,
  CANNOT_ENTER_ZONE_IN_COMBAT ,
  CANNOT_ENTER_UNSPECIFIED_REASON
}
 
typedef MapRefMgr PlayerList
 
typedef std::unordered_multimap< ObjectGuid::LowType, Creature * > CreatureBySpawnIdContainer
 
typedef std::unordered_multimap< ObjectGuid::LowType, GameObject * > GameObjectBySpawnIdContainer
 
typedef std::vector< WorldObject * > UpdatableObjectList
 
typedef std::unordered_set< WorldObject * > PendingAddUpdatableObjectList
 
- Public Types inherited from GridRefMgr< MapGridType >
typedef LinkedListHead::Iterator< GridReference< MapGridType > > iterator
 
- Public Types inherited from RefMgr< TO, FROM >
typedef LinkedListHead::Iterator< Reference< TO, FROM > > iterator
 
- Public Types inherited from LinkedListHead
typedef Iterator< LinkedListElement > iterator
 

Public Member Functions

 Map (uint32 id, uint32 InstanceId, uint8 SpawnMode, Map *_parent=nullptr)
 
 ~Map () override
 
MapEntry const * GetEntry () const
 
bool CanUnload (uint32 diff)
 
virtual bool AddPlayerToMap (Player *)
 
virtual void RemovePlayerFromMap (Player *, bool)
 
virtual void AfterPlayerUnlinkFromMap ()
 
template<class T >
bool AddToMap (T *, bool checkTransport=false)
 
template<class T >
void RemoveFromMap (T *, bool)
 
void MarkNearbyCellsOf (WorldObject *obj)
 
virtual void Update (const uint32, const uint32, bool thread=true)
 
float GetVisibilityRange () const
 
void SetVisibilityRange (float range)
 
void OnCreateMap ()
 
virtual void InitVisibilityDistance ()
 
void PlayerRelocation (Player *, float x, float y, float z, float o)
 
void CreatureRelocation (Creature *creature, float x, float y, float z, float o)
 
void GameObjectRelocation (GameObject *go, float x, float y, float z, float o)
 
void DynamicObjectRelocation (DynamicObject *go, float x, float y, float z, float o)
 
template<class T , class CONTAINER >
void Visit (Cell const &cell, TypeContainerVisitor< T, CONTAINER > &visitor)
 
bool IsGridLoaded (GridCoord const &gridCoord) const
 
bool IsGridLoaded (float x, float y) const
 
bool IsGridCreated (GridCoord const &gridCoord) const
 
bool IsGridCreated (float x, float y) const
 
void LoadGrid (float x, float y)
 
void LoadAllGrids ()
 
void LoadGridsInRange (Position const &center, float radius)
 
bool UnloadGrid (MapGridType &grid)
 
virtual void UnloadAll ()
 
std::shared_ptr< GridTerrainData > GetGridTerrainDataSharedPtr (GridCoord const &gridCoord)
 
GridTerrainData * GetGridTerrainData (GridCoord const &gridCoord)
 
GridTerrainData * GetGridTerrainData (float x, float y)
 
uint32 GetId () const
 
Map const * GetParent () const
 
void HandleDelayedVisibility ()
 
float GetHeight (float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
 
float GetHeight (Position const &pos, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
 
float GetGridHeight (float x, float y) const
 
float GetMinHeight (float x, float y) const
 
Transport * GetTransportForPos (uint32 phase, float x, float y, float z, WorldObject *worldobject=nullptr)
 
void GetFullTerrainStatusForPosition (uint32 phaseMask, float x, float y, float z, float collisionHeight, PositionFullTerrainStatus &data, Optional< uint8 > reqLiquidType={})
 
LiquidData const GetLiquidData (uint32 phaseMask, float x, float y, float z, float collisionHeight, Optional< uint8 > ReqLiquidType)
 
bool GetAreaInfo (uint32 phaseMask, float x, float y, float z, uint32 &mogpflags, int32 &adtId, int32 &rootId, int32 &groupId) const
 
uint32 GetAreaId (uint32 phaseMask, float x, float y, float z) const
 
uint32 GetZoneId (uint32 phaseMask, float x, float y, float z) const
 
void GetZoneAndAreaId (uint32 phaseMask, uint32 &zoneid, uint32 &areaid, float x, float y, float z) const
 
float GetWaterLevel (float x, float y) const
 
bool IsInWater (uint32 phaseMask, float x, float y, float z, float collisionHeight) const
 
bool IsUnderWater (uint32 phaseMask, float x, float y, float z, float collisionHeight) const
 
bool HasEnoughWater (WorldObject const *searcher, float x, float y, float z) const
 
bool HasEnoughWater (WorldObject const *searcher, LiquidData const &liquidData) const
 
void MoveAllCreaturesInMoveList ()
 
void MoveAllGameObjectsInMoveList ()
 
void MoveAllDynamicObjectsInMoveList ()
 
void RemoveAllObjectsInRemoveList ()
 
virtual void RemoveAllPlayers ()
 
uint32 GetInstanceId () const
 
uint8 GetSpawnMode () const
 
virtual EnterState CannotEnter (Player *, bool)
 
char const * GetMapName () const
 
Difficulty GetDifficulty () const
 
bool IsRegularDifficulty () const
 
MapDifficulty const * GetMapDifficulty () const
 
bool Instanceable () const
 
bool IsDungeon () const
 
bool IsNonRaidDungeon () const
 
bool IsRaid () const
 
bool IsRaidOrHeroicDungeon () const
 
bool IsHeroic () const
 
bool Is25ManRaid () const
 
bool IsBattleground () const
 
bool IsBattleArena () const
 
bool IsBattlegroundOrArena () const
 
bool IsWorldMap () const
 
bool GetEntrancePos (int32 &mapid, float &x, float &y)
 
void AddObjectToRemoveList (WorldObject *obj)
 
virtual void DelayedUpdate (const uint32 diff)
 
void resetMarkedCells ()
 
bool isCellMarked (uint32 pCellId)
 
void markCell (uint32 pCellId)
 
bool HavePlayers () const
 
uint32 GetPlayersCountExceptGMs (bool aliveOnly=false) const
 
void SendToPlayers (WorldPacket const *data) const
 
void StartPlayersRedirectKickTimer ()
 
void StopPlayersRedirectKickTimer ()
 
bool IsPlayerRedirectKickTimerActive ()
 
PlayerList const & GetPlayers () const
 
void ScriptsStart (std::map< uint32, std::multimap< uint32, ScriptInfo > > const &scripts, uint32 id, Object *source, Object *target)
 Put scripts in the execution queue.
 
void ScriptCommandStart (ScriptInfo const &script, uint32 delay, Object *source, Object *target)
 
void UpdateIteratorBack (Player *player)
 
TempSummon * SummonCreature (uint32 entry, Position const &pos, SummonPropertiesEntry const *properties=nullptr, uint32 duration=0, WorldObject *summoner=nullptr, uint32 spellId=0, uint32 vehId=0, 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)
 
GameObject * SummonGameObject (uint32 entry, Position const &pos, float rotation0=0.0f, float rotation1=0.0f, float rotation2=0.0f, float rotation3=0.0f, uint32 respawnTime=100, bool checkTransport=true)
 
void SummonCreatureGroup (uint8 group, std::list< TempSummon * > *list=nullptr)
 
void SummonGameObjectGroup (uint8 group, std::list< GameObject * > *list=nullptr)
 
Corpse * GetCorpse (ObjectGuid const &guid)
 
Creature * GetCreature (ObjectGuid const &guid)
 
GameObject * GetGameObject (ObjectGuid const &guid)
 
Transport * GetTransport (ObjectGuid const &guid)
 
DynamicObject * GetDynamicObject (ObjectGuid const &guid)
 
Pet * GetPet (ObjectGuid const &guid)
 
MapStoredObjectTypesContainer & GetObjectsStore ()
 
CreatureBySpawnIdContainer & GetCreatureBySpawnIdStore ()
 
GameObjectBySpawnIdContainer & GetGameObjectBySpawnIdStore ()
 
std::unordered_set< Corpse * > const * GetCorpsesInGrid (uint32 gridId) const
 
Corpse * GetCorpseByPlayer (ObjectGuid const &ownerGuid) const
 
SpawnedPoolData & GetPoolData ()
 
SpawnedPoolData const & GetPoolData () const
 
MapInstanced * ToMapInstanced ()
 
MapInstanced const * ToMapInstanced () const
 
InstanceMap * ToInstanceMap ()
 
InstanceMap const * ToInstanceMap () const
 
BattlegroundMap * ToBattlegroundMap ()
 
BattlegroundMap const * ToBattlegroundMap () const
 
float GetWaterOrGroundLevel (uint32 phasemask, float x, float y, float z, float *ground=nullptr, bool swim=false, float collisionHeight=DEFAULT_COLLISION_HEIGHT) const
 
float GetHeight (uint32 phasemask, float x, float y, float z, bool vmap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
 
bool isInLineOfSight (float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask, LineOfSightChecks checks, VMAP::ModelIgnoreFlags ignoreFlags) const
 
bool CanReachPositionAndGetValidCoords (WorldObject const *source, PathGenerator *path, float &destX, float &destY, float &destZ, bool failOnCollision=true, bool failOnSlopes=true) const
 Check if a given source can reach a specific point following a path and normalize the coords. Use this method for long paths, otherwise use the overloaded method with the start coords when you need to do a quick check on small segments.
 
bool CanReachPositionAndGetValidCoords (WorldObject const *source, float &destX, float &destY, float &destZ, bool failOnCollision=true, bool failOnSlopes=true) const
 validate the new destination and set reachable coords Check if a given unit can reach a specific point on a segment and set the correct dest coords NOTE: use this method with small segments.
 
bool CanReachPositionAndGetValidCoords (WorldObject const *source, float startX, float startY, float startZ, float &destX, float &destY, float &destZ, bool failOnCollision=true, bool failOnSlopes=true) const
 
bool CheckCollisionAndGetValidCoords (WorldObject const *source, float startX, float startY, float startZ, float &destX, float &destY, float &destZ, bool failOnCollision=true) const
 validate the new destination and set coords Check if a given unit can face collisions in a specific segment
 
void Balance ()
 
void RemoveGameObjectModel (GameObjectModel const &model)
 
void InsertGameObjectModel (GameObjectModel const &model)
 
bool ContainsGameObjectModel (GameObjectModel const &model) const
 
DynamicMapTree const & GetDynamicMapTree () const
 
float GetGameObjectFloor (uint32 phasemask, float x, float y, float z, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
 
time_t GetLinkedRespawnTime (ObjectGuid guid) const
 
time_t GetCreatureRespawnTime (ObjectGuid::LowType dbGuid) const
 
time_t GetGORespawnTime (ObjectGuid::LowType dbGuid) const
 
void SaveCreatureRespawnTime (ObjectGuid::LowType dbGuid, time_t &respawnTime)
 
void RemoveCreatureRespawnTime (ObjectGuid::LowType dbGuid)
 
void SaveGORespawnTime (ObjectGuid::LowType dbGuid, time_t &respawnTime)
 
void RemoveGORespawnTime (ObjectGuid::LowType dbGuid)
 
std::unordered_map< ObjectGuid::LowType, time_t > const & GetCreatureRespawnTimes () const
 
std::unordered_map< ObjectGuid::LowType, time_t > const & GetGORespawnTimes () const
 
void LoadRespawnTimes ()
 
void DeleteRespawnTimes ()
 
time_t GetInstanceResetPeriod () const
 
void UpdatePlayerZoneStats (uint32 oldZone, uint32 newZone)
 
uint32 ApplyDynamicModeRespawnScaling (WorldObject const *obj, uint32 respawnDelay) const
 
bool SpawnGroupSpawn (uint32 groupId, bool ignoreRespawn=false, bool force=false)
 
bool SpawnGroupDespawn (uint32 groupId, bool deleteRespawnTimes=false)
 
bool IsSpawnGroupActive (uint32 groupId) const
 
void ProcessRespawns ()
 
void ProcessCreatureRespawn (ObjectGuid::LowType spawnId)
 
void ProcessGameObjectRespawn (ObjectGuid::LowType spawnId)
 
time_t GetRespawnTime (SpawnObjectType type, ObjectGuid::LowType spawnId) const
 
void RemoveRespawnTime (SpawnObjectType type, ObjectGuid::LowType spawnId)
 
void ScheduleCreatureRespawn (ObjectGuid, Milliseconds, Position pos=Position())
 
void LoadCorpseData ()
 
void DeleteCorpseData ()
 
void AddCorpse (Corpse *corpse)
 
void RemoveCorpse (Corpse *corpse)
 
Corpse * ConvertCorpseToBones (ObjectGuid const &ownerGuid, bool insignia=false)
 
void RemoveOldCorpses ()
 
bool SendZoneMessage (uint32 zone, WorldPacket const *packet, WorldSession const *self=nullptr, TeamId teamId=TEAM_NEUTRAL) const
 Send a packet to all players (or players selected team) in the zone (except self if mentioned)
 
void SendZoneText (uint32 zoneId, char const *text, WorldSession const *self=nullptr, TeamId teamId=TEAM_NEUTRAL) const
 Send a System Message to all players in the zone (except self if mentioned)
 
void SendInitTransports (Player *player)
 
void SendRemoveTransports (Player *player)
 
void SendZoneDynamicInfo (uint32 zoneId, Player *player) const
 
void SendZoneWeather (uint32 zoneId, Player *player) const
 
void SendZoneWeather (ZoneDynamicInfo const &zoneDynamicInfo, Player *player) const
 
void SendInitSelf (Player *player)
 
void UpdateWeather (uint32 const diff)
 
void UpdateExpiredCorpses (uint32 const diff)
 
void PlayDirectSoundToMap (uint32 soundId, uint32 zoneId=0)
 
void SetZoneMusic (uint32 zoneId, uint32 musicId)
 
Weather * GetOrGenerateZoneDefaultWeather (uint32 zoneId)
 
void SetZoneWeather (uint32 zoneId, WeatherState weatherId, float weatherGrade)
 
void SetZoneOverrideLight (uint32 zoneId, uint32 lightId, Milliseconds fadeInTime)
 
void UpdateEncounterState (EncounterCreditType type, uint32 creditEntry, Unit *source)
 
void LogEncounterFinished (EncounterCreditType type, uint32 creditEntry)
 
void DoForAllPlayers (std::function< void(Player *)> exec)
 
void EnsureGridCreated (GridCoord const &gridCoord)
 
bool AllTransportsEmpty () const
 
void AllTransportsRemovePassengers ()
 
TransportsContainer const & GetAllTransports () const
 
template<HighGuid high>
ObjectGuid::LowType GenerateLowGuid ()
 
void AddUpdateObject (Object *obj)
 
void RemoveUpdateObject (Object *obj)
 
size_t GetUpdatableObjectsCount () const
 
virtual std::string GetDebugInfo () const
 
uint32 GetCreatedGridsCount ()
 
uint32 GetLoadedGridsCount ()
 
uint32 GetCreatedCellsInGridCount (uint16 const x, uint16 const y)
 
uint32 GetCreatedCellsInMapCount ()
 
void AddObjectToPendingUpdateList (WorldObject *obj)
 
void RemoveObjectFromMapUpdateList (WorldObject *obj)
 
void AddWorldObjectToFarVisibleMap (WorldObject *obj)
 
void RemoveWorldObjectFromFarVisibleMap (WorldObject *obj)
 
void AddWorldObjectToZoneWideVisibleMap (uint32 zoneId, WorldObject *obj)
 
void RemoveWorldObjectFromZoneWideVisibleMap (uint32 zoneId, WorldObject *obj)
 
ZoneWideVisibleWorldObjectsSet const * GetZoneWideVisibleWorldObjectsForZone (uint32 zoneId) const
 
uint32 GetPlayerCountInZone (uint32 zoneId) const
 
MapCollisionData & GetMapCollisionData ()
 
MapCollisionData const & GetMapCollisionData () const
 
template<>
void AddToGrid (Creature *obj, Cell const &cell)
 
template<>
void AddToGrid (GameObject *obj, Cell const &cell)
 
template<>
void AddToGrid (Player *obj, Cell const &cell)
 
template<>
void AddToGrid (Corpse *obj, Cell const &cell)
 
template<>
void DeleteFromWorld (Player *player)
 
template<>
void InitializeObject (Creature *)
 
template<>
void InitializeObject (GameObject *)
 
template<>
bool AddToMap (Transport *obj, bool)
 
template<>
void RemoveFromMap (Transport *obj, bool remove)
 
- Public Member Functions inherited from GridRefMgr< MapGridType >
GridReference< MapGridType > * getFirst ()
 
GridReference< MapGridType > * getLast ()
 
iterator begin ()
 
iterator end ()
 
iterator rbegin ()
 
iterator rend ()
 
- Public Member Functions inherited from RefMgr< TO, FROM >
 RefMgr ()=default
 
virtual ~RefMgr ()
 
Reference< TO, FROM > * getFirst ()
 
Reference< TO, FROM > const * getFirst () const
 
Reference< TO, FROM > * getLast ()
 
Reference< TO, FROM > const * getLast () const
 
iterator begin ()
 
iterator end ()
 
iterator rbegin ()
 
iterator rend ()
 
void clearReferences ()
 
- Public Member Functions inherited from LinkedListHead
 LinkedListHead ()
 
bool IsEmpty () const
 
LinkedListElement * getFirst ()
 
LinkedListElement const * getFirst () const
 
LinkedListElement * getLast ()
 
LinkedListElement const * getLast () const
 
void insertFirst (LinkedListElement *pElem)
 
void insertLast (LinkedListElement *pElem)
 
uint32 getSize () const
 
void incSize ()
 
void decSize ()
 

Static Public Member Functions

static void DeleteRespawnTimesInDB (uint16 mapId, uint32 instanceId)
 

Public Attributes

std::unordered_set< Unit * > i_objectsForDelayedVisibility
 
CreatureGroupHolderType CreatureGroupHolder
 
EventProcessor Events
 
DataMap CustomData
 

Protected Member Functions

template<class T >
void AddToGrid (T *object, Cell const &cell)
 

Protected Attributes

std::mutex Lock
 
MapGridManager _mapGridManager
 
MapEntry const * i_mapEntry
 
MapCollisionData _mapCollisionData
 
uint8 i_spawnMode
 
uint32 i_InstanceId
 
uint32 m_unloadTimer
 
float m_VisibleDistance
 
time_t _instanceResetPeriod
 
MapRefMgr m_mapRefMgr
 
MapRefMgr::iterator m_mapRefIter
 
TransportsContainer _transports
 
TransportsContainer::iterator _transportsUpdateIter
 

Private Types

typedef std::multimap< time_t, ScriptAction > ScriptScheduleMap
 

Private Member Functions

template<class T >
void InitializeObject (T *obj)
 
void AddCreatureToMoveList (Creature *c)
 
void RemoveCreatureFromMoveList (Creature *c)
 
void AddGameObjectToMoveList (GameObject *go)
 
void RemoveGameObjectFromMoveList (GameObject *go)
 
void AddDynamicObjectToMoveList (DynamicObject *go)
 
void RemoveDynamicObjectFromMoveList (DynamicObject *go)
 
bool EnsureGridLoaded (Cell const &cell)
 
MapGridType * GetMapGrid (uint16 const x, uint16 const y)
 
void ScriptsProcess ()
 Process queued scripts.
 
void SendObjectUpdates ()
 
void UpdatePlayersRedirectKickEvent (uint32 diff)
 
Player * _GetScriptPlayerSourceOrTarget (Object *source, Object *target, ScriptInfo const *scriptInfo) const
 
Creature * _GetScriptCreatureSourceOrTarget (Object *source, Object *target, ScriptInfo const *scriptInfo, bool bReverse=false) const
 
Unit * _GetScriptUnit (Object *obj, bool isSource, ScriptInfo const *scriptInfo) const
 
Player * _GetScriptPlayer (Object *obj, bool isSource, ScriptInfo const *scriptInfo) const
 
Creature * _GetScriptCreature (Object *obj, bool isSource, ScriptInfo const *scriptInfo) const
 
WorldObject * _GetScriptWorldObject (Object *obj, bool isSource, ScriptInfo const *scriptInfo) const
 
void _ScriptProcessDoor (Object *source, Object *target, ScriptInfo const *scriptInfo) const
 
GameObject * _FindGameObject (WorldObject *pWorldObject, ObjectGuid::LowType guid) const
 
template<class T >
void DeleteFromWorld (T *)
 
void UpdateNonPlayerObjects (uint32 const diff)
 
void _AddObjectToUpdateList (WorldObject *obj)
 
void _RemoveObjectFromUpdateList (WorldObject *obj)
 
template<HighGuid high>
ObjectGuidGeneratorBase & GetGuidSequenceGenerator ()
 

Private Attributes

std::vector< Creature * > _creaturesToMove
 
std::vector< GameObject * > _gameObjectsToMove
 
std::vector< DynamicObject * > _dynamicObjectsToMove
 
Map * m_parentMap
 
std::bitset< TOTAL_NUMBER_OF_CELLS_PER_MAP *TOTAL_NUMBER_OF_CELLS_PER_MAP > marked_cells
 
bool i_scriptLock
 
std::unordered_set< WorldObject * > i_objectsToRemove
 
ScriptScheduleMap m_scriptSchedule
 
std::unordered_map< ObjectGuid::LowType, time_t > _creatureRespawnTimes
 
std::unordered_map< ObjectGuid::LowType, time_t > _goRespawnTimes
 
std::set< RespawnEntry > _respawnQueue
 
std::unique_ptr< SpawnedPoolData > _poolData
 
std::unordered_set< uint32 > _toggledSpawnGroupIds
 
uint32 _respawnCheckTimer {0}
 
std::unordered_map< uint32, uint32 > _zonePlayerCountMap
 
ZoneDynamicInfoMap _zoneDynamicInfo
 
IntervalTimer _weatherUpdateTimer
 
uint32 _defaultLight
 
IntervalTimer _corpseUpdateTimer
 
std::map< HighGuid, std::unique_ptr< ObjectGuidGeneratorBase > > _guidGenerators
 
MapStoredObjectTypesContainer _objectsStore
 
CreatureBySpawnIdContainer _creatureBySpawnIdStore
 
GameObjectBySpawnIdContainer _gameobjectBySpawnIdStore
 
std::unordered_map< uint32, std::unordered_set< Corpse * > > _corpsesByGrid
 
std::unordered_map< ObjectGuid, Corpse * > _corpsesByPlayer
 
std::unordered_set< Corpse * > _corpseBones
 
std::unordered_set< Object * > _updateObjects
 
UpdatableObjectList _updatableObjectList
 
PendingAddUpdatableObjectList _pendingAddUpdatableObjectList
 
IntervalTimer _updatableObjectListRecheckTimer
 
ZoneWideVisibleWorldObjectsMap _zoneWideVisibleWorldObjectsMap
 
TimeTrackerSmall _redirectKickTimer
 
TimeTrackerSmall _lastAnnounceRedirectKickTimer
 

Friends

class MapReference
 
class GridObjectLoader
 

Detailed Description

Member Typedef Documentation

◆ CreatureBySpawnIdContainer

typedef std::unordered_multimap<ObjectGuid::LowType, Creature*> Map::CreatureBySpawnIdContainer

◆ GameObjectBySpawnIdContainer

◆ PendingAddUpdatableObjectList

typedef std::unordered_set<WorldObject*> Map::PendingAddUpdatableObjectList

◆ PlayerList

◆ ScriptScheduleMap

typedef std::multimap<time_t, ScriptAction> Map::ScriptScheduleMap
private

◆ UpdatableObjectList

typedef std::vector<WorldObject*> Map::UpdatableObjectList

Member Enumeration Documentation

◆ EnterState

Enumerator
CAN_ENTER 
CANNOT_ENTER_ALREADY_IN_MAP 
CANNOT_ENTER_NO_ENTRY 
CANNOT_ENTER_UNINSTANCED_DUNGEON 
CANNOT_ENTER_DIFFICULTY_UNAVAILABLE 
CANNOT_ENTER_NOT_IN_RAID 
CANNOT_ENTER_CORPSE_IN_DIFFERENT_INSTANCE 
CANNOT_ENTER_INSTANCE_BIND_MISMATCH 
CANNOT_ENTER_TOO_MANY_INSTANCES 
CANNOT_ENTER_MAX_PLAYERS 
CANNOT_ENTER_ZONE_IN_COMBAT 
CANNOT_ENTER_UNSPECIFIED_REASON 
274 {
275 CAN_ENTER = 0,
276 CANNOT_ENTER_ALREADY_IN_MAP = 1, // Player is already in the map
277 CANNOT_ENTER_NO_ENTRY, // No map entry was found for the target map ID
278 CANNOT_ENTER_UNINSTANCED_DUNGEON, // No instance template was found for dungeon map
279 CANNOT_ENTER_DIFFICULTY_UNAVAILABLE, // Requested instance difficulty is not available for target map
280 CANNOT_ENTER_NOT_IN_RAID, // Target instance is a raid instance and the player is not in a raid group
281 CANNOT_ENTER_CORPSE_IN_DIFFERENT_INSTANCE, // Player is dead and their corpse is not in target instance
282 CANNOT_ENTER_INSTANCE_BIND_MISMATCH, // Player's permanent instance save is not compatible with their group's current instance bind
283 CANNOT_ENTER_TOO_MANY_INSTANCES, // Player has entered too many instances recently
284 CANNOT_ENTER_MAX_PLAYERS, // Target map already has the maximum number of players allowed
285 CANNOT_ENTER_ZONE_IN_COMBAT, // A boss encounter is currently in progress on the target map
287 };
@ CANNOT_ENTER_CORPSE_IN_DIFFERENT_INSTANCE
Definition Map.h:281
@ CANNOT_ENTER_TOO_MANY_INSTANCES
Definition Map.h:283
@ CANNOT_ENTER_MAX_PLAYERS
Definition Map.h:284
@ CANNOT_ENTER_ZONE_IN_COMBAT
Definition Map.h:285
@ CAN_ENTER
Definition Map.h:275
@ CANNOT_ENTER_ALREADY_IN_MAP
Definition Map.h:276
@ CANNOT_ENTER_UNSPECIFIED_REASON
Definition Map.h:286
@ CANNOT_ENTER_NO_ENTRY
Definition Map.h:277
@ CANNOT_ENTER_DIFFICULTY_UNAVAILABLE
Definition Map.h:279
@ CANNOT_ENTER_INSTANCE_BIND_MISMATCH
Definition Map.h:282
@ CANNOT_ENTER_UNINSTANCED_DUNGEON
Definition Map.h:278
@ CANNOT_ENTER_NOT_IN_RAID
Definition Map.h:280

Constructor & Destructor Documentation

◆ Map()

Map::Map ( uint32  id,
uint32  InstanceId,
uint8  SpawnMode,
Map *  _parent = nullptr 
)
68 :
69 _mapGridManager(this), i_mapEntry(sMapStore.LookupEntry(id)), _mapCollisionData(*this, _parent),
70 i_spawnMode(SpawnMode), i_InstanceId(InstanceId), m_unloadTimer(0),
73{
74 m_parentMap = (_parent ? _parent : this);
75
76 _zonePlayerCountMap.clear();
78
79 //lets initialize visibility distance for map
81
84
85 _poolData = sPoolMgr->InitPoolsForMap(this);
86}
constexpr auto IN_MILLISECONDS
Definition Common.h:53
constexpr auto MINUTE
Definition Common.h:47
uint32 GetDefaultMapLight(uint32 mapId)
Definition DBCStores.cpp:892
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
#define UPDATABLE_OBJECT_LIST_RECHECK_TIMER
Definition Map.h:96
#define DEFAULT_VISIBILITY_DISTANCE
Definition ObjectDefines.h:39
#define sPoolMgr
Definition PoolMgr.h:216
MapEntry const * i_mapEntry
Definition Map.h:607
uint8 i_spawnMode
Definition Map.h:609
std::unordered_map< uint32, uint32 > _zonePlayerCountMap
Definition Map.h:677
TransportsContainer::iterator _transportsUpdateIter
Definition Map.h:619
uint32 m_unloadTimer
Definition Map.h:611
uint32 _defaultLight
Definition Map.h:681
IntervalTimer _weatherUpdateTimer
Definition Map.h:680
Map * m_parentMap
Definition Map.h:633
IntervalTimer _updatableObjectListRecheckTimer
Definition Map.h:707
MapCollisionData _mapCollisionData
Definition Map.h:608
bool i_scriptLock
Definition Map.h:637
IntervalTimer _corpseUpdateTimer
Definition Map.h:683
time_t _instanceResetPeriod
Definition Map.h:613
float m_VisibleDistance
Definition Map.h:612
MapGridManager _mapGridManager
Definition Map.h:606
virtual void InitVisibilityDistance()
Definition Map.cpp:98
TransportsContainer _transports
Definition Map.h:618
uint32 i_InstanceId
Definition Map.h:610
std::unique_ptr< SpawnedPoolData > _poolData
Definition Map.h:672
void SetInterval(time_t interval)
Definition Timer.h:179

References _corpseUpdateTimer, _poolData, _updatableObjectListRecheckTimer, _weatherUpdateTimer, _zonePlayerCountMap, IN_MILLISECONDS, InitVisibilityDistance(), m_parentMap, MINUTE, IntervalTimer::SetInterval(), sPoolMgr, and UPDATABLE_OBJECT_LIST_RECHECK_TIMER.

◆ ~Map()

Map::~Map ( )
override
55{
56 // UnloadAll must be called before deleting the map
57
58 // Kill all scheduled events without executing them, since the map and its objects are being destroyed.
59 // This prevents events from running on invalid or deleted objects during map destruction.
60 Events.KillAllEvents(false);
61
62 sScriptMgr->OnDestroyMap(this);
63
64 if (!m_scriptSchedule.empty())
65 sScriptMgr->DecreaseScheduledScriptCount(m_scriptSchedule.size());
66}
#define sScriptMgr
Definition ScriptMgr.h:766
Events
Definition alterac_valley.cpp:53
ScriptScheduleMap m_scriptSchedule
Definition Map.h:641

References m_scriptSchedule, and sScriptMgr.

Member Function Documentation

◆ _AddObjectToUpdateList()

void Map::_AddObjectToUpdateList ( WorldObject *  obj)
private
598{
599 UpdatableMapObject* mapUpdatableObject = dynamic_cast<UpdatableMapObject*>(obj);
600 ASSERT(mapUpdatableObject && mapUpdatableObject->GetUpdateState() == UpdatableMapObject::UpdateState::PendingAdd);
601
603 mapUpdatableObject->SetMapUpdateListOffset(_updatableObjectList.size());
604 _updatableObjectList.push_back(obj);
605}
#define ASSERT
Definition Errors.h:68
UpdatableObjectList _updatableObjectList
Definition Map.h:705
Definition Object.h:439
void SetUpdateState(UpdateState state)
Definition Object.h:466
UpdateState GetUpdateState() const
Definition Object.h:471
@ PendingAdd
Definition Object.h:446
@ Updating
Definition Object.h:447
void SetMapUpdateListOffset(std::size_t const offset)
Definition Object.h:454

References _updatableObjectList, ASSERT, UpdatableMapObject::GetUpdateState(), UpdatableMapObject::PendingAdd, UpdatableMapObject::SetMapUpdateListOffset(), UpdatableMapObject::SetUpdateState(), and UpdatableMapObject::Updating.

Referenced by UpdateNonPlayerObjects().

◆ _FindGameObject()

GameObject * Map::_FindGameObject ( WorldObject *  pWorldObject,
ObjectGuid::LowType  guid 
) const
inlineprivate
268{
269 auto bounds = searchObject->GetMap()->GetGameObjectBySpawnIdStore().equal_range(guid);
270 if (bounds.first == bounds.second)
271 return nullptr;
272
273 return bounds.first->second;
274}

References GetGameObjectBySpawnIdStore(), and WorldObject::GetMap().

Referenced by _ScriptProcessDoor(), and ScriptsProcess().

◆ _GetScriptCreature()

Creature * Map::_GetScriptCreature ( Object *  obj,
bool  isSource,
ScriptInfo const *  scriptInfo 
) const
inlineprivate
187{
188 Creature* creature = nullptr;
189 if (!obj)
190 LOG_ERROR("maps.script", "{} {} object is nullptr.", scriptInfo->GetDebugInfo(), isSource ? "source" : "target");
191 else
192 {
193 creature = obj->ToCreature();
194 if (!creature)
195 LOG_ERROR("maps.script", "{} {} object is not a creature ({}).", scriptInfo->GetDebugInfo(),
196 isSource ? "source" : "target", obj->GetGUID().ToString());
197 }
198 return creature;
199}
#define LOG_ERROR(filterType__,...)
Definition Log.h:145
Definition Creature.h:47
Creature * ToCreature()
Definition Object.h:212
std::string ToString(Type &&val, Params &&... params)
Definition StringConvert.h:250

References ScriptInfo::GetDebugInfo(), Object::GetGUID(), LOG_ERROR, Object::ToCreature(), and ObjectGuid::ToString().

Referenced by ScriptsProcess().

◆ _GetScriptCreatureSourceOrTarget()

Creature * Map::_GetScriptCreatureSourceOrTarget ( Object *  source,
Object *  target,
ScriptInfo const *  scriptInfo,
bool  bReverse = false 
) const
inlineprivate
121{
122 Creature* creature = nullptr;
123 if (!source && !target)
124 LOG_ERROR("maps.script", "{} source and target objects are nullptr.", scriptInfo->GetDebugInfo());
125 else
126 {
127 if (bReverse)
128 {
129 // Check target first, then source.
130 if (target)
131 creature = target->ToCreature();
132 if (!creature && source)
133 creature = source->ToCreature();
134 }
135 else
136 {
137 // Check source first, then target.
138 if (source)
139 creature = source->ToCreature();
140 if (!creature && target)
141 creature = target->ToCreature();
142 }
143
144 if (!creature)
145 LOG_ERROR("maps.script", "{} neither source nor target are creatures (source: TypeId: {}, Entry: {}, GUID: {}; target: TypeId: {}, Entry: {}, GUID: {}), skipping.",
146 scriptInfo->GetDebugInfo(),
147 source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUID().ToString() : "",
148 target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUID().ToString() : "");
149 }
150 return creature;
151}
MapEntry const * GetEntry() const
Definition Map.h:175
TypeID GetTypeId() const
Definition Object.h:135

References ScriptInfo::GetDebugInfo(), Object::GetEntry(), Object::GetGUID(), Object::GetTypeId(), LOG_ERROR, Object::ToCreature(), and ObjectGuid::ToString().

Referenced by ScriptsProcess().

◆ _GetScriptPlayer()

Player * Map::_GetScriptPlayer ( Object *  obj,
bool  isSource,
ScriptInfo const *  scriptInfo 
) const
inlineprivate
172{
173 Player* player = nullptr;
174 if (!obj)
175 LOG_ERROR("maps.script", "{} {} object is nullptr.", scriptInfo->GetDebugInfo(), isSource ? "source" : "target");
176 else
177 {
178 player = obj->ToPlayer();
179 if (!player)
180 LOG_ERROR("maps.script", "{} {} object is not a player ({}).",
181 scriptInfo->GetDebugInfo(), isSource ? "source" : "target", obj->GetGUID().ToString());
182 }
183 return player;
184}
Player * ToPlayer()
Definition Object.h:208
Definition Player.h:1086

References ScriptInfo::GetDebugInfo(), Object::GetGUID(), LOG_ERROR, Object::ToPlayer(), and ObjectGuid::ToString().

Referenced by ScriptsProcess().

◆ _GetScriptPlayerSourceOrTarget()

Player * Map::_GetScriptPlayerSourceOrTarget ( Object *  source,
Object *  target,
ScriptInfo const *  scriptInfo 
) const
inlineprivate
99{
100 Player* player = nullptr;
101 if (!source && !target)
102 LOG_ERROR("maps.script", "{} source and target objects are nullptr.", scriptInfo->GetDebugInfo());
103 else
104 {
105 // Check target first, then source.
106 if (target)
107 player = target->ToPlayer();
108 if (!player && source)
109 player = source->ToPlayer();
110
111 if (!player)
112 LOG_ERROR("maps.script", "{} neither source nor target object is player (source: TypeId: {}, Entry: {}, GUID: {}; target: TypeId: {}, Entry: {}, GUID: {}), skipping.",
113 scriptInfo->GetDebugInfo(),
114 source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUID().ToString() : "",
115 target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUID().ToString() : "");
116 }
117 return player;
118}

References ScriptInfo::GetDebugInfo(), Object::GetEntry(), Object::GetGUID(), Object::GetTypeId(), LOG_ERROR, Object::ToPlayer(), and ObjectGuid::ToString().

Referenced by ScriptsProcess().

◆ _GetScriptUnit()

Unit * Map::_GetScriptUnit ( Object *  obj,
bool  isSource,
ScriptInfo const *  scriptInfo 
) const
inlineprivate
154{
155 Unit* unit = nullptr;
156 if (!obj)
157 LOG_ERROR("maps.script", "{} {} object is nullptr.", scriptInfo->GetDebugInfo(), isSource ? "source" : "target");
158 else if (!obj->IsUnit())
159 LOG_ERROR("maps.script", "{} {} object is not unit (TypeId: {}, Entry: {}, GUID: {}), skipping.",
160 scriptInfo->GetDebugInfo(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUID().ToString());
161 else
162 {
163 unit = obj->ToUnit();
164 if (!unit)
165 LOG_ERROR("maps.script", "{} {} object could not be casted to unit.",
166 scriptInfo->GetDebugInfo(), isSource ? "source" : "target");
167 }
168 return unit;
169}
bool IsUnit() const
Definition Object.h:215
Unit * ToUnit()
Definition Object.h:216
Definition Unit.h:665

References ScriptInfo::GetDebugInfo(), Object::GetEntry(), Object::GetGUID(), Object::GetTypeId(), Object::IsUnit(), LOG_ERROR, ObjectGuid::ToString(), and Object::ToUnit().

Referenced by ScriptsProcess().

◆ _GetScriptWorldObject()

WorldObject * Map::_GetScriptWorldObject ( Object *  obj,
bool  isSource,
ScriptInfo const *  scriptInfo 
) const
inlineprivate
202{
203 WorldObject* pWorldObject = nullptr;
204 if (!obj)
205 LOG_ERROR("maps.script", "{} {} object is nullptr.",
206 scriptInfo->GetDebugInfo(), isSource ? "source" : "target");
207 else
208 {
209 pWorldObject = dynamic_cast<WorldObject*>(obj);
210 if (!pWorldObject)
211 LOG_ERROR("maps.script", "{} {} object is not a world object ({}).",
212 scriptInfo->GetDebugInfo(), isSource ? "source" : "target", obj->GetGUID().ToString());
213 }
214 return pWorldObject;
215}
Definition Object.h:482

References ScriptInfo::GetDebugInfo(), Object::GetGUID(), LOG_ERROR, and ObjectGuid::ToString().

Referenced by ScriptsProcess().

◆ _RemoveObjectFromUpdateList()

void Map::_RemoveObjectFromUpdateList ( WorldObject *  obj)
private
609{
610 UpdatableMapObject* mapUpdatableObject = dynamic_cast<UpdatableMapObject*>(obj);
611 ASSERT(mapUpdatableObject && mapUpdatableObject->GetUpdateState() == UpdatableMapObject::UpdateState::Updating);
612
613 if (obj != _updatableObjectList.back())
614 {
615 dynamic_cast<UpdatableMapObject*>(_updatableObjectList.back())->SetMapUpdateListOffset(mapUpdatableObject->GetMapUpdateListOffset());
616 std::swap(_updatableObjectList[mapUpdatableObject->GetMapUpdateListOffset()], _updatableObjectList.back());
617 }
618
619 _updatableObjectList.pop_back();
621}
size_t GetMapUpdateListOffset() const
Definition Object.h:460
@ NotUpdating
Definition Object.h:445

References _updatableObjectList, ASSERT, UpdatableMapObject::GetMapUpdateListOffset(), UpdatableMapObject::GetUpdateState(), UpdatableMapObject::NotUpdating, UpdatableMapObject::SetUpdateState(), and UpdatableMapObject::Updating.

Referenced by RemoveObjectFromMapUpdateList(), and UpdateNonPlayerObjects().

◆ _ScriptProcessDoor()

void Map::_ScriptProcessDoor ( Object *  source,
Object *  target,
ScriptInfo const *  scriptInfo 
) const
inlineprivate
218{
219 bool bOpen = false;
220 ObjectGuid::LowType guid = scriptInfo->ToggleDoor.GOGuid;
221 int32 nTimeToToggle = std::max(15, int32(scriptInfo->ToggleDoor.ResetDelay));
222 switch (scriptInfo->command)
223 {
225 bOpen = true;
226 break;
228 break;
229 default:
230 LOG_ERROR("maps.script", "{} unknown command for _ScriptProcessDoor.", scriptInfo->GetDebugInfo());
231 return;
232 }
233 if (!guid)
234 LOG_ERROR("maps.script", "{} door guid is not specified.", scriptInfo->GetDebugInfo());
235 else if (!source)
236 LOG_ERROR("maps.script", "{} source object is nullptr.", scriptInfo->GetDebugInfo());
237 else if (!source->IsUnit())
238 LOG_ERROR("maps.script", "{} source object is not unit ({}), skipping.", scriptInfo->GetDebugInfo(), source->GetGUID().ToString());
239 else
240 {
241 WorldObject* wSource = dynamic_cast <WorldObject*> (source);
242 if (!wSource)
243 LOG_ERROR("maps.script", "{} source object could not be casted to world object ({}), skipping.", scriptInfo->GetDebugInfo(), source->GetGUID().ToString());
244 else
245 {
246 GameObject* pDoor = _FindGameObject(wSource, guid);
247 if (!pDoor)
248 LOG_ERROR("maps.script", "{} gameobject was not found (guid: {}).", scriptInfo->GetDebugInfo(), guid);
249 else if (pDoor->GetGoType() != GAMEOBJECT_TYPE_DOOR)
250 LOG_ERROR("maps.script", "{} gameobject is not a door ({}).",
251 scriptInfo->GetDebugInfo(), pDoor->GetGUID().ToString());
252 else if (bOpen == (pDoor->GetGoState() == GO_STATE_READY))
253 {
254 pDoor->UseDoorOrButton(nTimeToToggle);
255
256 if (target && target->isType(TYPEMASK_GAMEOBJECT))
257 {
258 GameObject* goTarget = target->ToGameObject();
259 if (goTarget && goTarget->GetGoType() == GAMEOBJECT_TYPE_BUTTON)
260 goTarget->UseDoorOrButton(nTimeToToggle);
261 }
262 }
263 }
264 }
265}
std::int32_t int32
Definition Define.h:103
@ GO_STATE_READY
Definition GameObjectData.h:709
@ TYPEMASK_GAMEOBJECT
Definition ObjectGuid.h:54
@ SCRIPT_COMMAND_CLOSE_DOOR
Definition ObjectMgr.h:107
@ SCRIPT_COMMAND_OPEN_DOOR
Definition ObjectMgr.h:106
@ GAMEOBJECT_TYPE_BUTTON
Definition SharedDefines.h:1565
@ GAMEOBJECT_TYPE_DOOR
Definition SharedDefines.h:1564
Definition GameObject.h:120
void UseDoorOrButton(uint32 time_to_restore=0, bool alternative=false, Unit *user=nullptr)
Definition GameObject.cpp:1429
GOState GetGoState() const
Definition GameObject.h:206
GameobjectTypes GetGoType() const
Definition GameObject.h:204
GameObject * _FindGameObject(WorldObject *pWorldObject, ObjectGuid::LowType guid) const
Definition MapScripts.cpp:267
std::string ToString() const
Definition ObjectGuid.cpp:48
uint32 LowType
Definition ObjectGuid.h:125
bool isType(uint16 mask) const
Definition Object.h:136
GameObject * ToGameObject()
Definition Object.h:220
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:120

References _FindGameObject(), ScriptInfo::command, GAMEOBJECT_TYPE_BUTTON, GAMEOBJECT_TYPE_DOOR, ScriptInfo::GetDebugInfo(), GameObject::GetGoState(), GameObject::GetGoType(), Object::GetGUID(), GO_STATE_READY, ScriptInfo::GOGuid, Object::isType(), Object::IsUnit(), LOG_ERROR, ScriptInfo::ResetDelay, SCRIPT_COMMAND_CLOSE_DOOR, SCRIPT_COMMAND_OPEN_DOOR, Object::ToGameObject(), ScriptInfo::ToggleDoor, ObjectGuid::ToString(), TYPEMASK_GAMEOBJECT, and GameObject::UseDoorOrButton().

Referenced by ScriptsProcess().

◆ AddCorpse()

void Map::AddCorpse ( Corpse *  corpse)
3073{
3074 corpse->SetMap(this);
3075
3076 GridCoord const gridCoord = Acore::ComputeGridCoord(corpse->GetPositionX(), corpse->GetPositionY());
3077 _corpsesByGrid[gridCoord.GetId()].insert(corpse);
3078 if (corpse->GetType() != CORPSE_BONES)
3079 _corpsesByPlayer[corpse->GetOwnerGUID()] = corpse;
3080 else
3081 _corpseBones.insert(corpse);
3082}
@ CORPSE_BONES
Definition Corpse.h:28
ObjectGuid GetOwnerGUID() const override
Definition Corpse.h:69
CorpseType GetType() const
Definition Corpse.h:73
std::unordered_map< ObjectGuid, Corpse * > _corpsesByPlayer
Definition Map.h:700
std::unordered_set< Corpse * > _corpseBones
Definition Map.h:701
std::unordered_map< uint32, std::unordered_set< Corpse * > > _corpsesByGrid
Definition Map.h:699
virtual void SetMap(Map *map)
Definition Object.cpp:2196
GridCoord ComputeGridCoord(float x, float y)
Definition GridDefines.h:185
Definition GridDefines.h:88
uint32 GetId() const
Definition GridDefines.h:150
float GetPositionX() const
Definition Position.h:121
float GetPositionY() const
Definition Position.h:122

References _corpseBones, _corpsesByGrid, _corpsesByPlayer, Acore::ComputeGridCoord(), CORPSE_BONES, CoordPair< LIMIT >::GetId(), Corpse::GetOwnerGUID(), Position::GetPositionX(), Position::GetPositionY(), Corpse::GetType(), and WorldObject::SetMap().

Referenced by ConvertCorpseToBones(), Player::CreateCorpse(), and LoadCorpseData().

◆ AddCreatureToMoveList()

void Map::AddCreatureToMoveList ( Creature *  c)
private
912{
914 _creaturesToMove.push_back(c);
916}
@ MAP_OBJECT_CELL_MOVE_ACTIVE
Definition Object.h:416
@ MAP_OBJECT_CELL_MOVE_NONE
Definition Object.h:415
std::vector< Creature * > _creaturesToMove
Definition Map.h:586
MapObjectCellMoveState _moveState
Definition Object.h:435

References _creaturesToMove, MovableMapObject::_moveState, MAP_OBJECT_CELL_MOVE_ACTIVE, and MAP_OBJECT_CELL_MOVE_NONE.

Referenced by CreatureRelocation().

◆ AddDynamicObjectToMoveList()

void Map::AddDynamicObjectToMoveList ( DynamicObject *  go)
private
938{
939 if (dynObj->_moveState == MAP_OBJECT_CELL_MOVE_NONE)
940 _dynamicObjectsToMove.push_back(dynObj);
941 dynObj->_moveState = MAP_OBJECT_CELL_MOVE_ACTIVE;
942}
std::vector< DynamicObject * > _dynamicObjectsToMove
Definition Map.h:588

References _dynamicObjectsToMove, MovableMapObject::_moveState, MAP_OBJECT_CELL_MOVE_ACTIVE, and MAP_OBJECT_CELL_MOVE_NONE.

Referenced by DynamicObjectRelocation().

◆ AddGameObjectToMoveList()

void Map::AddGameObjectToMoveList ( GameObject *  go)
private
925{
927 _gameObjectsToMove.push_back(go);
929}
std::vector< GameObject * > _gameObjectsToMove
Definition Map.h:587

References _gameObjectsToMove, MovableMapObject::_moveState, MAP_OBJECT_CELL_MOVE_ACTIVE, and MAP_OBJECT_CELL_MOVE_NONE.

Referenced by GameObjectRelocation().

◆ AddObjectToPendingUpdateList()

void Map::AddObjectToPendingUpdateList ( WorldObject *  obj)
584{
585 if (!obj->CanBeAddedToMapUpdateList())
586 return;
587
588 UpdatableMapObject* mapUpdatableObject = dynamic_cast<UpdatableMapObject*>(obj);
589 if (!mapUpdatableObject || mapUpdatableObject->GetUpdateState() != UpdatableMapObject::UpdateState::NotUpdating)
590 return;
591
594}
PendingAddUpdatableObjectList _pendingAddUpdatableObjectList
Definition Map.h:706
bool CanBeAddedToMapUpdateList()
Definition Object.cpp:3255

References _pendingAddUpdatableObjectList, WorldObject::CanBeAddedToMapUpdateList(), UpdatableMapObject::GetUpdateState(), UpdatableMapObject::NotUpdating, UpdatableMapObject::PendingAdd, and UpdatableMapObject::SetUpdateState().

Referenced by WorldObject::AddToWorld(), WorldObject::setActive(), and Player::UpdateVisibilityOf().

◆ AddObjectToRemoveList()

void Map::AddObjectToRemoveList ( WorldObject *  obj)
1824{
1825 ASSERT(obj->GetMapId() == GetId() && obj->GetInstanceId() == GetInstanceId());
1826
1827 obj->CleanupsBeforeDelete(false); // remove or simplify at least cross referenced links
1828
1829 i_objectsToRemove.insert(obj);
1830 //LOG_DEBUG("maps", "Object ({}) added to removing list.", obj->GetGUID().ToString());
1831}
std::unordered_set< WorldObject * > i_objectsToRemove
Definition Map.h:638
uint32 GetId() const
Definition Map.h:234
uint32 GetInstanceId() const
Definition Map.h:270
uint32 GetMapId() const
Definition Position.h:281
uint32 GetInstanceId() const
Definition Object.h:520
virtual void CleanupsBeforeDelete(bool finalCleanup=true)
Definition Object.cpp:1165

References ASSERT, WorldObject::CleanupsBeforeDelete(), GetId(), WorldObject::GetInstanceId(), GetInstanceId(), WorldLocation::GetMapId(), and i_objectsToRemove.

Referenced by WorldObject::AddObjectToRemoveList(), and wp_commandscript::HandleWpModifyCommand().

◆ AddPlayerToMap()

bool Map::AddPlayerToMap ( Player *  player)
virtual

Reimplemented in InstanceMap, and BattlegroundMap.

259{
260 CellCoord cellCoord = Acore::ComputeCellCoord(player->GetPositionX(), player->GetPositionY());
261 if (!cellCoord.IsCoordValid())
262 {
263 LOG_ERROR("maps", "Map::Add: Player ({}) has invalid coordinates X:{} Y:{} grid cell [{}:{}]",
264 player->GetGUID().ToString(), player->GetPositionX(), player->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
265 return false;
266 }
267
268 Cell cell(cellCoord);
270 AddToGrid(player, cell);
271
272 // Check if we are adding to correct map
273 ASSERT (player->GetMap() == this);
274 player->SetMap(this);
275 player->AddToWorld();
276
277 SendInitTransports(player);
278 SendInitSelf(player);
279
280 player->UpdateObjectVisibility(false);
281
282 if (player->IsAlive())
283 ConvertCorpseToBones(player->GetGUID());
284
285 sScriptMgr->OnPlayerEnterMap(this, player);
286 return true;
287}
#define MAX_VISIBILITY_DISTANCE
Definition ObjectDefines.h:30
void LoadGridsInRange(Position const &center, float radius)
Definition Map.cpp:228
Corpse * ConvertCorpseToBones(ObjectGuid const &ownerGuid, bool insignia=false)
Definition Map.cpp:3105
void SendInitSelf(Player *player)
Definition Map.cpp:1646
void AddToGrid(T *object, Cell const &cell)
Definition Map.cpp:116
void SendInitTransports(Player *player)
Definition Map.cpp:1692
void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false) override
Definition PlayerUpdates.cpp:1645
void AddToWorld() override
Definition Player.cpp:1746
void SetMap(Map *map) override
Definition Player.cpp:15111
bool IsAlive() const
Definition Unit.h:1796
Map * GetMap() const
Definition Object.h:637
CellCoord ComputeCellCoord(float x, float y)
Definition GridDefines.h:197
Definition Cell.h:45
bool IsCoordValid() const
Definition GridDefines.h:138
uint32 x_coord
Definition GridDefines.h:155
uint32 y_coord
Definition GridDefines.h:156

References AddToGrid(), Player::AddToWorld(), ASSERT, Acore::ComputeCellCoord(), ConvertCorpseToBones(), Object::GetGUID(), WorldObject::GetMap(), Position::GetPositionX(), Position::GetPositionY(), Unit::IsAlive(), CoordPair< LIMIT >::IsCoordValid(), LoadGridsInRange(), LOG_ERROR, MAX_VISIBILITY_DISTANCE, SendInitSelf(), SendInitTransports(), Player::SetMap(), sScriptMgr, ObjectGuid::ToString(), Player::UpdateObjectVisibility(), CoordPair< LIMIT >::x_coord, and CoordPair< LIMIT >::y_coord.

Referenced by InstanceMap::AddPlayerToMap(), BattlegroundMap::AddPlayerToMap(), and WorldSession::HandlePlayerLoginFromDB().

◆ AddToGrid() [1/5]

template<>
void Map::AddToGrid ( Corpse *  obj,
Cell const &  cell 
)
155{
156 MapGridType* grid = GetMapGrid(cell.GridX(), cell.GridY());
157 // Corpses are a special object type - they can be added to grid via a call to AddToMap
158 // or loaded through ObjectGridLoader.
159 // Both corpses loaded from database and these freshly generated by Player::CreateCoprse are added to _corpsesByCell
160 // ObjectGridLoader loads all corpses from _corpsesByCell even if they were already added to grid before it was loaded
161 // so we need to explicitly check it here (Map::AddToGrid is only called from Player::BuildPlayerRepop, not from ObjectGridLoader)
162 // to avoid failing an assertion in GridObject::AddToGrid
163 if (grid->IsObjectDataLoaded())
164 grid->AddGridObject(cell.CellX(), cell.CellY(), obj);
165}
Definition MapGrid.h:33
void AddGridObject(uint16 const x, uint16 const y, SPECIFIC_OBJECT *obj)
Definition MapGrid.h:49
bool IsObjectDataLoaded() const
Definition MapGrid.h:46
MapGridType * GetMapGrid(uint16 const x, uint16 const y)
Definition Map.cpp:201

References MapGrid< GRID_OBJECT_TYPES, FAR_VISIBLE_OBJECT_TYPES >::AddGridObject(), Cell::CellX(), Cell::CellY(), GetMapGrid(), Cell::GridX(), Cell::GridY(), and MapGrid< GRID_OBJECT_TYPES, FAR_VISIBLE_OBJECT_TYPES >::IsObjectDataLoaded().

◆ AddToGrid() [2/5]

template<>
void Map::AddToGrid ( Creature *  obj,
Cell const &  cell 
)
126{
127 MapGridType* grid = GetMapGrid(cell.GridX(), cell.GridY());
128 grid->AddGridObject(cell.CellX(), cell.CellY(), obj);
129 if (obj->IsFarVisible())
130 grid->AddFarVisibleObject(cell.CellX(), cell.CellY(), obj);
131
132 obj->SetCurrentCell(cell);
133}
void AddFarVisibleObject(uint16 const x, uint16 const y, SPECIFIC_OBJECT *obj)
Definition MapGrid.h:59
void SetCurrentCell(Cell const &cell)
Definition Object.h:432
bool IsFarVisible() const
Definition Object.h:689

References MapGrid< GRID_OBJECT_TYPES, FAR_VISIBLE_OBJECT_TYPES >::AddFarVisibleObject(), MapGrid< GRID_OBJECT_TYPES, FAR_VISIBLE_OBJECT_TYPES >::AddGridObject(), Cell::CellX(), Cell::CellY(), GetMapGrid(), Cell::GridX(), Cell::GridY(), WorldObject::IsFarVisible(), and MovableMapObject::SetCurrentCell().

◆ AddToGrid() [3/5]

template<>
void Map::AddToGrid ( GameObject *  obj,
Cell const &  cell 
)

◆ AddToGrid() [4/5]

template<>
void Map::AddToGrid ( Player *  obj,
Cell const &  cell 
)
148{
149 MapGridType* grid = GetMapGrid(cell.GridX(), cell.GridY());
150 grid->AddGridObject(cell.CellX(), cell.CellY(), obj);
151}

References MapGrid< GRID_OBJECT_TYPES, FAR_VISIBLE_OBJECT_TYPES >::AddGridObject(), Cell::CellX(), Cell::CellY(), GetMapGrid(), Cell::GridX(), and Cell::GridY().

◆ AddToGrid() [5/5]

template<class T >
void Map::AddToGrid ( T *  object,
Cell const &  cell 
)
protected

◆ AddToMap() [1/2]

template<class T >
bool Map::AddToMap ( T *  obj,
bool  checkTransport = false 
)
308{
309 //TODO: Needs clean up. An object should not be added to map twice.
310 if (obj->IsInWorld())
311 {
312 ASSERT(obj->IsInGrid());
313 obj->UpdateObjectVisibility(true);
314 return true;
315 }
316
317 CellCoord cellCoord = Acore::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
318 //It will create many problems (including crashes) if an object is not added to grid after creation
319 //The correct way to fix it is to make AddToMap return false and delete the object if it is not added to grid
320 //But now AddToMap is used in too many places, I will just see how many ASSERT failures it will cause
321 ASSERT(cellCoord.IsCoordValid());
322 if (!cellCoord.IsCoordValid())
323 {
324 LOG_ERROR("maps", "Map::AddToMap: Object {} has invalid coordinates X:{} Y:{} grid cell [{}:{}]",
325 obj->GetGUID().ToString(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
326 return false; //Should delete object
327 }
328
329 Cell cell(cellCoord);
330 if (obj->isActiveObject())
331 EnsureGridLoaded(cell);
332 else
333 EnsureGridCreated(GridCoord(cell.GridX(), cell.GridY()));
334
335 AddToGrid(obj, cell);
336
337 //Must already be set before AddToMap. Usually during obj->Create.
338 //obj->SetMap(this);
339 obj->AddToWorld();
340
341 if (checkTransport)
342 if (!(obj->IsGameObject() && obj->ToGameObject()->IsTransport())) // dont add transport to transport ;d
343 if (Transport* transport = GetTransportForPos(obj->GetPhaseMask(), obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj))
344 transport->AddPassenger(obj, true);
345
346 InitializeObject(obj);
347
348 //something, such as vehicle, needs to be update immediately
349 //also, trigger needs to cast spell, if not update, cannot see visual
350 obj->UpdateObjectVisibilityOnCreate();
351
352 // Post-visibility so accessories seat after the vehicle's create packet reaches clients.
353 if (obj->IsCreature())
354 if (Vehicle* vehicle = obj->ToCreature()->GetVehicleKit())
355 vehicle->Reset();
356 return true;
357}
CoordPair< MAX_NUMBER_OF_GRIDS > GridCoord
Definition GridDefines.h:171
void InitializeObject(T *obj)
Definition Map.cpp:290
Transport * GetTransportForPos(uint32 phase, float x, float y, float z, WorldObject *worldobject=nullptr)
Definition Map.cpp:1161
void EnsureGridCreated(GridCoord const &gridCoord)
Definition Map.cpp:183
bool EnsureGridLoaded(Cell const &cell)
Definition Map.cpp:188
Definition Transport.h:30
Definition Vehicle.h:28

References AddToGrid(), ASSERT, Acore::ComputeCellCoord(), EnsureGridCreated(), EnsureGridLoaded(), GetTransportForPos(), Cell::GridX(), Cell::GridY(), InitializeObject(), CoordPair< LIMIT >::IsCoordValid(), LOG_ERROR, CoordPair< LIMIT >::x_coord, and CoordPair< LIMIT >::y_coord.

Referenced by Battleground::AddCreature(), Battleground::AddObject(), Player::BuildPlayerRepop(), ConvertCorpseToBones(), GameObject::Create(), MotionTransport::CreateGOPassenger(), MotionTransport::CreateNPCPassenger(), Player::CreatePet(), Player::CreatePet(), TransportMgr::CreateTransport(), MotionTransport::DelayedTeleportTransport(), Spell::EffectCreateTamedPet(), Spell::EffectDuel(), Spell::EffectSummonObject(), Spell::EffectSummonObjectWild(), Spell::EffectTameCreature(), Spell::EffectTransmitted(), GameEventMgr::GameEventSpawn(), debug_commandscript::HandleDebugSpawnVehicleCommand(), OutdoorPvPSI::HandleDropFlag(), Pet::LoadPetFromDB(), GameObject::Refresh(), ScriptsProcess(), Battlefield::SpawnCreature(), Battlefield::SpawnGameObject(), SummonCreature(), SummonGameObject(), WorldObject::SummonGameObject(), Player::SummonPet(), and GameObject::Update().

◆ AddToMap() [2/2]

template<>
bool Map::AddToMap ( Transport *  obj,
bool   
)
361{
362 //TODO: Needs clean up. An object should not be added to map twice.
363 if (obj->IsInWorld())
364 return true;
365
367 if (!cellCoord.IsCoordValid())
368 {
369 LOG_ERROR("maps", "Map::Add: Object {} has invalid coordinates X:{} Y:{} grid cell [{}:{}]",
370 obj->GetGUID().ToString(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
371 return false; //Should delete object
372 }
373
374 Cell cell(cellCoord);
375 EnsureGridLoaded(cell);
376
377 obj->AddToWorld();
378
379 _transports.insert(obj);
380
381 // Broadcast creation to players
382 // Skip players that are not in world. Sending the create to their loading client
383 // could materialize a lingering transport on whatever map they are teleporting to.
384 // They get the correct transport list from SendInitTransports when added to their new map
385 for (Map::PlayerList::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
386 {
387 if (itr->GetSource()->IsInWorld() && itr->GetSource()->GetTransport() != obj)
388 {
389 UpdateData data;
390 obj->BuildCreateUpdateBlockForPlayer(&data, itr->GetSource());
391 WorldPacket packet;
392 data.BuildPacket(packet);
393 itr->GetSource()->SendDirectMessage(&packet);
394 }
395 }
396
397 return true;
398}
void AddToWorld() override
Definition GameObject.cpp:157
iterator begin()
Definition GridRefMgr.h:35
Definition LinkedList.h:139
iterator end()
Definition MapRefMgr.h:37
PlayerList const & GetPlayers() const
Definition Map.h:335
bool IsInWorld() const
Definition Object.h:115
virtual void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target)
Definition Object.cpp:187
Definition UpdateData.h:52
bool BuildPacket(WorldPacket &packet)
Definition UpdateData.cpp:48
Definition WorldPacket.h:26

References _transports, GameObject::AddToWorld(), GridRefMgr< MapGridType >::begin(), Object::BuildCreateUpdateBlockForPlayer(), UpdateData::BuildPacket(), Acore::ComputeCellCoord(), MapRefMgr::end(), EnsureGridLoaded(), Object::GetGUID(), GetPlayers(), Position::GetPositionX(), Position::GetPositionY(), CoordPair< LIMIT >::IsCoordValid(), Object::IsInWorld(), LOG_ERROR, ObjectGuid::ToString(), CoordPair< LIMIT >::x_coord, and CoordPair< LIMIT >::y_coord.

◆ AddUpdateObject()

void Map::AddUpdateObject ( Object *  obj)
inline
535 {
536 _updateObjects.insert(obj);
537 }
std::unordered_set< Object * > _updateObjects
Definition Map.h:703

References _updateObjects.

Referenced by WorldObject::AddToObjectUpdate().

◆ AddWorldObjectToFarVisibleMap()

void Map::AddWorldObjectToFarVisibleMap ( WorldObject *  obj)
637{
638 if (Creature* creature = obj->ToCreature())
639 {
640 if (!creature->IsInGrid())
641 return;
642
643 Cell curr_cell = creature->GetCurrentCell();
644 MapGridType* grid = GetMapGrid(curr_cell.GridX(), curr_cell.GridY());
645 grid->AddFarVisibleObject(curr_cell.CellX(), curr_cell.CellY(), creature);
646 }
647 else if (GameObject* go = obj->ToGameObject())
648 {
649 if (!go->IsInGrid())
650 return;
651
652 Cell curr_cell = go->GetCurrentCell();
653 MapGridType* grid = GetMapGrid(curr_cell.GridX(), curr_cell.GridY());
654 grid->AddFarVisibleObject(curr_cell.CellX(), curr_cell.CellY(), go);
655 }
656}
uint32 GridX() const
Definition Cell.h:71
uint32 GridY() const
Definition Cell.h:72
uint32 CellX() const
Definition Cell.h:69
uint32 CellY() const
Definition Cell.h:70

References MapGrid< GRID_OBJECT_TYPES, FAR_VISIBLE_OBJECT_TYPES >::AddFarVisibleObject(), Cell::CellX(), Cell::CellY(), GetMapGrid(), Cell::GridX(), Cell::GridY(), Object::ToCreature(), and Object::ToGameObject().

Referenced by WorldObject::AddToMapVisibilityOverrideContainers().

◆ AddWorldObjectToZoneWideVisibleMap()

void Map::AddWorldObjectToZoneWideVisibleMap ( uint32  zoneId,
WorldObject *  obj 
)
676{
677 _zoneWideVisibleWorldObjectsMap[zoneId].insert(obj);
678}
ZoneWideVisibleWorldObjectsMap _zoneWideVisibleWorldObjectsMap
Definition Map.h:708

References _zoneWideVisibleWorldObjectsMap.

Referenced by WorldObject::AddToMapVisibilityOverrideContainers(), WorldObject::AddToWorld(), and WorldObject::ProcessPositionDataChanged().

◆ AfterPlayerUnlinkFromMap()

void Map::AfterPlayerUnlinkFromMap ( )
virtual

◆ AllTransportsEmpty()

bool Map::AllTransportsEmpty ( ) const
3041{
3042 for (TransportsContainer::const_iterator itr = _transports.begin(); itr != _transports.end(); ++itr)
3043 if (!(*itr)->GetPassengers().empty())
3044 return false;
3045
3046 return true;
3047}

References _transports.

Referenced by MapInstanced::CreateInstanceForPlayer(), and UnloadAll().

◆ AllTransportsRemovePassengers()

void Map::AllTransportsRemovePassengers ( )
3050{
3051 for (TransportsContainer::const_iterator itr = _transports.begin(); itr != _transports.end(); ++itr)
3052 while (!(*itr)->GetPassengers().empty())
3053 (*itr)->RemovePassenger(*((*itr)->GetPassengers().begin()), true);
3054}

References _transports.

Referenced by MapInstanced::CreateInstanceForPlayer(), and UnloadAll().

◆ ApplyDynamicModeRespawnScaling()

uint32 Map::ApplyDynamicModeRespawnScaling ( WorldObject const *  obj,
uint32  respawnDelay 
) const
1759{
1760 ASSERT(obj->GetMap() == this);
1761
1762 float rate = sWorld->getFloatConfig(obj->IsGameObject() ? CONFIG_RESPAWN_DYNAMICRATE_GAMEOBJECT : CONFIG_RESPAWN_DYNAMICRATE_CREATURE);
1763
1764 if (rate == 1.0f)
1765 return respawnDelay;
1766
1767 // No instanced maps (dungeons, battlegrounds, arenas etc.)
1768 if (obj->GetMap()->Instanceable())
1769 return respawnDelay;
1770
1771 if (Creature const* creature = obj->ToCreature())
1772 {
1773 // Temporary spawns (no DB spawn id, e.g. summons / battlefield-spawned
1774 // creatures such as Wintergrasp turrets) are not part of the respawn system.
1775 if (!creature->GetSpawnId())
1776 return respawnDelay;
1777
1778 // No quest givers or world bosses
1779 if (creature->IsQuestGiver() || creature->isWorldBoss()
1780 || (creature->GetCreatureTemplate()->rank == CREATURE_ELITE_RARE)
1781 || (creature->GetCreatureTemplate()->rank == CREATURE_ELITE_RAREELITE))
1782 return respawnDelay;
1783 }
1784 // Temporary gameobjects (no DB spawn id) are likewise excluded.
1785 else if (GameObject const* go = obj->ToGameObject())
1786 {
1787 if (!go->GetSpawnId())
1788 return respawnDelay;
1789 }
1790
1791 auto it = _zonePlayerCountMap.find(obj->GetZoneId());
1792 if (it == _zonePlayerCountMap.end())
1793 return respawnDelay;
1794 uint32 const playerCount = it->second;
1795 if (!playerCount)
1796 return respawnDelay;
1797 double const adjustFactor = rate / playerCount;
1798 if (adjustFactor >= 1.0) // nothing to do here
1799 return respawnDelay;
1800 uint32 const timeMinimum = sWorld->getIntConfig(obj->IsGameObject() ? CONFIG_RESPAWN_DYNAMICMINIMUM_GAMEOBJECT : CONFIG_RESPAWN_DYNAMICMINIMUM_CREATURE);
1801 if (respawnDelay <= timeMinimum)
1802 return respawnDelay;
1803
1804 return std::max<uint32>(std::ceil(respawnDelay * adjustFactor), timeMinimum);
1805}
std::uint32_t uint32
Definition Define.h:107
@ CREATURE_ELITE_RARE
Definition SharedDefines.h:2968
@ CREATURE_ELITE_RAREELITE
Definition SharedDefines.h:2966
@ CONFIG_RESPAWN_DYNAMICRATE_CREATURE
Definition WorldConfig.h:168
@ CONFIG_RESPAWN_DYNAMICMINIMUM_CREATURE
Definition WorldConfig.h:400
@ CONFIG_RESPAWN_DYNAMICRATE_GAMEOBJECT
Definition WorldConfig.h:167
@ CONFIG_RESPAWN_DYNAMICMINIMUM_GAMEOBJECT
Definition WorldConfig.h:399
#define sWorld
Definition World.h:318

References _zonePlayerCountMap, ASSERT, CONFIG_RESPAWN_DYNAMICMINIMUM_CREATURE, CONFIG_RESPAWN_DYNAMICMINIMUM_GAMEOBJECT, CONFIG_RESPAWN_DYNAMICRATE_CREATURE, CONFIG_RESPAWN_DYNAMICRATE_GAMEOBJECT, CREATURE_ELITE_RARE, CREATURE_ELITE_RAREELITE, WorldObject::GetMap(), WorldObject::GetZoneId(), Instanceable(), Object::IsGameObject(), sWorld, Object::ToCreature(), and Object::ToGameObject().

Referenced by Creature::setDeathState(), and GameObject::Update().

◆ Balance()

void Map::Balance ( )
inline
void balance()
Definition DynamicTree.cpp:132
DynamicVMapCollisionData & GetDynamicTree()
Definition MapCollisionData.h:82

References _mapCollisionData, DynamicMapTree::balance(), and MapCollisionData::GetDynamicTree().

Referenced by EnsureGridLoaded().

◆ CannotEnter()

virtual EnterState Map::CannotEnter ( Player *  ,
bool   
)
inlinevirtual

◆ CanReachPositionAndGetValidCoords() [1/3]

bool Map::CanReachPositionAndGetValidCoords ( WorldObject const *  source,
float &  destX,
float &  destY,
float &  destZ,
bool  failOnCollision = true,
bool  failOnSlopes = true 
) const

validate the new destination and set reachable coords Check if a given unit can reach a specific point on a segment and set the correct dest coords NOTE: use this method with small segments.

Parameters
failOnCollisionif true, the methods will return false when a collision occurs
failOnSlopesif true, the methods will return false when a non walkable slope is found
Returns
true if the destination is valid, false otherwise
3401{
3402 return CanReachPositionAndGetValidCoords(source, source->GetPositionX(), source->GetPositionY(), source->GetPositionZ(), destX, destY, destZ, failOnCollision, failOnSlopes);
3403}
bool CanReachPositionAndGetValidCoords(WorldObject const *source, PathGenerator *path, float &destX, float &destY, float &destZ, bool failOnCollision=true, bool failOnSlopes=true) const
Check if a given source can reach a specific point following a path and normalize the coords....
Definition Map.cpp:3360

References CanReachPositionAndGetValidCoords(), Position::GetPositionX(), Position::GetPositionY(), and Position::GetPositionZ().

◆ CanReachPositionAndGetValidCoords() [2/3]

bool Map::CanReachPositionAndGetValidCoords ( WorldObject const *  source,
float  startX,
float  startY,
float  startZ,
float &  destX,
float &  destY,
float &  destZ,
bool  failOnCollision = true,
bool  failOnSlopes = true 
) const
3406{
3407 if (!CheckCollisionAndGetValidCoords(source, startX, startY, startZ, destX, destY, destZ, failOnCollision))
3408 {
3409 return false;
3410 }
3411
3412 Unit const* unit = source->ToUnit();
3413 // if it's not an unit (Object) then we do not have to continue
3414 // with walkable checks
3415 if (!unit)
3416 {
3417 return true;
3418 }
3419
3420 /*
3421 * Walkable checks
3422 */
3423 bool isWaterNext = HasEnoughWater(unit, destX, destY, destZ);
3424 Creature const* creature = unit->ToCreature();
3425 bool cannotEnterWater = isWaterNext && (creature && !creature->CanEnterWater());
3426 bool cannotWalkOrFly = !isWaterNext && !source->ToPlayer() && !unit->CanFly() && (creature && !creature->CanWalk());
3427 if (cannotEnterWater || cannotWalkOrFly ||
3428 (failOnSlopes && !PathGenerator::IsWalkableClimb(startX, startY, startZ, destX, destY, destZ, source->GetCollisionHeight())))
3429 {
3430 return false;
3431 }
3432
3433 return true;
3434}
bool CanWalk() const
Definition Creature.h:84
bool CanEnterWater() const override
Definition Creature.cpp:3433
bool HasEnoughWater(WorldObject const *searcher, float x, float y, float z) const
Definition Map.cpp:1627
bool CheckCollisionAndGetValidCoords(WorldObject const *source, float startX, float startY, float startZ, float &destX, float &destY, float &destZ, bool failOnCollision=true) const
validate the new destination and set coords Check if a given unit can face collisions in a specific s...
Definition Map.cpp:3443
bool IsWalkableClimb(float const *v1, float const *v2) const
Definition PathGenerator.cpp:1068
virtual bool CanFly() const =0

References Creature::CanEnterWater(), Unit::CanFly(), Creature::CanWalk(), CheckCollisionAndGetValidCoords(), WorldObject::GetCollisionHeight(), HasEnoughWater(), PathGenerator::IsWalkableClimb(), Object::ToCreature(), Object::ToPlayer(), and Object::ToUnit().

◆ CanReachPositionAndGetValidCoords() [3/3]

bool Map::CanReachPositionAndGetValidCoords ( WorldObject const *  source,
PathGenerator *  path,
float &  destX,
float &  destY,
float &  destZ,
bool  failOnCollision = true,
bool  failOnSlopes = true 
) const

Check if a given source can reach a specific point following a path and normalize the coords. Use this method for long paths, otherwise use the overloaded method with the start coords when you need to do a quick check on small segments.

3361{
3362 G3D::Vector3 prevPath = path->GetStartPosition();
3363 for (auto& vector : path->GetPath())
3364 {
3365 float x = vector.x;
3366 float y = vector.y;
3367 float z = vector.z;
3368
3369 if (!CanReachPositionAndGetValidCoords(source, prevPath.x, prevPath.y, prevPath.z, x, y, z, failOnCollision, failOnSlopes))
3370 {
3371 destX = x;
3372 destY = y;
3373 destZ = z;
3374 return false;
3375 }
3376
3377 prevPath = vector;
3378 }
3379
3380 destX = prevPath.x;
3381 destY = prevPath.y;
3382 destZ = prevPath.z;
3383
3384 return true;
3385}
G3D::Vector3 const & GetStartPosition() const
Definition PathGenerator.h:86

References CanReachPositionAndGetValidCoords(), PathGenerator::GetPath(), and PathGenerator::GetStartPosition().

Referenced by CanReachPositionAndGetValidCoords(), CanReachPositionAndGetValidCoords(), MotionMaster::MoveBackwards(), and MotionMaster::MoveForwards().

◆ CanUnload()

bool Map::CanUnload ( uint32  diff)
inline
179 {
180 if (!m_unloadTimer || Events.HasEvents())
181 return false;
182
183 if (m_unloadTimer <= diff)
184 return true;
185
186 m_unloadTimer -= diff;
187 return false;
188 }

References m_unloadTimer.

◆ CheckCollisionAndGetValidCoords()

bool Map::CheckCollisionAndGetValidCoords ( WorldObject const *  source,
float  startX,
float  startY,
float  startZ,
float &  destX,
float &  destY,
float &  destZ,
bool  failOnCollision = true 
) const

validate the new destination and set coords Check if a given unit can face collisions in a specific segment

Returns
true if the destination is valid, false otherwise
3444{
3445 // Prevent invalid coordinates here, position is unchanged
3446 if (!Acore::IsValidMapCoord(startX, startY, startZ) || !Acore::IsValidMapCoord(destX, destY, destZ))
3447 {
3448 LOG_FATAL("maps", "Map::CheckCollisionAndGetValidCoords invalid coordinates startX: {}, startY: {}, startZ: {}, destX: {}, destY: {}, destZ: {}", startX, startY, startZ, destX, destY, destZ);
3449 return false;
3450 }
3451
3452 bool isWaterNext = IsInWater(source->GetPhaseMask(), destX, destY, destZ, source->GetCollisionHeight());
3453
3454 PathGenerator path(source);
3455
3456 // Use a detour raycast to get our first collision point
3457 path.SetUseRaycast(true);
3458 bool result = path.CalculatePath(startX, startY, startZ, destX, destY, destZ, false);
3459
3460 Unit const* unit = source->ToUnit();
3461 bool notOnGround = path.GetPathType() & PATHFIND_NOT_USING_PATH
3462 || isWaterNext || (unit && unit->IsFlying());
3463
3464 // Check for valid path types before we proceed
3465 if (!result || (!notOnGround && path.GetPathType() & ~(PATHFIND_NORMAL | PATHFIND_SHORTCUT | PATHFIND_INCOMPLETE | PATHFIND_FARFROMPOLY_END)))
3466 {
3467 return false;
3468 }
3469
3470 G3D::Vector3 endPos = path.GetPath().back();
3471 destX = endPos.x;
3472 destY = endPos.y;
3473 destZ = endPos.z;
3474
3475 // collision check
3476 bool collided = false;
3477
3478 // check static LOS
3479 float halfHeight = source->GetCollisionHeight() * 0.5f;
3480
3481 // Unit is not on the ground, check for potential collision via vmaps
3482 if (notOnGround)
3483 {
3484 bool col = _mapCollisionData.GetStaticTree().GetObjectHitPos(startX, startY, startZ + halfHeight,
3485 destX, destY, destZ + halfHeight,
3486 destX, destY, destZ, -CONTACT_DISTANCE);
3487
3488 destZ -= halfHeight;
3489
3490 // Collided with static LOS object, move back to collision point
3491 if (col)
3492 {
3493 collided = true;
3494 }
3495 }
3496
3497 // check dynamic collision
3498 bool col = _mapCollisionData.GetDynamicTree().GetObjectHitPos(source->GetPhaseMask(),
3499 startX, startY, startZ + halfHeight,
3500 destX, destY, destZ + halfHeight,
3501 destX, destY, destZ, -CONTACT_DISTANCE);
3502
3503 destZ -= halfHeight;
3504
3505 // Collided with a gameobject, move back to collision point
3506 if (col)
3507 {
3508 collided = true;
3509 }
3510
3511 float groundZ = VMAP_INVALID_HEIGHT_VALUE;
3512 source->UpdateAllowedPositionZ(destX, destY, destZ, &groundZ);
3513
3514 // position has no ground under it (or is too far away)
3515 if (groundZ <= INVALID_HEIGHT && unit && !unit->CanFly())
3516 {
3517 // fall back to gridHeight if any
3518 float gridHeight = GetGridHeight(destX, destY);
3519 if (gridHeight > INVALID_HEIGHT)
3520 {
3521 destZ = gridHeight + unit->GetHoverHeight();
3522 }
3523 else
3524 {
3525 return false;
3526 }
3527 }
3528
3529 return !failOnCollision || !collided;
3530}
#define INVALID_HEIGHT
Definition GridTerrainData.h:27
#define VMAP_INVALID_HEIGHT_VALUE
Definition IVMapMgr.h:51
#define LOG_FATAL(filterType__,...)
Definition Log.h:141
#define CONTACT_DISTANCE
Definition ObjectDefines.h:23
@ PATHFIND_FARFROMPOLY_END
Definition PathGenerator.h:54
@ PATHFIND_NOT_USING_PATH
Definition PathGenerator.h:51
@ PATHFIND_NORMAL
Definition PathGenerator.h:47
@ PATHFIND_SHORTCUT
Definition PathGenerator.h:48
@ PATHFIND_INCOMPLETE
Definition PathGenerator.h:49
bool GetObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float &rx, float &ry, float &rz, float modifyDist) const
Definition MapCollisionData.cpp:163
StaticVMapCollisionData & GetStaticTree()
Definition MapCollisionData.h:84
bool IsInWater(uint32 phaseMask, float x, float y, float z, float collisionHeight) const
Definition Map.cpp:1615
float GetGridHeight(float x, float y) const
Definition Map.cpp:1222
Definition PathGenerator.h:59
bool GetObjectHitPos(float x1, float y1, float z1, float x2, float y2, float z2, float &rx, float &ry, float &rz, float modifyDist) const
Definition MapCollisionData.cpp:89
float GetCollisionHeight() const override
Return collision height sent to client.
Definition Unit.cpp:16764
float GetHoverHeight() const
Definition Unit.h:1724
bool IsFlying() const
Definition Unit.h:1720
bool IsValidMapCoord(float c)
Definition GridDefines.h:210

References _mapCollisionData, PathGenerator::CalculatePath(), CanFly, CONTACT_DISTANCE, WorldObject::GetCollisionHeight(), MapCollisionData::GetDynamicTree(), GetGridHeight(), Unit::GetHoverHeight(), StaticVMapCollisionData::GetObjectHitPos(), DynamicVMapCollisionData::GetObjectHitPos(), PathGenerator::GetPath(), PathGenerator::GetPathType(), WorldObject::GetPhaseMask(), MapCollisionData::GetStaticTree(), INVALID_HEIGHT, Unit::IsFlying(), IsInWater(), Acore::IsValidMapCoord(), LOG_FATAL, PATHFIND_FARFROMPOLY_END, PATHFIND_INCOMPLETE, PATHFIND_NORMAL, PATHFIND_NOT_USING_PATH, PATHFIND_SHORTCUT, PathGenerator::SetUseRaycast(), Object::ToUnit(), WorldObject::UpdateAllowedPositionZ(), and VMAP_INVALID_HEIGHT_VALUE.

Referenced by CanReachPositionAndGetValidCoords().

◆ ContainsGameObjectModel()

bool Map::ContainsGameObjectModel ( GameObjectModel const &  model) const
inline
406{ return _mapCollisionData.GetDynamicTree().contains(model);}
bool contains(GameObjectModel const &) const
Definition DynamicTree.cpp:127

References _mapCollisionData, DynamicMapTree::contains(), and MapCollisionData::GetDynamicTree().

◆ ConvertCorpseToBones()

Corpse * Map::ConvertCorpseToBones ( ObjectGuid const &  ownerGuid,
bool  insignia = false 
)
3106{
3107 Corpse* corpse = GetCorpseByPlayer(ownerGuid);
3108 if (!corpse)
3109 return nullptr;
3110
3111 RemoveCorpse(corpse);
3112
3113 // remove corpse from DB
3114 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
3115 corpse->DeleteFromDB(trans);
3116 CharacterDatabase.CommitTransaction(trans);
3117
3118 Corpse* bones = NULL;
3119
3120 // create the bones only if the map and the grid is loaded at the corpse's location
3121 // ignore bones creating option in case insignia
3122 if ((insignia ||
3124 IsGridLoaded(corpse->GetPositionX(), corpse->GetPositionY()))
3125 {
3126 // Create bones, don't change Corpse
3127 bones = new Corpse();
3128 bones->Create(corpse->GetGUID().GetCounter());
3129
3130 for (uint8 i = OBJECT_FIELD_TYPE + 1; i < CORPSE_END; ++i) // don't overwrite guid and object type
3131 bones->SetUInt32Value(i, corpse->GetUInt32Value(i));
3132
3133 bones->SetCellCoord(corpse->GetCellCoord());
3134 bones->Relocate(corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetOrientation());
3135 bones->SetPhaseMask(corpse->GetPhaseMask(), false);
3136
3138 bones->SetGuidValue(CORPSE_FIELD_OWNER, corpse->GetOwnerGUID());
3139
3140 for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
3141 if (corpse->GetUInt32Value(CORPSE_FIELD_ITEM + i))
3142 bones->SetUInt32Value(CORPSE_FIELD_ITEM + i, 0);
3143
3144 AddCorpse(bones);
3145
3146 bones->UpdatePositionData();
3147
3148 // add bones in grid store if grid loaded where corpse placed
3149 AddToMap(bones);
3150 }
3151
3152 // all references to the corpse should be removed at this point
3153 delete corpse;
3154
3155 return bones;
3156}
@ CORPSE_FLAG_BONES
Definition Corpse.h:40
@ CORPSE_FLAG_UNK2
Definition Corpse.h:42
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
Definition DatabaseEnvFwd.h:69
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition DatabaseEnv.cpp:21
std::uint8_t uint8
Definition Define.h:109
@ EQUIPMENT_SLOT_END
Definition Player.h:681
@ CORPSE_FIELD_FLAGS
Definition UpdateFields.h:427
@ CORPSE_END
Definition UpdateFields.h:430
@ CORPSE_FIELD_ITEM
Definition UpdateFields.h:423
@ CORPSE_FIELD_OWNER
Definition UpdateFields.h:420
@ OBJECT_FIELD_TYPE
Definition UpdateFields.h:26
@ CONFIG_DEATH_BONES_BG_OR_ARENA
Definition WorldConfig.h:63
@ CONFIG_DEATH_BONES_WORLD
Definition WorldConfig.h:62
Definition Corpse.h:49
bool Create(ObjectGuid::LowType guidlow)
Definition Corpse.cpp:71
CellCoord const & GetCellCoord() const
Definition Corpse.h:75
void SetCellCoord(CellCoord const &cellCoord)
Definition Corpse.h:76
void DeleteFromDB(CharacterDatabaseTransaction trans)
Definition Corpse.cpp:129
bool IsBattlegroundOrArena() const
Definition Map.h:307
void AddCorpse(Corpse *corpse)
Definition Map.cpp:3072
bool IsGridLoaded(GridCoord const &gridCoord) const
Definition Map.cpp:206
Corpse * GetCorpseByPlayer(ObjectGuid const &ownerGuid) const
Definition Map.h:375
bool AddToMap(T *, bool checkTransport=false)
Definition Map.cpp:307
void RemoveCorpse(Corpse *corpse)
Definition Map.cpp:3084
LowType GetCounter() const
Definition ObjectGuid.h:149
uint32 GetUInt32Value(uint16 index) const
Definition Object.cpp:303
void SetGuidValue(uint16 index, ObjectGuid value)
Definition Object.cpp:721
void SetUInt32Value(uint16 index, uint32 value)
Definition Object.cpp:648
virtual void SetPhaseMask(uint32 newPhaseMask, bool update)
Definition Object.cpp:2999
uint32 GetPhaseMask() const
Definition Object.h:523
void UpdatePositionData()
Definition Object.cpp:1188
float GetPositionZ() const
Definition Position.h:123
float GetOrientation() const
Definition Position.h:124
void Relocate(float x, float y)
Definition Position.h:77

References AddCorpse(), AddToMap(), CharacterDatabase, CONFIG_DEATH_BONES_BG_OR_ARENA, CONFIG_DEATH_BONES_WORLD, CORPSE_END, CORPSE_FIELD_FLAGS, CORPSE_FIELD_ITEM, CORPSE_FIELD_OWNER, CORPSE_FLAG_BONES, CORPSE_FLAG_UNK2, Corpse::Create(), Corpse::DeleteFromDB(), EQUIPMENT_SLOT_END, Corpse::GetCellCoord(), GetCorpseByPlayer(), ObjectGuid::GetCounter(), Object::GetGUID(), Position::GetOrientation(), Corpse::GetOwnerGUID(), WorldObject::GetPhaseMask(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Object::GetUInt32Value(), IsBattlegroundOrArena(), IsGridLoaded(), OBJECT_FIELD_TYPE, Position::Relocate(), RemoveCorpse(), Corpse::SetCellCoord(), Object::SetGuidValue(), WorldObject::SetPhaseMask(), Object::SetUInt32Value(), sWorld, and WorldObject::UpdatePositionData().

Referenced by AddPlayerToMap(), Player::RemovedInsignia(), and RemoveOldCorpses().

◆ CreatureRelocation()

void Map::CreatureRelocation ( Creature *  creature,
float  x,
float  y,
float  z,
float  o 
)
827{
828 Cell old_cell = creature->GetCurrentCell();
829 Cell new_cell(x, y);
830
831 bool const cellChanged = old_cell.DiffGrid(new_cell) || old_cell.DiffCell(new_cell);
832
833 if (cellChanged)
834 {
835 if (old_cell.DiffGrid(new_cell))
836 EnsureGridLoaded(new_cell);
837
838 AddCreatureToMoveList(creature);
839 }
840 else
842
843 creature->Relocate(x, y, z, o);
844 if (creature->IsVehicle())
845 creature->GetVehicleKit()->RelocatePassengers();
846
847 // Terrain status (zone / area / floor / liquid) is derived lazily: the getters recompute it on
848 // demand, the same as for GameObjects. GetFullTerrainStatusForPosition() is VMAP-heavy and used to
849 // run on every spline sub-step, so a wandering creature that nothing is querying now costs no
850 // raycast. Re-derive eagerly here only when the result must be exact immediately and nothing is
851 // guaranteed to read it:
852 // - the creature changed grid cell;
853 // - it is in combat or evading home (a mob chasing / returning through water must have the
854 // correct swim state at once);
855 // - it is zone-wide visible (world boss / event NPC) - ProcessPositionDataChanged() moves it
856 // between zone visibility maps only on a real derive, so throttling could hide it from players
857 // after it crosses a zone border.
858 // For a plain wandering creature, Creature::Update() keeps the swim / fly / hover flags in step
859 // with the terrain it moves over.
860 if (cellChanged || creature->IsInCombat() || creature->IsInEvadeMode() || creature->IsZoneWideVisible())
861 {
862 creature->UpdatePositionData();
863 }
864 else
865 creature->SetPositionDataUpdate();
866
867 creature->UpdateObjectVisibility(false);
868}
bool IsInEvadeMode() const
Definition Creature.h:138
void AddCreatureToMoveList(Creature *c)
Definition Map.cpp:911
void RemoveCreatureFromMoveList(Creature *c)
Definition Map.cpp:918
Cell const & GetCurrentCell() const
Definition Object.h:429
bool IsVehicle() const
Definition Unit.h:801
void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false) override
Definition Unit.cpp:14982
Vehicle * GetVehicleKit() const
Definition Unit.h:1931
bool IsInCombat() const
Definition Unit.h:941
void RelocatePassengers()
Definition Vehicle.cpp:546
void SetPositionDataUpdate()
Definition Object.cpp:1179
bool IsZoneWideVisible() const
Definition Object.h:688
bool DiffGrid(Cell const &cell) const
Definition Cell.h:63
bool DiffCell(Cell const &cell) const
Definition Cell.h:57

References AddCreatureToMoveList(), Cell::DiffCell(), Cell::DiffGrid(), EnsureGridLoaded(), MovableMapObject::GetCurrentCell(), Unit::GetVehicleKit(), Unit::IsInCombat(), Creature::IsInEvadeMode(), Unit::IsVehicle(), WorldObject::IsZoneWideVisible(), Position::Relocate(), Vehicle::RelocatePassengers(), RemoveCreatureFromMoveList(), WorldObject::SetPositionDataUpdate(), Unit::UpdateObjectVisibility(), and WorldObject::UpdatePositionData().

Referenced by Creature::SetPosition(), StaticTransport::UpdatePassengerPositions(), MotionTransport::UpdatePassengerPositions(), and Unit::UpdatePosition().

◆ DelayedUpdate()

void Map::DelayedUpdate ( const uint32  diff)
virtual

Reimplemented in MapInstanced.

1808{
1810 {
1811 Transport* transport = *_transportsUpdateIter;
1813
1814 if (!transport->IsInWorld())
1815 continue;
1816
1817 transport->DelayedUpdate(t_diff);
1818 }
1819
1821}
void RemoveAllObjectsInRemoveList()
Definition Map.cpp:1833
virtual void DelayedUpdate(uint32)
Definition Transport.h:41

References _transports, _transportsUpdateIter, Transport::DelayedUpdate(), Object::IsInWorld(), and RemoveAllObjectsInRemoveList().

Referenced by MapInstanced::DelayedUpdate().

◆ DeleteCorpseData()

void Map::DeleteCorpseData ( )
3570{
3571 // DELETE FROM corpse WHERE mapId = ? AND instanceId = ?
3573 stmt->SetData(0, GetId());
3574 stmt->SetData(1, GetInstanceId());
3575 CharacterDatabase.Execute(stmt);
3576}
@ CHAR_DEL_CORPSES_FROM_MAP
Definition CharacterDatabase.h:251
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition PreparedStatement.h:77
Definition PreparedStatement.h:157

References CHAR_DEL_CORPSES_FROM_MAP, CharacterDatabase, GetId(), GetInstanceId(), and PreparedStatementBase::SetData().

Referenced by InstanceMap::UnloadAll().

◆ DeleteFromWorld() [1/2]

template<>
void Map::DeleteFromWorld ( Player *  player)
176{
178
179 RemoveUpdateObject(player); //TODO: I do not know why we need this, it should be removed in ~Object anyway
180 delete player;
181}
void RemoveUpdateObject(Object *obj)
Definition Map.h:539
void RemoveObject(T *object)
Definition ObjectAccessor.h:95

References ObjectAccessor::RemoveObject(), and RemoveUpdateObject().

◆ DeleteFromWorld() [2/2]

template<class T >
void Map::DeleteFromWorld ( T *  obj)
private
169{
170 // Note: In case resurrectable corpse and pet its removed from global lists in own destructor
171 delete obj;
172}

Referenced by RemoveFromMap(), RemoveFromMap(), and RemovePlayerFromMap().

◆ DeleteRespawnTimes()

void Map::DeleteRespawnTimes ( )
2603{
2604 _creatureRespawnTimes.clear();
2605 _goRespawnTimes.clear();
2606 _respawnQueue.clear();
2607
2609}
static void DeleteRespawnTimesInDB(uint16 mapId, uint32 instanceId)
Definition Map.cpp:2611
std::unordered_map< ObjectGuid::LowType, time_t > _creatureRespawnTimes
Definition Map.h:651
std::set< RespawnEntry > _respawnQueue
Definition Map.h:670
std::unordered_map< ObjectGuid::LowType, time_t > _goRespawnTimes
Definition Map.h:652

References _creatureRespawnTimes, _goRespawnTimes, _respawnQueue, DeleteRespawnTimesInDB(), GetId(), and GetInstanceId().

Referenced by InstanceMap::UnloadAll().

◆ DeleteRespawnTimesInDB()

void Map::DeleteRespawnTimesInDB ( uint16  mapId,
uint32  instanceId 
)
static
2612{
2614 stmt->SetData(0, mapId);
2615 stmt->SetData(1, instanceId);
2616 CharacterDatabase.Execute(stmt);
2617
2618 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GO_RESPAWN_BY_INSTANCE);
2619 stmt->SetData(0, mapId);
2620 stmt->SetData(1, instanceId);
2621 CharacterDatabase.Execute(stmt);
2622}
@ CHAR_DEL_CREATURE_RESPAWN_BY_INSTANCE
Definition CharacterDatabase.h:257
@ CHAR_DEL_GO_RESPAWN_BY_INSTANCE
Definition CharacterDatabase.h:262

References CHAR_DEL_CREATURE_RESPAWN_BY_INSTANCE, CHAR_DEL_GO_RESPAWN_BY_INSTANCE, CharacterDatabase, and PreparedStatementBase::SetData().

Referenced by InstanceSaveMgr::_ResetSave(), InstanceSaveMgr::DeleteInstanceSaveIfNeeded(), and DeleteRespawnTimes().

◆ DoForAllPlayers()

void Map::DoForAllPlayers ( std::function< void(Player *)>  exec)
3344{
3345 for (auto const& it : GetPlayers())
3346 {
3347 if (Player* player = it.GetSource())
3348 {
3349 exec(player);
3350 }
3351 }
3352}

References GetPlayers().

Referenced by Battleground::_ProcessProgress(), ArenaSeasonMgr::BroadcastUpdatedWorldState(), WorldState::BuffAdalsSongOfBattle(), WorldState::BuffMagtheridonTeam(), BattlegroundSA::CaptureGraveyard(), WorldState::DispelAdalsSongOfBattle(), WorldState::DispelMagtheridonTeam(), npc_thrall_warchief::npc_thrall_warchiefAI::DoAction(), InstanceScript::DoCastSpellOnPlayers(), InstanceScript::DoRemoveAurasDueToSpellOnPlayers(), ScriptedAI::DoRewardPlayersInArea(), InstanceScript::DoSendNotifyToInstance(), InstanceScript::DoStartTimedAchievement(), InstanceScript::DoStopTimedAchievement(), InstanceScript::DoUpdateAchievementCriteria(), BattlegroundSA::EventPlayerDamagedGO(), BattlegroundSA::EventPlayerUsedGO(), boss_yoggsaron_sara::HasAlivePlayerInIllusion(), boss_azuregos::boss_azuregosAI::JustDied(), boss_rajaxx::JustDied(), boss_alar::JustDied(), boss_devourer_of_souls::JustEngagedWith(), boss_felblood_kaelthas::LapseAction(), spell_malygos_vortex_visual::OnRemove(), BattlegroundSA::PostUpdateImpl(), spell_fire_festival_fortitude::PrepareSpellScript(), boss_azuregos::boss_azuregosAI::Reset(), boss_yoggsaron_sara::Reset(), npc_minigob_manabonk::SelectTargetInDalaran(), instance_the_black_morass::instance_the_black_morass_InstanceMapScript::SetBossState(), instance_halls_of_reflection::SetBossState(), instance_ulduar::instance_ulduar_InstanceMapScript::SetBossState(), instance_halls_of_reflection::SetData(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SetData(), instance_ulduar::instance_ulduar_InstanceMapScript::SpawnLeviathanOutro(), Battleground::SpiritOfCompetitionEvent(), boss_nefarian::UpdateAI(), boss_cthun::UpdateAI(), boss_malygos::UpdateAI(), npc_gunship::npc_gunshipAI::UpdateAI(), npc_midsummer_bonfire::UpdateBonfireBlessingBuffs(), instance_halls_of_reflection::UpdateOutro(), and instance_eye_of_eternity::VortexHandling().

◆ DynamicObjectRelocation()

void Map::DynamicObjectRelocation ( DynamicObject *  go,
float  x,
float  y,
float  z,
float  o 
)
892{
893 Cell old_cell = dynObj->GetCurrentCell();
894 Cell new_cell(x, y);
895
896 if (old_cell.DiffGrid(new_cell) || old_cell.DiffCell(new_cell))
897 {
898 if (old_cell.DiffGrid(new_cell))
899 EnsureGridLoaded(new_cell);
900
902 }
903 else
905
906 dynObj->Relocate(x, y, z, o);
907 dynObj->SetPositionDataUpdate();
908 dynObj->UpdateObjectVisibility(false);
909}
void RemoveDynamicObjectFromMoveList(DynamicObject *go)
Definition Map.cpp:944
void AddDynamicObjectToMoveList(DynamicObject *go)
Definition Map.cpp:937

References AddDynamicObjectToMoveList(), Cell::DiffCell(), Cell::DiffGrid(), EnsureGridLoaded(), MovableMapObject::GetCurrentCell(), Position::Relocate(), RemoveDynamicObjectFromMoveList(), WorldObject::SetPositionDataUpdate(), and WorldObject::UpdateObjectVisibility().

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

◆ EnsureGridCreated()

void Map::EnsureGridCreated ( GridCoord const &  gridCoord)
184{
185 _mapGridManager.CreateGrid(gridCoord.x_coord, gridCoord.y_coord);
186}
void CreateGrid(uint16 const x, uint16 const y)
Definition MapGridManager.cpp:5

References _mapGridManager, MapGridManager::CreateGrid(), CoordPair< LIMIT >::x_coord, and CoordPair< LIMIT >::y_coord.

Referenced by AddToMap(), MapGridManager::CreateGrid(), EnsureGridLoaded(), and GetGridTerrainData().

◆ EnsureGridLoaded()

bool Map::EnsureGridLoaded ( Cell const &  cell)
private
189{
190 EnsureGridCreated(GridCoord(cell.GridX(), cell.GridY()));
191
192 if (_mapGridManager.LoadGrid(cell.GridX(), cell.GridY()))
193 {
194 Balance();
195 return true;
196 }
197
198 return false;
199}
bool LoadGrid(uint16 const x, uint16 const y)
Definition MapGridManager.cpp:33
void Balance()
Definition Map.h:403

References _mapGridManager, Balance(), EnsureGridCreated(), Cell::GridX(), Cell::GridY(), and MapGridManager::LoadGrid().

Referenced by AddToMap(), AddToMap(), CreatureRelocation(), DynamicObjectRelocation(), GameObjectRelocation(), LoadGrid(), LoadGridsInRange(), MoveAllCreaturesInMoveList(), MoveAllDynamicObjectsInMoveList(), MoveAllGameObjectsInMoveList(), PlayerRelocation(), and SummonCreature().

◆ GameObjectRelocation()

void Map::GameObjectRelocation ( GameObject *  go,
float  x,
float  y,
float  z,
float  o 
)
871{
872 Cell old_cell = go->GetCurrentCell();
873 Cell new_cell(x, y);
874
875 if (old_cell.DiffGrid(new_cell) || old_cell.DiffCell(new_cell))
876 {
877 if (old_cell.DiffGrid(new_cell))
878 EnsureGridLoaded(new_cell);
879
881 }
882 else
884
885 go->Relocate(x, y, z, o);
888 go->UpdateObjectVisibility(false);
889}
void UpdateModelPosition()
Definition GameObject.cpp:2952
void AddGameObjectToMoveList(GameObject *go)
Definition Map.cpp:924
void RemoveGameObjectFromMoveList(GameObject *go)
Definition Map.cpp:931
virtual void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false)
Definition Object.cpp:3072

References AddGameObjectToMoveList(), Cell::DiffCell(), Cell::DiffGrid(), EnsureGridLoaded(), MovableMapObject::GetCurrentCell(), Position::Relocate(), RemoveGameObjectFromMoveList(), WorldObject::SetPositionDataUpdate(), GameObject::UpdateModelPosition(), and WorldObject::UpdateObjectVisibility().

Referenced by GameObject::SetPosition(), StaticTransport::UpdatePassengerPositions(), and MotionTransport::UpdatePassengerPositions().

◆ GenerateLowGuid()

◆ GetAllTransports()

TransportsContainer const & Map::GetAllTransports ( ) const
inline

◆ GetAreaId()

uint32 Map::GetAreaId ( uint32  phaseMask,
float  x,
float  y,
float  z 
) const
1283{
1284 uint32 mogpFlags;
1285 int32 adtId, rootId, groupId;
1286 float vmapZ = z;
1287 bool hasVmapArea = GetAreaInfo(phaseMask, x, y, vmapZ, mogpFlags, adtId, rootId, groupId);
1288
1289 uint32 gridAreaId = 0;
1290 float gridMapHeight = INVALID_HEIGHT;
1291 if (GridTerrainData* gmap = const_cast<Map*>(this)->GetGridTerrainData(x, y))
1292 {
1293 gridAreaId = gmap->getArea(x, y);
1294 gridMapHeight = gmap->getHeight(x, y);
1295 }
1296
1297 uint16 areaId = 0;
1298
1299 // floor is the height we are closer to (but only if above)
1300 if (hasVmapArea && G3D::fuzzyGe(z, vmapZ - GROUND_HEIGHT_TOLERANCE) && (G3D::fuzzyLt(z, gridMapHeight - GROUND_HEIGHT_TOLERANCE) || vmapZ > gridMapHeight))
1301 {
1302 // wmo found
1303 if (WMOAreaTableEntry const* wmoEntry = GetWMOAreaTableEntryByTripple(rootId, adtId, groupId))
1304 areaId = wmoEntry->areaId;
1305
1306 if (!areaId)
1307 areaId = gridAreaId;
1308 }
1309 else
1310 areaId = gridAreaId;
1311
1312 if (!areaId)
1313 areaId = i_mapEntry->linked_zone;
1314
1315 return areaId;
1316}
WMOAreaTableEntry const * GetWMOAreaTableEntryByTripple(int32 rootid, int32 adtid, int32 groupid)
Definition DBCStores.cpp:706
std::uint16_t uint16
Definition Define.h:108
float const GROUND_HEIGHT_TOLERANCE
Definition SharedDefines.h:26
Definition GridTerrainData.h:222
Definition Map.h:168
bool GetAreaInfo(uint32 phaseMask, float x, float y, float z, uint32 &mogpflags, int32 &adtId, int32 &rootId, int32 &groupId) const
Definition Map.cpp:1243
GridTerrainData * GetGridTerrainData(GridCoord const &gridCoord)
Definition Map.cpp:1124
uint32 linked_zone
Definition DBCStructure.h:1369
Definition DBCStructure.h:2167

References GetAreaInfo(), GetGridTerrainData(), GetWMOAreaTableEntryByTripple(), GROUND_HEIGHT_TOLERANCE, i_mapEntry, INVALID_HEIGHT, and MapEntry::linked_zone.

Referenced by MapMgr::GetAreaId(), GetLiquidData(), GetZoneAndAreaId(), and GetZoneId().

◆ GetAreaInfo()

bool Map::GetAreaInfo ( uint32  phaseMask,
float  x,
float  y,
float  z,
uint32 &  mogpflags,
int32 &  adtId,
int32 &  rootId,
int32 &  groupId 
) const
1244{
1245 float check_z = z;
1248
1249 bool hasVmapAreaInfo = _mapCollisionData.GetStaticTree().GetAreaAndLiquidData(x, y, z, {}, vdata) && vdata.areaInfo.has_value();
1250 bool hasDynamicAreaInfo = _mapCollisionData.GetDynamicTree().GetAreaAndLiquidData(x, y, z, phaseMask, {}, ddata) && ddata.areaInfo.has_value();
1251 auto useVmap = [&] { check_z = vdata.floorZ; groupId = vdata.areaInfo->groupId; adtId = vdata.areaInfo->adtId; rootId = vdata.areaInfo->rootId; flags = vdata.areaInfo->mogpFlags; };
1252 auto useDyn = [&] { check_z = ddata.floorZ; groupId = ddata.areaInfo->groupId; adtId = ddata.areaInfo->adtId; rootId = ddata.areaInfo->rootId; flags = ddata.areaInfo->mogpFlags; };
1253 if (hasVmapAreaInfo)
1254 {
1255 if (hasDynamicAreaInfo && ddata.floorZ > vdata.floorZ)
1256 useDyn();
1257 else
1258 useVmap();
1259 }
1260 else if (hasDynamicAreaInfo)
1261 {
1262 useDyn();
1263 }
1264
1265 if (hasVmapAreaInfo || hasDynamicAreaInfo)
1266 {
1267 // check if there's terrain between player height and object height
1268 if (GridTerrainData* gmap = const_cast<Map*>(this)->GetGridTerrainData(x, y))
1269 {
1270 float mapHeight = gmap->getHeight(x, y);
1271 // z + 2.0f condition taken from GetHeight(), not sure if it's such a great choice...
1272 if (z + 2.0f > mapHeight && mapHeight > check_z)
1273 return false;
1274 }
1275
1276 return true;
1277 }
1278
1279 return false;
1280}
bool GetAreaAndLiquidData(float x, float y, float z, uint32 phasemask, Optional< uint8 > reqLiquidType, VMAP::AreaAndLiquidData &data) const
Definition DynamicTree.cpp:292
bool GetAreaAndLiquidData(float x, float y, float z, Optional< uint8 > reqLiquidType, VMAP::AreaAndLiquidData &data) const
Definition MapCollisionData.cpp:136
Definition IVMapMgr.h:54
Optional< AreaInfo > areaInfo
Definition IVMapMgr.h:77
float floorZ
Definition IVMapMgr.h:76

References _mapCollisionData, VMAP::AreaAndLiquidData::areaInfo, VMAP::AreaAndLiquidData::floorZ, StaticVMapCollisionData::GetAreaAndLiquidData(), DynamicMapTree::GetAreaAndLiquidData(), MapCollisionData::GetDynamicTree(), GetGridTerrainData(), and MapCollisionData::GetStaticTree().

Referenced by GetAreaId(), and IsInsideWMOGroups().

◆ GetCorpse()

Corpse * Map::GetCorpse ( ObjectGuid const &  guid)
2438{
2439 return _objectsStore.Find<Corpse>(guid);
2440}
MapStoredObjectTypesContainer _objectsStore
Definition Map.h:696
SPECIFIC_TYPE * Find(KEY_TYPE const &handle)
Definition TypeContainer.h:189

References _objectsStore, and TypeUnorderedMapContainer< OBJECT_TYPES, KEY_TYPE >::Find().

Referenced by ObjectAccessor::GetCorpse(), and ScriptsProcess().

◆ GetCorpseByPlayer()

Corpse * Map::GetCorpseByPlayer ( ObjectGuid const &  ownerGuid) const
inline
376 {
377 auto itr = _corpsesByPlayer.find(ownerGuid);
378 if (itr != _corpsesByPlayer.end())
379 return itr->second;
380
381 return nullptr;
382 }

References _corpsesByPlayer.

Referenced by ConvertCorpseToBones(), Player::GetCorpse(), and WorldSession::HandleMoveWorldportAck().

◆ GetCorpsesInGrid()

std::unordered_set< Corpse * > const * Map::GetCorpsesInGrid ( uint32  gridId) const
inline
367 {
368 auto itr = _corpsesByGrid.find(gridId);
369 if (itr != _corpsesByGrid.end())
370 return &itr->second;
371
372 return nullptr;
373 }

References _corpsesByGrid.

Referenced by GridObjectLoader::LoadAllCellsInGrid().

◆ GetCreatedCellsInGridCount()

uint32 Map::GetCreatedCellsInGridCount ( uint16 const  x,
uint16 const  y 
)
3598{
3600}
uint32 GetCreatedCellsInGridCount(uint16 const x, uint16 const y)
Definition MapGridManager.cpp:106

References _mapGridManager, and MapGridManager::GetCreatedCellsInGridCount().

Referenced by debug_commandscript::HandleDebugMapDataCommand().

◆ GetCreatedCellsInMapCount()

uint32 Map::GetCreatedCellsInMapCount ( )
3603{
3605}
uint32 GetCreatedCellsInMapCount()
Definition MapGridManager.cpp:115

References _mapGridManager, and MapGridManager::GetCreatedCellsInMapCount().

Referenced by debug_commandscript::HandleDebugMapDataCommand().

◆ GetCreatedGridsCount()

uint32 Map::GetCreatedGridsCount ( )
3588{
3590}
uint32 GetCreatedGridsCount()
Definition MapGridManager.cpp:96

References _mapGridManager, and MapGridManager::GetCreatedGridsCount().

Referenced by debug_commandscript::HandleDebugMapDataCommand().

◆ GetCreature()

Creature * Map::GetCreature ( ObjectGuid const &  guid)
2443{
2444 return _objectsStore.Find<Creature>(guid);
2445}

References _objectsStore, and TypeUnorderedMapContainer< OBJECT_TYPES, KEY_TYPE >::Find().

Referenced by Battleground::_ProcessResurrect(), instance_blood_furnace::instance_blood_furnace_InstanceMapScript::ActivatePrisoners(), boss_tyrannus::boss_tyrannusAI::boss_tyrannusAI(), instance_ruins_of_ahnqiraj::instance_ruins_of_ahnqiraj_InstanceMapScript::CallNextRajaxxLeader(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::CheckAchievementCriteriaMeet(), spell_sha_fire_nova::CheckFireTotem(), instance_molten_core::CheckMajordomoExecutus(), boss_prince_valanar_icc::boss_prince_valanarAI::CheckRoom(), instance_blackrock_depths::CheckTombReset(), instance_stratholme::instance_stratholme_InstanceMapScript::CheckZiggurats(), instance_the_black_morass::instance_the_black_morass_InstanceMapScript::CleanupInstance(), instance_ulduar::instance_ulduar_InstanceMapScript::DespawnLeviathanGauntlet(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::DespawnSaurfangZeppelinPassenger(), instance_molten_core::DoAction(), boss_ayamiss::DoAction(), npc_vh_void_sentry::DoAction(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::DoAction(), boss_black_knight::boss_black_knightAI::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), InstanceScript::DoCastSpellOnPlayer(), WorldSession::DoLootRelease(), InstanceScript::DoRespawnCreature(), InstanceScript::DoRespawnCreature(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::DoSummonGrandChampion(), instance_blackrock_spire::Dragonspireroomcheck(), Spell::EffectDestroyAllTotems(), boss_tyrannus::boss_tyrannusAI::EnterEvadeMode(), BattlegroundEY::EventTeamCapturedPoint(), boss_erekem::ExecuteEvent(), boss_xevozz::ExecuteEvent(), WorldState::GetActiveZones(), Battleground::GetBGCreature(), boss_erekem::GetChainHealTargetGuid(), Battlefield::GetCreature(), InstanceScript::GetCreature(), ObjectAccessor::GetCreature(), npc_ranshalla::npc_ranshallaAI::GetSpeakerByEntry(), SmartScript::GetTargets(), WorldState::HandleActiveZone(), WorldSession::HandleAreaSpiritHealerQueryOpcode(), WorldSession::HandleAreaSpiritHealerQueueOpcode(), WorldSession::HandleAutostoreLootItemOpcode(), WorldSession::HandleBattlemasterHelloOpcode(), WorldSession::HandleBattlemasterJoinArena(), BattlegroundIC::HandleCapturedNodes(), BattlegroundIC::HandleContestedNodes(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::HandleDropAttempt(), spell_sha_fire_nova::HandleDummy(), WorldSession::HandleLootMasterGiveOpcode(), WorldSession::HandleLootMoneyOpcode(), instance_forge_of_souls::instance_forge_of_souls_InstanceScript::HandleOutro(), spell_sha_stoneclaw_totem::HandleScriptEffect(), WorldSession::HandleTotemDestroyed(), instance_halls_of_reflection::HandleWaveWipe(), wp_commandscript::HandleWpModifyCommand(), wp_commandscript::HandleWpShowCommand(), TempSummon::InitStats(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::InstanceCleanup(), instance_violet_hold::instance_violet_hold_InstanceMapScript::InstanceCleanup(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::InstanceCleanup(), instance_magtheridons_lair::instance_magtheridons_lair_InstanceMapScript::IsAnyChannelerAlive(), Unit::isAttackingPlayer(), instance_ulduar::instance_ulduar_InstanceMapScript::IsEncounterInProgress(), instance_zulfarrak::instance_zulfarrak_InstanceMapScript::IsWaveAllDead(), npc_ranshalla::npc_ranshallaAI::JustDidDialogueStep(), boss_rajaxx::JustDied(), boss_jormungarAI::JustDied(), boss_skarvald_the_constructor::JustDied(), boss_dalronn_the_controller::JustDied(), npc_vh_void_sentry::JustDied(), boss_anubarak_trial::boss_anubarak_trialAI::JustEngagedWith(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::JustEngagedWith(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustEngagedWith(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustEngagedWith(), boss_skarvald_the_constructor::JustEngagedWith(), boss_dalronn_the_controller::JustEngagedWith(), boss_erekem::JustEngagedWith(), instance_nexus::instance_nexus_InstanceMapScript::KillAllFrayers(), Player::KilledMonsterCredit(), boss_professor_putricide::boss_professor_putricideAI::MovementInform(), npc_hor_lich_king::MovementInform(), instance_zulfarrak::instance_zulfarrak_InstanceMapScript::MoveNPCIfAlive(), BattlegroundAB::NodeOccupied(), npc_pos_leader_second::npc_pos_leader_secondAI::npc_pos_leader_secondAI(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::npc_pos_martin_or_gorkun_secondAI(), instance_blackwing_lair::OnCreatureCreate(), instance_shadowfang_keep::instance_shadowfang_keep_InstanceMapScript::OnCreatureCreate(), instance_ruby_sanctum::instance_ruby_sanctum_InstanceMapScript::OnCreatureCreate(), instance_pit_of_saron::instance_pit_of_saron_InstanceScript::OnCreatureCreate(), instance_magtheridons_lair::instance_magtheridons_lair_InstanceMapScript::OnCreatureEvade(), WorldState::OnDisable(), WorldState::OnDisable(), instance_molten_core::OnGameObjectCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnGameObjectCreate(), instance_ruby_sanctum::instance_ruby_sanctum_InstanceMapScript::OnPlayerEnter(), instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::OnPlayerEnter(), instance_forge_of_souls::instance_forge_of_souls_InstanceScript::OnPlayerEnter(), instance_pit_of_saron::instance_pit_of_saron_InstanceScript::OnPlayerEnter(), instance_blackrock_depths::OnUnitDeath(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnUnitDeath(), instance_azjol_nerub::instance_azjol_nerub_InstanceScript::OnUnitDeath(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnUnitDeath(), instance_halls_of_stone::instance_halls_of_stone_InstanceMapScript::OnUnitDeath(), instance_magtheridons_lair::instance_magtheridons_lair_InstanceMapScript::OnUnitDeath(), instance_ulduar::instance_ulduar_InstanceMapScript::PlayBrannRhydianLine(), BattlegroundAV::PopulateNode(), BattlegroundIC::PostUpdateImpl(), BattlegroundRV::PostUpdateImpl(), instance_blackrock_spire::ProcessEvent(), instance_stratholme::instance_stratholme_InstanceMapScript::ProcessSlaughterEvent(), instance_halls_of_reflection::RandomizeCompositionsAndShow(), instance_zulgurub::instance_zulgurub_InstanceMapScript::RemoveHakkarPowerStack(), instance_blackrock_depths::ReplaceMoiraIfSaved(), instance_zulaman::instance_zulaman_InstanceMapScript::ResetAkilzonGauntlet(), instance_blood_furnace::instance_blood_furnace_InstanceMapScript::ResetPrisoners(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::RestoreHiddenSaurfangEventNpcs(), ScheduleCreatureRespawn(), ScriptsProcess(), instance_zulfarrak::instance_zulfarrak_InstanceMapScript::SendAddsUpStairs(), Player::SendLoot(), Group::SendPendingRollsToPlayer(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SendSaurfangCampWorkerOut(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SendSaurfangCampWorkersBack(), instance_molten_core::SetBossState(), instance_magtheridons_lair::instance_magtheridons_lair_InstanceMapScript::SetBossState(), instance_blackrock_spire::SetBossState(), instance_blackwing_lair::SetBossState(), instance_the_black_morass::instance_the_black_morass_InstanceMapScript::SetBossState(), instance_ruby_sanctum::instance_ruby_sanctum_InstanceMapScript::SetBossState(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SetBossState(), instance_black_temple::instance_black_temple_InstanceMapScript::SetBossState(), instance_blackrock_depths::SetData(), instance_blackrock_spire::SetData(), instance_blackwing_lair::SetData(), instance_karazhan::instance_karazhan_InstanceMapScript::SetData(), instance_scarlet_monastery::instance_scarlet_monastery_InstanceMapScript::SetData(), instance_scholomance::instance_scholomance_InstanceMapScript::SetData(), instance_shadowfang_keep::instance_shadowfang_keep_InstanceMapScript::SetData(), instance_stratholme::instance_stratholme_InstanceMapScript::SetData(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::SetData(), instance_hyjal::instance_mount_hyjal_InstanceMapScript::SetData(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::SetData(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::SetData(), instance_dire_maul::instance_dire_maul_InstanceMapScript::SetData(), instance_wailing_caverns::instance_wailing_caverns_InstanceMapScript::SetData(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::SetData(), instance_halls_of_reflection::SetData(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SetData(), instance_oculus::instance_oculus_InstanceMapScript::SetData(), instance_halls_of_stone::instance_halls_of_stone_InstanceMapScript::SetData(), instance_utgarde_keep::instance_utgarde_keep_InstanceMapScript::SetData(), instance_utgarde_pinnacle::instance_utgarde_pinnacle_InstanceMapScript::SetData(), instance_magtheridons_lair::instance_magtheridons_lair_InstanceMapScript::SetData(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::SetData(), Unit::SetPhaseMask(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SetSaurfangCampWorkerWorking(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::SpawnAnubArak(), instance_ulduar::instance_ulduar_InstanceMapScript::SpawnLeviathanEncounterVehicles(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SpawnSaurfangEventNpcs(), instance_zulaman::instance_zulaman_InstanceMapScript::StartAkilzonGauntlet(), instance_violet_hold::instance_violet_hold_InstanceMapScript::StartBossEncounter(), instance_ulduar::instance_ulduar_InstanceMapScript::StartLeviathanOutroSequence(), instance_halls_of_reflection::StartNextWave(), instance_molten_core::SummonMajordomoExecutus(), WorldState::SummonMouth(), WorldState::SummonPallid(), instance_blackrock_spire::SummonSolakarWave(), instance_blackrock_depths::TombOfSevenEvent(), instance_blackrock_depths::TombOfSevenReset(), instance_ulduar::instance_ulduar_InstanceMapScript::UnlockLeviathanVehicles(), instance_blackwing_lair::Update(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::Update(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::Update(), instance_zulfarrak::instance_zulfarrak_InstanceMapScript::Update(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::Update(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::Update(), instance_halls_of_reflection::Update(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::Update(), instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::Update(), instance_violet_hold::instance_violet_hold_InstanceMapScript::Update(), instance_shattered_halls::instance_shattered_halls_InstanceMapScript::Update(), boss_vaelastrasz::UpdateAI(), boss_black_knight::boss_black_knightAI::UpdateAI(), npc_hor_lich_king::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), npc_pos_after_first_boss::npc_pos_after_first_bossAI::UpdateAI(), npc_pos_tyrannus_events::npc_pos_tyrannus_eventsAI::UpdateAI(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::UpdateAI(), npc_pos_leader_second::npc_pos_leader_secondAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), npc_vh_teleportation_portal::UpdateAI(), and instance_eye_of_eternity::VortexHandling().

◆ GetCreatureBySpawnIdStore()

◆ GetCreatureRespawnTime()

time_t Map::GetCreatureRespawnTime ( ObjectGuid::LowType  dbGuid) const
inline
417 {
418 std::unordered_map<ObjectGuid::LowType /*dbGUID*/, time_t>::const_iterator itr = _creatureRespawnTimes.find(dbGuid);
419 if (itr != _creatureRespawnTimes.end())
420 return itr->second;
421
422 return time_t(0);
423 }

References _creatureRespawnTimes.

Referenced by MotionTransport::CreateNPCPassenger(), GetLinkedRespawnTime(), GetRespawnTime(), misc_commandscript::HandleRespawnCreatureByGuidCommand(), Creature::LoadCreatureFromDB(), and CreatureGroup::RespawnRemovedMembers().

◆ GetCreatureRespawnTimes()

◆ GetDebugInfo()

std::string Map::GetDebugInfo ( ) const
virtual

Reimplemented in InstanceMap.

3579{
3580 std::stringstream sstr;
3581 sstr << std::boolalpha
3582 << "Id: " << GetId() << " InstanceId: " << GetInstanceId() << " Difficulty: " << std::to_string(GetDifficulty())
3583 << " HasPlayers: " << HavePlayers();
3584 return sstr.str();
3585}
bool HavePlayers() const
Definition Map.h:324
Difficulty GetDifficulty() const
Definition Map.h:294

References GetDifficulty(), GetId(), GetInstanceId(), and HavePlayers().

Referenced by InstanceMap::GetDebugInfo().

◆ GetDifficulty()

◆ GetDynamicMapTree()

DynamicMapTree const & Map::GetDynamicMapTree ( ) const
inline

◆ GetDynamicObject()

DynamicObject * Map::GetDynamicObject ( ObjectGuid const &  guid)
2467{
2468 return _objectsStore.Find<DynamicObject>(guid);
2469}
Definition DynamicObject.h:35

References _objectsStore, and TypeUnorderedMapContainer< OBJECT_TYPES, KEY_TYPE >::Find().

Referenced by ObjectAccessor::GetDynamicObject().

◆ GetEntrancePos()

bool Map::GetEntrancePos ( int32 &  mapid,
float &  x,
float &  y 
)
inline
311 {
312 if (!i_mapEntry)
313 return false;
314 return i_mapEntry->GetEntrancePos(mapid, x, y);
315 }
bool GetEntrancePos(int32 &mapid, float &x, float &y) const
Definition DBCStructure.h:1396

References MapEntry::GetEntrancePos(), and i_mapEntry.

◆ GetEntry()

◆ GetFullTerrainStatusForPosition()

void Map::GetFullTerrainStatusForPosition ( uint32  phaseMask,
float  x,
float  y,
float  z,
float  collisionHeight,
PositionFullTerrainStatus &  data,
Optional< uint8 >  reqLiquidType = {} 
)
1420{
1421 GridTerrainData* gmap = GetGridTerrainData(x, y);
1422
1423 VMAP::AreaAndLiquidData vmapData;
1425 VMAP::AreaAndLiquidData* wmoData = nullptr;
1426 _mapCollisionData.GetStaticTree().GetAreaAndLiquidData(x, y, z, reqLiquidType, vmapData);
1427 _mapCollisionData.GetDynamicTree().GetAreaAndLiquidData(x, y, z, phaseMask, reqLiquidType, dynData);
1428
1429 uint32 gridAreaId = 0;
1430 float gridMapHeight = INVALID_HEIGHT;
1431 if (gmap)
1432 {
1433 gridAreaId = gmap->getArea(x, y);
1434 gridMapHeight = gmap->getHeight(x, y);
1435 }
1436
1437 bool useGridLiquid = true;
1438
1439 // floor is the height we are closer to (but only if above)
1441 if (gridMapHeight > INVALID_HEIGHT && G3D::fuzzyGe(z, gridMapHeight - GROUND_HEIGHT_TOLERANCE))
1442 data.floorZ = gridMapHeight;
1443
1444 if (vmapData.floorZ > VMAP_INVALID_HEIGHT && G3D::fuzzyGe(z, vmapData.floorZ - GROUND_HEIGHT_TOLERANCE) &&
1445 (G3D::fuzzyLt(z, gridMapHeight - GROUND_HEIGHT_TOLERANCE) || vmapData.floorZ > gridMapHeight))
1446 {
1447 data.floorZ = vmapData.floorZ;
1448 wmoData = &vmapData;
1449 }
1450
1451 // NOTE: Objects will not detect a case when a wmo providing area/liquid despawns from under them
1452 // but this is fine as these kind of objects are not meant to be spawned and despawned a lot
1453 // example: Lich King platform
1454 if (dynData.floorZ > VMAP_INVALID_HEIGHT && G3D::fuzzyGe(z, dynData.floorZ - GROUND_HEIGHT_TOLERANCE) &&
1455 (G3D::fuzzyLt(z, gridMapHeight - GROUND_HEIGHT_TOLERANCE) || dynData.floorZ > gridMapHeight) &&
1456 (G3D::fuzzyLt(z, vmapData.floorZ - GROUND_HEIGHT_TOLERANCE) || dynData.floorZ > vmapData.floorZ))
1457 {
1458 data.floorZ = dynData.floorZ;
1459 wmoData = &dynData;
1460 }
1461
1462 if (wmoData)
1463 {
1464 if (wmoData->areaInfo)
1465 {
1466 // wmo found
1467 WMOAreaTableEntry const* wmoEntry = GetWMOAreaTableEntryByTripple(wmoData->areaInfo->rootId, wmoData->areaInfo->adtId, wmoData->areaInfo->groupId);
1468 data.outdoors = (wmoData->areaInfo->mogpFlags & 0x8) != 0;
1469 if (wmoEntry)
1470 {
1471 data.areaId = wmoEntry->areaId;
1472 if (wmoEntry->Flags & 4)
1473 data.outdoors = true;
1474 else if (wmoEntry->Flags & 2)
1475 data.outdoors = false;
1476 }
1477
1478 if (!data.areaId)
1479 data.areaId = gridAreaId;
1480
1481 useGridLiquid = !IsInWMOInterior(wmoData->areaInfo->mogpFlags);
1482 }
1483 }
1484 else
1485 {
1486 data.outdoors = true;
1487 data.areaId = gridAreaId;
1488 if (AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(data.areaId))
1489 data.outdoors = (areaEntry->flags & (AREA_FLAG_INSIDE | AREA_FLAG_OUTSIDE)) != AREA_FLAG_INSIDE;
1490 }
1491
1492 if (!data.areaId)
1494
1495 AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(data.areaId);
1496
1497 // liquid processing
1498 if (wmoData && wmoData->liquidInfo && wmoData->liquidInfo->level > wmoData->floorZ)
1499 {
1500 uint32 liquidType = wmoData->liquidInfo->type;
1501 if (GetId() == MAP_OUTLAND && liquidType == 2) // gotta love blizzard hacks
1502 liquidType = 15;
1503
1504 uint32 liquidFlagType = 0;
1505 if (LiquidTypeEntry const* liquidData = sLiquidTypeStore.LookupEntry(liquidType))
1506 liquidFlagType = liquidData->Type;
1507
1508 if (liquidType && liquidType < 21 && areaEntry)
1509 {
1510 uint32 overrideLiquid = areaEntry->LiquidTypeOverride[liquidFlagType];
1511 if (!overrideLiquid && areaEntry->zone)
1512 {
1513 AreaTableEntry const* zoneEntry = sAreaTableStore.LookupEntry(areaEntry->zone);
1514 if (zoneEntry)
1515 overrideLiquid = zoneEntry->LiquidTypeOverride[liquidFlagType];
1516 }
1517
1518 if (LiquidTypeEntry const* overrideData = sLiquidTypeStore.LookupEntry(overrideLiquid))
1519 {
1520 liquidType = overrideLiquid;
1521 liquidFlagType = overrideData->Type;
1522 }
1523 }
1524
1525 data.liquidInfo.Level = wmoData->liquidInfo->level;
1526 data.liquidInfo.DepthLevel = wmoData->floorZ;
1527 data.liquidInfo.Entry = liquidType;
1528 data.liquidInfo.Flags = 1 << liquidFlagType;
1529
1530 // Get position delta
1531 float delta = wmoData->liquidInfo->level - z;
1532
1533 if (delta > collisionHeight)
1535 else if (delta > 0.0f)
1537 else if (delta > -0.1f)
1539 else
1541 }
1542
1543 // look up liquid data from grid map
1544 if (gmap && useGridLiquid)
1545 {
1546 LiquidData const& gridLiquidData = gmap->GetLiquidData(x, y, z, collisionHeight, reqLiquidType);
1547 if (gridLiquidData.Status != LIQUID_MAP_NO_WATER && (!wmoData || gridLiquidData.Level > wmoData->floorZ))
1548 {
1549 uint32 liquidEntry = gridLiquidData.Entry;
1550 if (GetId() == MAP_OUTLAND && liquidEntry == 2)
1551 liquidEntry = 15;
1552
1553 data.liquidInfo = gridLiquidData;
1554 data.liquidInfo.Entry = liquidEntry;
1555 }
1556 }
1557}
@ MAP_OUTLAND
Definition AreaDefines.h:219
@ AREA_FLAG_OUTSIDE
Definition DBCEnums.h:260
@ AREA_FLAG_INSIDE
Definition DBCEnums.h:259
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTableEntryfmt)
DBCStorage< LiquidTypeEntry > sLiquidTypeStore(LiquidTypefmt)
@ LIQUID_MAP_UNDER_WATER
Definition GridTerrainData.h:195
@ LIQUID_MAP_NO_WATER
Definition GridTerrainData.h:191
@ LIQUID_MAP_IN_WATER
Definition GridTerrainData.h:194
@ LIQUID_MAP_ABOVE_WATER
Definition GridTerrainData.h:192
@ LIQUID_MAP_WATER_WALK
Definition GridTerrainData.h:193
#define VMAP_INVALID_HEIGHT
Definition IVMapMgr.h:50
static bool IsInWMOInterior(uint32 mogpFlags)
Definition Map.cpp:1238
LiquidData const GetLiquidData(float x, float y, float z, float collisionHeight, Optional< uint8 > ReqLiquidType) const
Definition GridTerrainData.cpp:530
float getHeight(float x, float y) const
Definition GridTerrainData.h:249
uint16 getArea(float x, float y) const
Definition GridTerrainData.cpp:214
Definition DBCStructure.h:519
uint32 zone
Definition DBCStructure.h:522
uint32 LiquidTypeOverride[4]
Definition DBCStructure.h:530
Definition GridTerrainData.h:199
float Level
Definition GridTerrainData.h:204
uint32 Flags
Definition GridTerrainData.h:203
uint32 Entry
Definition GridTerrainData.h:202
LiquidStatus Status
Definition GridTerrainData.h:206
float DepthLevel
Definition GridTerrainData.h:205
Definition DBCStructure.h:1319
float floorZ
Definition Map.h:102
uint32 areaId
Definition Map.h:101
LiquidData liquidInfo
Definition Map.h:104
bool outdoors
Definition Map.h:103
Optional< LiquidInfo > liquidInfo
Definition IVMapMgr.h:78
uint32 Flags
Definition DBCStructure.h:2177
uint32 areaId
Definition DBCStructure.h:2178

References _mapCollisionData, AREA_FLAG_INSIDE, AREA_FLAG_OUTSIDE, PositionFullTerrainStatus::areaId, WMOAreaTableEntry::areaId, VMAP::AreaAndLiquidData::areaInfo, LiquidData::DepthLevel, LiquidData::Entry, LiquidData::Flags, WMOAreaTableEntry::Flags, VMAP::AreaAndLiquidData::floorZ, PositionFullTerrainStatus::floorZ, GridTerrainData::getArea(), StaticVMapCollisionData::GetAreaAndLiquidData(), DynamicMapTree::GetAreaAndLiquidData(), MapCollisionData::GetDynamicTree(), GetGridTerrainData(), GridTerrainData::getHeight(), GetId(), GridTerrainData::GetLiquidData(), MapCollisionData::GetStaticTree(), GetWMOAreaTableEntryByTripple(), GROUND_HEIGHT_TOLERANCE, i_mapEntry, INVALID_HEIGHT, IsInWMOInterior(), LiquidData::Level, MapEntry::linked_zone, LIQUID_MAP_ABOVE_WATER, LIQUID_MAP_IN_WATER, LIQUID_MAP_NO_WATER, LIQUID_MAP_UNDER_WATER, LIQUID_MAP_WATER_WALK, VMAP::AreaAndLiquidData::liquidInfo, PositionFullTerrainStatus::liquidInfo, AreaTableEntry::LiquidTypeOverride, MAP_OUTLAND, PositionFullTerrainStatus::outdoors, sAreaTableStore, sLiquidTypeStore, LiquidData::Status, VMAP_INVALID_HEIGHT, and AreaTableEntry::zone.

Referenced by Creature::Create(), and WorldObject::UpdatePositionData().

◆ GetGameObject()

GameObject * Map::GetGameObject ( ObjectGuid const &  guid)
2448{
2449 return _objectsStore.Find<GameObject>(guid);
2450}

References _objectsStore, and TypeUnorderedMapContainer< OBJECT_TYPES, KEY_TYPE >::Find().

Referenced by boss_sjonnir::boss_sjonnirAI::ActivatePipe(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::ActivateSaurfangCampTeleporters(), Spell::CheckCast(), Player::CheckDuelDistance(), Spell::CheckEffectTarget(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::CheckLichKingAvailability(), instance_stratholme::instance_stratholme_InstanceMapScript::CheckZiggurats(), instance_ulduar::instance_ulduar_InstanceMapScript::DespawnLeviathanGauntlet(), instance_obsidian_sanctum::instance_obsidian_sanctum_InstanceMapScript::DoAction(), Spell::DoAllEffectOnTarget(), npc_rocknot::DoGo(), WorldSession::DoLootRelease(), InstanceScript::DoRespawnGameObject(), InstanceScript::DoRespawnGameObject(), InstanceScript::DoUseDoorOrButton(), instance_blackrock_spire::Dragonspireroomcheck(), instance_blackrock_spire::Dragonspireroomstore(), Player::DuelComplete(), Spell::EffectSummonObject(), Battleground::GetBGObject(), Battlefield::GetGameObject(), InstanceScript::GetGameObject(), ObjectAccessor::GetGameObject(), Player::GetNextQuest(), BattlegroundRV::GetPillarAtPosition(), GetTransport(), WorldSession::HandleAutostoreLootItemOpcode(), InstanceScript::HandleGameObject(), WorldSession::HandleGameobjectReportUse(), WorldSession::HandleGossipSelectOptionOpcode(), WorldSession::HandleLootMasterGiveOpcode(), WorldSession::HandleLootMoneyOpcode(), WorldSession::HandleMoverRelocation(), boss_urok_doomhowl::InitializeAI(), instance_violet_hold::instance_violet_hold_InstanceMapScript::InstanceCleanup(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::InstanceCleanup(), npc_ranshalla::npc_ranshallaAI::JustDidDialogueStep(), boss_rend_blackhand::JustDied(), boss_shade_of_aran::JustDied(), npc_gunship::npc_gunshipAI::JustDied(), boss_sjonnir::boss_sjonnirAI::JustDied(), boss_shade_of_aran::JustEngagedWith(), boss_sjonnir::boss_sjonnirAI::JustEngagedWith(), instance_temple_of_ahnqiraj::instance_temple_of_ahnqiraj_InstanceMapScript::OnCreatureCreate(), instance_temple_of_ahnqiraj::instance_temple_of_ahnqiraj_InstanceMapScript::OnUnitDeath(), boss_pyroguard_emberseer::OpenDoors(), Player::PrepareQuestMenu(), instance_blackrock_spire::ProcessEvent(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::ProcessEvent(), instance_stratholme::instance_stratholme_InstanceMapScript::ProcessSlaughterEvent(), boss_sartharion_dragonAI::RemoveTwilightPortal(), boss_rend_blackhand::Reset(), boss_shade_of_aran::Reset(), boss_sjonnir::boss_sjonnirAI::Reset(), boss_palehoof::boss_palehoofAI::Reset(), ScriptsProcess(), Player::SendLoot(), instance_molten_core::SetBossState(), instance_magtheridons_lair::instance_magtheridons_lair_InstanceMapScript::SetBossState(), instance_blackwing_lair::SetBossState(), instance_gundrak::instance_gundrak_InstanceMapScript::SetBossState(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SetBossState(), instance_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript::SetBossState(), instance_hellfire_ramparts::instance_hellfire_ramparts_InstanceMapScript::SetBossState(), instance_blackrock_depths::SetData(), instance_blackrock_spire::SetData(), instance_scarlet_monastery::instance_scarlet_monastery_InstanceMapScript::SetData(), instance_scholomance::instance_scholomance_InstanceMapScript::SetData(), instance_stratholme::instance_stratholme_InstanceMapScript::SetData(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::SetData(), instance_hyjal::instance_mount_hyjal_InstanceMapScript::SetData(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::SetData(), instance_pit_of_saron::instance_pit_of_saron_InstanceScript::SetData(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SetData(), instance_oculus::instance_oculus_InstanceMapScript::SetData(), instance_halls_of_stone::instance_halls_of_stone_InstanceMapScript::SetData(), instance_ulduar::instance_ulduar_InstanceMapScript::SetData(), instance_magtheridons_lair::instance_magtheridons_lair_InstanceMapScript::SetData(), instance_gundrak::instance_gundrak_InstanceMapScript::SetData(), instance_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript::SetData(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::SetData(), boss_pyroguard_emberseer::SetData(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SpawnSaurfangCampTents(), boss_rend_blackhand::SummonWave(), brann_bronzebeard::SwitchHeadVisual(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::Update(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::Update(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::Update(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::Update(), instance_violet_hold::instance_violet_hold_InstanceMapScript::Update(), boss_rend_blackhand::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_pos_leader_second::npc_pos_leader_secondAI::UpdateAI(), boss_freya_nature_bomb::UpdateAI(), npc_pet_gen_plump_turkey::UpdateAI(), BattlegroundRV::UpdatePillars(), boss_pyroguard_emberseer::UpdateRunes(), npc_ranshalla::npc_ranshallaAI::WaypointReached(), and npc_arthas::npc_arthasAI::WaypointReached().

◆ GetGameObjectBySpawnIdStore()

◆ GetGameObjectFloor()

float Map::GetGameObjectFloor ( uint32  phasemask,
float  x,
float  y,
float  z,
float  maxSearchDist = DEFAULT_HEIGHT_SEARCH 
) const
inline
409 {
410 return _mapCollisionData.GetDynamicTree().getHeight(x, y, z, maxSearchDist, phasemask);
411 }
float getHeight(float x, float y, float z, float maxSearchDist, uint32 phasemask) const
Definition DynamicTree.cpp:275

References _mapCollisionData, MapCollisionData::GetDynamicTree(), and DynamicMapTree::getHeight().

◆ GetGORespawnTime()

time_t Map::GetGORespawnTime ( ObjectGuid::LowType  dbGuid) const
inline
426 {
427 std::unordered_map<ObjectGuid::LowType /*dbGUID*/, time_t>::const_iterator itr = _goRespawnTimes.find(dbGuid);
428 if (itr != _goRespawnTimes.end())
429 return itr->second;
430
431 return time_t(0);
432 }

References _goRespawnTimes.

Referenced by MotionTransport::CreateGOPassenger(), GetLinkedRespawnTime(), GetRespawnTime(), misc_commandscript::HandleRespawnGameObjectByGuidCommand(), and GameObject::LoadGameObjectFromDB().

◆ GetGORespawnTimes()

◆ GetGridHeight()

float Map::GetGridHeight ( float  x,
float  y 
) const
1223{
1224 if (GridTerrainData* gmap = const_cast<Map*>(this)->GetGridTerrainData(x, y))
1225 return gmap->getHeight(x, y);
1226
1227 return INVALID_HEIGHT;
1228}

References GetGridTerrainData(), and INVALID_HEIGHT.

Referenced by CheckCollisionAndGetValidCoords(), and GetHeight().

◆ GetGridTerrainData() [1/2]

GridTerrainData * Map::GetGridTerrainData ( float  x,
float  y 
)
1135{
1136 GridCoord const gridCoord = Acore::ComputeGridCoord(x, y);
1137 return GetGridTerrainData(gridCoord);
1138}

References Acore::ComputeGridCoord(), and GetGridTerrainData().

◆ GetGridTerrainData() [2/2]

GridTerrainData * Map::GetGridTerrainData ( GridCoord const &  gridCoord)
1125{
1126 if (!MapGridManager::IsValidGridCoordinates(gridCoord.x_coord, gridCoord.y_coord))
1127 return nullptr;
1128
1129 // ensure GridMap is created
1130 EnsureGridCreated(gridCoord);
1131 return _mapGridManager.GetGrid(gridCoord.x_coord, gridCoord.y_coord)->GetTerrainData();
1132}
MapGridType * GetGrid(uint16 const x, uint16 const y)
Definition MapGridManager.cpp:88
static bool IsValidGridCoordinates(uint16 const x, uint16 const y)
Definition MapGridManager.h:42
GridTerrainData * GetTerrainData() const
Definition MapGrid.h:101

References _mapGridManager, EnsureGridCreated(), MapGridManager::GetGrid(), MapGrid< GRID_OBJECT_TYPES, FAR_VISIBLE_OBJECT_TYPES >::GetTerrainData(), MapGridManager::IsValidGridCoordinates(), CoordPair< LIMIT >::x_coord, and CoordPair< LIMIT >::y_coord.

Referenced by GetAreaId(), GetAreaInfo(), GetFullTerrainStatusForPosition(), GetGridHeight(), GetGridTerrainData(), GetLiquidData(), GetMinHeight(), and GetWaterLevel().

◆ GetGridTerrainDataSharedPtr()

std::shared_ptr< GridTerrainData > Map::GetGridTerrainDataSharedPtr ( GridCoord const &  gridCoord)
1118{
1119 MapGridType* grid = _mapGridManager.GetGrid(gridCoord.x_coord, gridCoord.y_coord);
1120 ASSERT(grid); // Grid should always exist during this call
1121 return grid->GetTerrainDataSharedPtr();
1122}
std::shared_ptr< GridTerrainData > GetTerrainDataSharedPtr()
Definition MapGrid.h:102

References _mapGridManager, ASSERT, MapGridManager::GetGrid(), MapGrid< GRID_OBJECT_TYPES, FAR_VISIBLE_OBJECT_TYPES >::GetTerrainDataSharedPtr(), CoordPair< LIMIT >::x_coord, and CoordPair< LIMIT >::y_coord.

Referenced by GridTerrainLoader::LoadMap().

◆ GetGuidSequenceGenerator()

template<HighGuid high>
ObjectGuidGeneratorBase & Map::GetGuidSequenceGenerator ( )
inlineprivate
687 {
688 auto itr = _guidGenerators.find(high);
689 if (itr == _guidGenerators.end())
690 itr = _guidGenerators.insert(std::make_pair(high, std::unique_ptr<ObjectGuidGenerator<high>>(new ObjectGuidGenerator<high>()))).first;
691
692 return *itr->second;
693 }
std::map< HighGuid, std::unique_ptr< ObjectGuidGeneratorBase > > _guidGenerators
Definition Map.h:695
Definition ObjectGuid.h:302

References _guidGenerators.

◆ GetHeight() [1/3]

float Map::GetHeight ( float  x,
float  y,
float  z,
bool  checkVMap = true,
float  maxSearchDist = DEFAULT_HEIGHT_SEARCH 
) const
1189{
1190 // find raw .map surface under Z coordinates
1191 float mapHeight = VMAP_INVALID_HEIGHT_VALUE;
1192 float gridHeight = GetGridHeight(x, y);
1193 if (G3D::fuzzyGe(z, gridHeight - GROUND_HEIGHT_TOLERANCE))
1194 mapHeight = gridHeight;
1195
1196 float vmapHeight = VMAP_INVALID_HEIGHT_VALUE;
1197 if (checkVMap)
1198 vmapHeight = _mapCollisionData.GetStaticTree().getHeight(x, y, z, maxSearchDist); // look from a bit higher pos to find the floor
1199
1200 // mapHeight set for any above raw ground Z or <= INVALID_HEIGHT
1201 // vmapheight set for any under Z value or <= INVALID_HEIGHT
1202 if (vmapHeight > INVALID_HEIGHT)
1203 {
1204 if (mapHeight > INVALID_HEIGHT)
1205 {
1206 // we have mapheight and vmapheight and must select more appropriate
1207
1208 // we are already under the surface or vmap height above map heigt
1209 // or if the distance of the vmap height is less the land height distance
1210 if (vmapHeight > mapHeight || std::fabs(mapHeight - z) > std::fabs(vmapHeight - z))
1211 return vmapHeight;
1212 else
1213 return mapHeight; // better use .map surface height
1214 }
1215 else
1216 return vmapHeight; // we have only vmapHeight (if have)
1217 }
1218
1219 return mapHeight; // explicitly use map data
1220}
float getHeight(float x, float y, float z, float maxSearchDist) const
Definition MapCollisionData.cpp:116

References _mapCollisionData, GetGridHeight(), StaticVMapCollisionData::getHeight(), MapCollisionData::GetStaticTree(), GROUND_HEIGHT_TOLERANCE, INVALID_HEIGHT, and VMAP_INVALID_HEIGHT_VALUE.

Referenced by BattlegroundRV::CheckPositionForUnit(), boss_ick::boss_ickAI::DamageTaken(), GetHeight(), WorldObject::GetMapHeight(), GetTransportForPos(), GetWaterOrGroundLevel(), go_commandscript::HandleGoGridCommand(), go_commandscript::HandleGoXYZCommand(), go_commandscript::HandleGoZoneXYCommand(), spell_winter_veil_racer_rocket_slam::HandleTriggerSpell(), spell_svalna_revive_champion::Land(), Creature::LoadCreatureFromDB(), spell_mimiron_magnetic_core_summon::ModDest(), MotionMaster::MoveCirclePath(), Spell::SelectImplicitCasterDestTargets(), boss_yoggsaron_sara::SpawnTentacle(), boss_yoggsaron_death_ray::UpdateAI(), and npc_cork_gizelton::npc_cork_gizeltonAI::WaypointReached().

◆ GetHeight() [2/3]

float Map::GetHeight ( Position const &  pos,
bool  checkVMap = true,
float  maxSearchDist = DEFAULT_HEIGHT_SEARCH 
) const
inline
245{ return GetHeight(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), checkVMap, maxSearchDist); }
float GetHeight(float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
Definition Map.cpp:1188

References GetHeight(), Position::GetPositionX(), Position::GetPositionY(), and Position::GetPositionZ().

Referenced by GetHeight().

◆ GetHeight() [3/3]

float Map::GetHeight ( uint32  phasemask,
float  x,
float  y,
float  z,
bool  vmap = true,
float  maxSearchDist = DEFAULT_HEIGHT_SEARCH 
) const
1608{
1609 float h1, h2;
1610 h1 = GetHeight(x, y, z, vmap, maxSearchDist);
1611 h2 = _mapCollisionData.GetDynamicTree().getHeight(x, y, z, maxSearchDist, phasemask);
1612 return std::max<float>(h1, h2);
1613}

References _mapCollisionData, MapCollisionData::GetDynamicTree(), GetHeight(), and DynamicMapTree::getHeight().

◆ GetId()

uint32 Map::GetId ( ) const
inline
234{ return i_mapEntry->MapID; }
uint32 MapID
Definition DBCStructure.h:1362

References i_mapEntry, and MapEntry::MapID.

Referenced by Group::_cancelHomebindIfInstance(), AddObjectToRemoveList(), InstanceMap::AddPlayerToMap(), WorldState::BroadcastSIWorldstates(), WorldState::BuffAdalsSongOfBattle(), WorldState::BuffMagtheridonTeam(), MapUpdateRequest::call(), MapPreloadRequest::call(), InstanceMap::CannotEnter(), Player::CanRollForItemInLFG(), InstanceScript::CheckAchievementCriteriaMeet(), Spell::CheckCast(), GameObject::Create(), StaticTransport::Create(), MapInstanced::CreateBattleground(), MapInstanced::CreateInstance(), MapInstanced::CreateInstanceForPlayer(), InstanceMap::CreateInstanceScript(), TransportMgr::CreateInstanceTransports(), OPvPCapturePoint::DelCreature(), DeleteCorpseData(), DeleteRespawnTimes(), WorldState::DispelAdalsSongOfBattle(), WorldState::DispelMagtheridonTeam(), CreatureAI::DoZoneInCombat(), GetDebugInfo(), GetFullTerrainStatusForPosition(), GetLiquidData(), GetMapDifficulty(), debug_commandscript::HandleDebugObjectCountMap(), spell_valkyr_touch_aura::HandleEffectPeriodic(), gobject_commandscript::HandleGameObjectAddCommand(), go_commandscript::HandleGoZoneXYCommand(), instance_commandscript::HandleInstanceGetBossStateCommand(), list_commandscript::HandleListRespawnsCommand(), WorldSession::HandleMoveWorldportAck(), npc_commandscript::HandleNpcAddCommand(), WorldSession::HandlePlayerLoginFromDB(), WorldSession::HandlePlayerLoginToCharInWorld(), WorldSession::HandleSetRaidDifficultyOpcode(), wp_commandscript::HandleWpModifyCommand(), wp_commandscript::HandleWpShowCommand(), PoolMgr::InitPoolsForMap(), InitVisibilityDistance(), InstanceMap::InitVisibilityDistance(), Player::inRandomLfgDungeon(), DisableMgr::IsPathfindingEnabled(), InstanceScript::IsTwoFactionInstance(), GridObjectLoader::LoadAllCellsInGrid(), LoadCorpseData(), GridTerrainLoader::LoadMap(), GridTerrainLoader::LoadMMap(), MapCollisionData::LoadMMapTile(), LoadRespawnTimes(), GridTerrainLoader::LoadVMap(), LogEncounterFinished(), MapCollisionData::MapCollisionData(), AchievementCriteriaData::Meets(), MotionMaster::MoveFall(), lfg::LFGPlayerScript::OnPlayerMapChanged(), InstanceMap::PermBindAllPlayers(), RemoveAllPlayers(), RemoveCreatureRespawnTime(), RemoveGORespawnTime(), InstanceMap::Reset(), Player::RewardReputation(), SaveCreatureRespawnTime(), SaveGORespawnTime(), Group::SendPendingRollsToPlayer(), InstanceMap::SendResetWarnings(), World::SetInitialWorldSettings(), WorldObject::SetMap(), Player::SetMover(), SpawnGroupDespawn(), SpawnGroupSpawn(), SummonCreatureGroup(), SummonGameObjectGroup(), MotionTransport::TeleportTransport(), UnloadGrid(), Update(), and UpdateEncounterState().

◆ GetInstanceId()

◆ GetInstanceResetPeriod()

time_t Map::GetInstanceResetPeriod ( ) const
inline

◆ GetLinkedRespawnTime()

time_t Map::GetLinkedRespawnTime ( ObjectGuid  guid) const
3057{
3058 ObjectGuid linkedGuid = sObjectMgr->GetLinkedRespawnGuid(guid);
3059 switch (linkedGuid.GetHigh())
3060 {
3061 case HighGuid::Unit:
3062 return GetCreatureRespawnTime(linkedGuid.GetCounter());
3064 return GetGORespawnTime(linkedGuid.GetCounter());
3065 default:
3066 break;
3067 }
3068
3069 return time_t(0);
3070}
#define sObjectMgr
Definition ObjectMgr.h:1731
time_t GetCreatureRespawnTime(ObjectGuid::LowType dbGuid) const
Definition Map.h:416
time_t GetGORespawnTime(ObjectGuid::LowType dbGuid) const
Definition Map.h:425
Definition ObjectGuid.h:121
HighGuid GetHigh() const
Definition ObjectGuid.h:146

References GameObject, ObjectGuid::GetCounter(), GetCreatureRespawnTime(), GetGORespawnTime(), ObjectGuid::GetHigh(), sObjectMgr, and Unit.

Referenced by ProcessCreatureRespawn(), Creature::Respawn(), and GameObject::Update().

◆ GetLiquidData()

LiquidData const Map::GetLiquidData ( uint32  phaseMask,
float  x,
float  y,
float  z,
float  collisionHeight,
Optional< uint8 >  ReqLiquidType 
)
1337{
1338 LiquidData liquidData;
1339 liquidData.Status = LIQUID_MAP_NO_WATER;
1340
1341 VMAP::AreaAndLiquidData vmapData;
1342 bool useGridLiquid = true;
1343 if (_mapCollisionData.GetStaticTree().GetAreaAndLiquidData(x, y, z, ReqLiquidType, vmapData) && vmapData.liquidInfo)
1344 {
1345 useGridLiquid = !vmapData.areaInfo || !IsInWMOInterior(vmapData.areaInfo->mogpFlags);
1346 LOG_DEBUG("maps", "GetLiquidStatus(): vmap liquid level: {} ground: {} type: {}", vmapData.liquidInfo->level, vmapData.floorZ, vmapData.liquidInfo->type);
1347 // Check water level and ground level
1348 if (vmapData.liquidInfo->level > vmapData.floorZ && G3D::fuzzyGe(z, vmapData.floorZ - GROUND_HEIGHT_TOLERANCE))
1349 {
1350 // hardcoded in client like this
1351 if (GetId() == MAP_OUTLAND && vmapData.liquidInfo->type == 2)
1352 vmapData.liquidInfo->type = 15;
1353
1354 uint32 liquidFlagType = 0;
1355 if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(vmapData.liquidInfo->type))
1356 liquidFlagType = liq->Type;
1357
1358 if (vmapData.liquidInfo->type && vmapData.liquidInfo->type < 21)
1359 {
1360 if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(GetAreaId(phaseMask, x, y, z)))
1361 {
1362 uint32 overrideLiquid = area->LiquidTypeOverride[liquidFlagType];
1363 if (!overrideLiquid && area->zone)
1364 {
1365 area = sAreaTableStore.LookupEntry(area->zone);
1366 if (area)
1367 overrideLiquid = area->LiquidTypeOverride[liquidFlagType];
1368 }
1369
1370 if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(overrideLiquid))
1371 {
1372 vmapData.liquidInfo->type = overrideLiquid;
1373 liquidFlagType = liq->Type;
1374 }
1375 }
1376 }
1377
1378 liquidData.Level = vmapData.liquidInfo->level;
1379 liquidData.DepthLevel = vmapData.floorZ;
1380 liquidData.Entry = vmapData.liquidInfo->type;
1381 liquidData.Flags = 1 << liquidFlagType;
1382 }
1383
1384 float delta = vmapData.liquidInfo->level - z;
1385
1386 // Get position delta
1387 if (delta > collisionHeight)
1388 liquidData.Status = LIQUID_MAP_UNDER_WATER;
1389 else if (delta > 0.0f)
1390 liquidData.Status = LIQUID_MAP_IN_WATER;
1391 else if (delta > -0.1f)
1392 liquidData.Status = LIQUID_MAP_WATER_WALK;
1393 else
1394 liquidData.Status = LIQUID_MAP_ABOVE_WATER;
1395 }
1396
1397 if (useGridLiquid)
1398 {
1399 if (GridTerrainData* gmap = const_cast<Map*>(this)->GetGridTerrainData(x, y))
1400 {
1401 LiquidData const& map_data = gmap->GetLiquidData(x, y, z, collisionHeight, ReqLiquidType);
1402 // Not override LIQUID_MAP_ABOVE_WATER with LIQUID_MAP_NO_WATER:
1403 if (map_data.Status != LIQUID_MAP_NO_WATER && (map_data.Level > vmapData.floorZ))
1404 {
1405 // hardcoded in client like this
1406 uint32 liquidEntry = map_data.Entry;
1407 if (GetId() == MAP_OUTLAND && liquidEntry == 2)
1408 liquidEntry = 15;
1409
1410 liquidData = map_data;
1411 liquidData.Entry = liquidEntry;
1412 }
1413 }
1414 }
1415
1416 return liquidData;
1417}
#define LOG_DEBUG(filterType__,...)
Definition Log.h:157
uint32 GetAreaId(uint32 phaseMask, float x, float y, float z) const
Definition Map.cpp:1282

References _mapCollisionData, VMAP::AreaAndLiquidData::areaInfo, LiquidData::DepthLevel, LiquidData::Entry, LiquidData::Flags, VMAP::AreaAndLiquidData::floorZ, StaticVMapCollisionData::GetAreaAndLiquidData(), GetAreaId(), GetGridTerrainData(), GetId(), MapCollisionData::GetStaticTree(), GROUND_HEIGHT_TOLERANCE, IsInWMOInterior(), LiquidData::Level, LIQUID_MAP_ABOVE_WATER, LIQUID_MAP_IN_WATER, LIQUID_MAP_NO_WATER, LIQUID_MAP_UNDER_WATER, LIQUID_MAP_WATER_WALK, VMAP::AreaAndLiquidData::liquidInfo, LOG_DEBUG, MAP_OUTLAND, sAreaTableStore, sLiquidTypeStore, and LiquidData::Status.

Referenced by PathGenerator::BuildPolyPath(), PathGenerator::GetNavTerrain(), GetWaterOrGroundLevel(), HasEnoughWater(), IsInWater(), IsUnderWater(), Spell::SelectImplicitCasterDestTargets(), and spell_spawn_blood_pool::SetDest().

◆ GetLoadedGridsCount()

uint32 Map::GetLoadedGridsCount ( )
3593{
3595}
uint32 GetLoadedGridsCount()
Definition MapGridManager.cpp:101

References _mapGridManager, and MapGridManager::GetLoadedGridsCount().

Referenced by debug_commandscript::HandleDebugMapDataCommand().

◆ GetMapCollisionData() [1/2]

◆ GetMapCollisionData() [2/2]

MapCollisionData const & Map::GetMapCollisionData ( ) const
inline
574{ return _mapCollisionData; }

References _mapCollisionData.

◆ GetMapDifficulty()

MapDifficulty const * Map::GetMapDifficulty ( ) const
2338{
2340}
MapDifficulty const * GetMapDifficultyData(uint32 mapId, Difficulty difficulty)
Definition DBCStores.cpp:773

References GetDifficulty(), GetId(), and GetMapDifficultyData().

Referenced by InstanceMap::GetMaxPlayers(), and InstanceMap::GetMaxResetDelay().

◆ GetMapGrid()

◆ GetMapName()

char const * Map::GetMapName ( ) const

◆ GetMinHeight()

float Map::GetMinHeight ( float  x,
float  y 
) const
1231{
1232 if (GridTerrainData const* grid = const_cast<Map*>(this)->GetGridTerrainData(x, y))
1233 return grid->getMinHeight(x, y);
1234
1235 return MIN_HEIGHT;
1236}
#define MIN_HEIGHT
Definition GridTerrainData.h:29

References GetGridTerrainData(), and MIN_HEIGHT.

◆ GetObjectsStore()

◆ GetOrGenerateZoneDefaultWeather()

Weather * Map::GetOrGenerateZoneDefaultWeather ( uint32  zoneId)
3304{
3305 WeatherData const* weatherData = WeatherMgr::GetWeatherData(zoneId);
3306 if (!weatherData)
3307 return nullptr;
3308
3309 ZoneDynamicInfo& info = _zoneDynamicInfo[zoneId];
3310
3311 if (!info.DefaultWeather)
3312 {
3313 info.DefaultWeather = std::make_unique<Weather>(this, zoneId, weatherData);
3314 info.DefaultWeather->ReGenerate();
3315 info.DefaultWeather->UpdateWeather();
3316 }
3317
3318 return info.DefaultWeather.get();
3319}
ZoneDynamicInfoMap _zoneDynamicInfo
Definition Map.h:679
WeatherData const * GetWeatherData(uint32 zone_id)
Definition WeatherMgr.cpp:39
Definition Weather.h:40
Definition Map.h:138
std::unique_ptr< Weather > DefaultWeather
Definition Map.h:142

References _zoneDynamicInfo, ZoneDynamicInfo::DefaultWeather, and WeatherMgr::GetWeatherData().

Referenced by misc_commandscript::HandleChangeWeather(), npc_herald_of_the_lich_king::UpdateWeather(), and npc_pallid_horror::UpdateWeather().

◆ GetParent()

Map const * Map::GetParent ( ) const
inline
236{ return m_parentMap; }

References m_parentMap.

Referenced by MapGridManager::CreateGrid(), and GridTerrainLoader::LoadMap().

◆ GetPet()

Pet * Map::GetPet ( ObjectGuid const &  guid)
2453{
2454 return dynamic_cast<Pet*>(_objectsStore.Find<Creature>(guid));
2455}
Definition Pet.h:41

References _objectsStore, and TypeUnorderedMapContainer< OBJECT_TYPES, KEY_TYPE >::Find().

Referenced by ObjectAccessor::GetPet(), and ScriptsProcess().

◆ GetPlayerCountInZone()

uint32 Map::GetPlayerCountInZone ( uint32  zoneId) const
inline
566 {
567 if (auto const& it = _zonePlayerCountMap.find(zoneId); it != _zonePlayerCountMap.end())
568 return it->second;
569
570 return 0;
571 };

References _zonePlayerCountMap.

Referenced by debug_commandscript::HandleDebugZoneStatsCommand().

◆ GetPlayers()

PlayerList const & Map::GetPlayers ( ) const
inline
335{ return m_mapRefMgr; }
MapRefMgr m_mapRefMgr
Definition Map.h:615

References m_mapRefMgr.

Referenced by AddToMap(), MotionTransport::BuildUpdate(), StaticTransport::BuildUpdate(), InstanceMap::CannotEnter(), boss_professor_putricide::boss_professor_putricideAI::ChangePhase(), boss_gothik::boss_gothikAI::CheckGroupSplitted(), boss_volazj::CheckPhaseMinions(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::ChromieWhisper(), npc_arthas::npc_arthasAI::DoAction(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::DoCheckDedicatedInsanity(), boss_algalon_the_observer::DoCheckHeraldOfTheTitans(), DoForAllPlayers(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::DoNeedCleanup(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::DoNeedCleanup(), ScriptedAI::DoPlayMusic(), InstanceScript::DoSendNotifyToInstance(), ScriptedAI::DoTeleportAll(), boss_icehowl::boss_icehowlAI::DoTrampleIfValid(), InstanceScript::DoUpdateWorldState(), CreatureAI::DoZoneInCombat(), boss_sapphiron::boss_sapphironAI::EnterCombatSelfFunction(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::EnterEvadeMode(), boss_thorim::GetArenaPlayer(), spell_teron_gorefiend_shadowy_construct::HandleEffectApply(), spell_valkyr_touch_aura::HandleEffectPeriodic(), MotionTransport::HandleFirstDepartureSync(), spell_yogg_saron_brain_link_aura::HandleOnEffectApply(), WorldSession::HandleSetRaidDifficultyOpcode(), boss_ichoron::IchoronDoCastToAllHostilePlayers(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::InstanceCleanup(), boss_halion::boss_halionAI::IsAnyPlayerValid(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::IsEncounterInProgress(), boss_apothecary_hummel::boss_apothecary_hummelAI::JustDied(), npc_coren_direbrew::JustDied(), boss_headless_horseman::JustDied(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::JustDied(), boss_yoggsaron::JustDied(), boss_ahune::JustDied(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustSummoned(), boss_gothik::boss_gothikAI::JustSummoned(), LogEncounterFinished(), WorldSession::LogoutPlayer(), npc_image_of_medivh::npc_image_of_medivhAI::NextStep(), spell_hor_shared_suffering_aura::OnRemove(), PlayDirectSoundToMap(), SmartScript::ProcessAction(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::RemoveBackPack(), RemoveFromMap(), boss_krystallus::boss_krystallusAI::RemoveStonedEffect(), instance_blackrock_depths::ReplaceMoiraIfSaved(), boss_volazj::ResetPlayersPhaseMask(), boss_yoggsaron_constrictor_tentacle::SelectConstrictTarget(), boss_yoggsaron_corruptor_tentacle::SelectCorruptionTarget(), boss_gluth::boss_gluthAI::SelectPlayerInRoom(), boss_thorim_arena_npcs::SelectT(), spell_gen_rallying_cry_of_the_dragonslayer::SelectTarget(), ScriptedAI::SelectTargetFromPlayerList(), CreatureTextMgr::SendChatPacket(), CreatureTextMgr::SendNonChatPacket(), SendPacketToPlayers(), npc_highlord_darion_mograine::SendUpdateWorldState(), SendZoneMessage(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::SetData(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::SetData(), GameObject::SetLootRecipient(), Creature::SetLootRecipient(), boss_hodir::SpawnHelpers(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::Update(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::Update(), instance_halls_of_reflection::Update(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::Update(), instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::Update(), boss_chromaggus::UpdateAI(), npc_highlord_darion_mograine::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), boss_twin_valkyrAI::UpdateAI(), npc_hor_lich_king::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_addAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_icc_gauntlet_controller::npc_icc_gauntlet_controllerAI::UpdateAI(), npc_icc_putricades_trap::npc_icc_putricades_trapAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_keristrasza::UpdateAI(), boss_freya::UpdateAI(), boss_vezax::UpdateAI(), boss_hodir::UpdateAI(), boss_ignis::UpdateAI(), boss_mimiron::UpdateAI(), npc_ulduar_leviathan_mkii::UpdateAI(), npc_ulduar_flames_initial::UpdateAI(), UpdateEncounterState(), npc_grimstone::UpdateEscortAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateWorldState(), and npc_thrall_bfu::npc_thrall_bfuAI::UpdateWorldState().

◆ GetPlayersCountExceptGMs()

◆ GetPoolData() [1/2]

◆ GetPoolData() [2/2]

SpawnedPoolData const & Map::GetPoolData ( ) const
inline
385{ return *_poolData; }

References _poolData.

◆ GetRespawnTime()

time_t Map::GetRespawnTime ( SpawnObjectType  type,
ObjectGuid::LowType  spawnId 
) const
inline
455 {
456 switch (type)
457 {
459 return GetCreatureRespawnTime(spawnId);
461 return GetGORespawnTime(spawnId);
462 default:
463 return time_t(0);
464 }
465 }
@ SPAWN_TYPE_GAMEOBJECT
Definition SpawnData.h:28
@ SPAWN_TYPE_CREATURE
Definition SpawnData.h:27

References GetCreatureRespawnTime(), GetGORespawnTime(), SPAWN_TYPE_CREATURE, and SPAWN_TYPE_GAMEOBJECT.

Referenced by SpawnGroupSpawn().

◆ GetSpawnMode()

◆ GetTransport()

Transport * Map::GetTransport ( ObjectGuid const &  guid)

◆ GetTransportForPos()

Transport * Map::GetTransportForPos ( uint32  phase,
float  x,
float  y,
float  z,
WorldObject *  worldobject = nullptr 
)
1162{
1163 G3D::Vector3 v(x, y, z + 2.0f);
1164 G3D::Ray r(v, G3D::Vector3(0, 0, -1));
1165 for (TransportsContainer::const_iterator itr = _transports.begin(); itr != _transports.end(); ++itr)
1166 if ((*itr)->IsInWorld() && (*itr)->GetExactDistSq(x, y, z) < 75.0f * 75.0f && (*itr)->m_model)
1167 {
1168 float dist = 30.0f;
1169 bool hit = (*itr)->m_model->intersectRay(r, dist, false, phase, VMAP::ModelIgnoreFlags::Nothing);
1170 if (hit)
1171 return *itr;
1172 }
1173
1174 if (worldobject)
1175 if (GameObject* staticTrans = worldobject->FindNearestGameObjectOfType(GAMEOBJECT_TYPE_TRANSPORT, 75.0f))
1176 if (staticTrans->m_model)
1177 {
1178 float dist = 10.0f;
1179 bool hit = staticTrans->m_model->intersectRay(r, dist, false, phase, VMAP::ModelIgnoreFlags::Nothing);
1180 if (hit)
1181 if (GetHeight(phase, x, y, z, true, 30.0f) < (v.z - dist + 1.0f))
1182 return staticTrans->ToTransport();
1183 }
1184
1185 return nullptr;
1186}
@ GAMEOBJECT_TYPE_TRANSPORT
Definition SharedDefines.h:1575
GameObject * FindNearestGameObjectOfType(GameobjectTypes type, float range) const
Definition Object.cpp:2576

References _transports, WorldObject::FindNearestGameObjectOfType(), GAMEOBJECT_TYPE_TRANSPORT, GetHeight(), and VMAP::Nothing.

Referenced by AddToMap(), and Creature::Update().

◆ GetUpdatableObjectsCount()

size_t Map::GetUpdatableObjectsCount ( ) const
inline

◆ GetVisibilityRange()

◆ GetWaterLevel()

float Map::GetWaterLevel ( float  x,
float  y 
) const
1560{
1561 if (GridTerrainData* gmap = const_cast<Map*>(this)->GetGridTerrainData(x, y))
1562 return gmap->getLiquidLevel(x, y);
1563
1564 return INVALID_HEIGHT;
1565}

References GetGridTerrainData(), and INVALID_HEIGHT.

Referenced by go_commandscript::HandleGoGridCommand(), go_commandscript::HandleGoXYZCommand(), and go_commandscript::HandleGoZoneXYCommand().

◆ GetWaterOrGroundLevel()

float Map::GetWaterOrGroundLevel ( uint32  phasemask,
float  x,
float  y,
float  z,
float *  ground = nullptr,
bool  swim = false,
float  collisionHeight = DEFAULT_COLLISION_HEIGHT 
) const
1141{
1142 // we need ground level (including grid height version) for proper return water level in point
1143 float ground_z = GetHeight(phasemask, x, y, z + Z_OFFSET_FIND_HEIGHT, true, 50.0f);
1144 if (ground)
1145 *ground = ground_z;
1146
1147 LiquidData const& liquidData = const_cast<Map*>(this)->GetLiquidData(phasemask, x, y, ground_z, collisionHeight, {});
1148 switch (liquidData.Status)
1149 {
1151 return std::max<float>(liquidData.Level, ground_z);
1153 return ground_z;
1154 default:
1155 return liquidData.Level;
1156 }
1157
1159}
constexpr float Z_OFFSET_FIND_HEIGHT
Definition SharedDefines.h:27
LiquidData const GetLiquidData(uint32 phaseMask, float x, float y, float z, float collisionHeight, Optional< uint8 > ReqLiquidType)
Definition Map.cpp:1336

References GetHeight(), GetLiquidData(), LiquidData::Level, LIQUID_MAP_ABOVE_WATER, LIQUID_MAP_NO_WATER, LiquidData::Status, VMAP_INVALID_HEIGHT_VALUE, and Z_OFFSET_FIND_HEIGHT.

Referenced by WorldObject::GetMapWaterOrGroundLevel().

◆ GetZoneAndAreaId()

void Map::GetZoneAndAreaId ( uint32  phaseMask,
uint32 &  zoneid,
uint32 &  areaid,
float  x,
float  y,
float  z 
) const
1329{
1330 areaid = zoneid = GetAreaId(phaseMask, x, y, z);
1331 if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaid))
1332 if (area->zone)
1333 zoneid = area->zone;
1334}

References GetAreaId(), and sAreaTableStore.

Referenced by WorldObject::AddToWorld(), and MapMgr::GetZoneAndAreaId().

◆ GetZoneId()

uint32 Map::GetZoneId ( uint32  phaseMask,
float  x,
float  y,
float  z 
) const
1319{
1320 uint32 areaId = GetAreaId(phaseMask, x, y, z);
1321 if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaId))
1322 if (area->zone)
1323 return area->zone;
1324
1325 return areaId;
1326}

References GetAreaId(), and sAreaTableStore.

Referenced by MapMgr::GetZoneId().

◆ GetZoneWideVisibleWorldObjectsForZone()

ZoneWideVisibleWorldObjectsSet const * Map::GetZoneWideVisibleWorldObjectsForZone ( uint32  zoneId) const
690{
691 ZoneWideVisibleWorldObjectsMap::const_iterator itr = _zoneWideVisibleWorldObjectsMap.find(zoneId);
692 if (itr == _zoneWideVisibleWorldObjectsMap.end())
693 return nullptr;
694
695 return &itr->second;
696}

References _zoneWideVisibleWorldObjectsMap.

Referenced by debug_commandscript::HandleDebugVisibilityDataCommand(), and Acore::VisibleNotifier::SendToSelf().

◆ HandleDelayedVisibility()

void Map::HandleDelayedVisibility ( )
699{
701 return;
702 for (std::unordered_set<Unit*>::iterator itr = i_objectsForDelayedVisibility.begin(); itr != i_objectsForDelayedVisibility.end(); ++itr)
703 (*itr)->ExecuteDelayedUnitRelocationEvent();
705}
std::unordered_set< Unit * > i_objectsForDelayedVisibility
Definition Map.h:239

References i_objectsForDelayedVisibility.

Referenced by Update().

◆ HasEnoughWater() [1/2]

bool Map::HasEnoughWater ( WorldObject const *  searcher,
float  x,
float  y,
float  z 
) const
1628{
1629 LiquidData const& liquidData = const_cast<Map*>(this)->GetLiquidData(
1630 searcher->GetPhaseMask(), x, y, z, searcher->GetCollisionHeight(), MAP_ALL_LIQUIDS);
1631
1632 if ((liquidData.Status & MAP_LIQUID_STATUS_SWIMMING) == 0)
1633 return false;
1634
1635 float minHeightInWater = searcher->GetMinHeightInWater();
1636 return liquidData.Level > INVALID_HEIGHT &&
1637 liquidData.Level > liquidData.DepthLevel &&
1638 liquidData.Level - liquidData.DepthLevel >= minHeightInWater;
1639}
#define MAP_ALL_LIQUIDS
Definition GridTerrainData.h:40
#define MAP_LIQUID_STATUS_SWIMMING
Definition GridTerrainData.h:31

References LiquidData::DepthLevel, WorldObject::GetCollisionHeight(), GetLiquidData(), WorldObject::GetMinHeightInWater(), WorldObject::GetPhaseMask(), INVALID_HEIGHT, LiquidData::Level, MAP_ALL_LIQUIDS, MAP_LIQUID_STATUS_SWIMMING, and LiquidData::Status.

Referenced by CanReachPositionAndGetValidCoords().

◆ HasEnoughWater() [2/2]

bool Map::HasEnoughWater ( WorldObject const *  searcher,
LiquidData const &  liquidData 
) const

◆ HavePlayers()

◆ InitializeObject() [1/3]

template<>
void Map::InitializeObject ( Creature *  )
296{
297 //obj->_moveState = MAP_OBJECT_CELL_MOVE_NONE;
298}

◆ InitializeObject() [2/3]

template<>
void Map::InitializeObject ( GameObject *  )
302{
303 //obj->_moveState = MAP_OBJECT_CELL_MOVE_NONE;
304}

◆ InitializeObject() [3/3]

template<class T >
void Map::InitializeObject ( T *  obj)
private
291{
292}

Referenced by AddToMap().

◆ InitVisibilityDistance()

void Map::InitVisibilityDistance ( )
virtual

Reimplemented in InstanceMap, BattlegroundMap, and MapInstanced.

99{
100 //init visibility for continents
102
103 switch (GetId())
104 {
105 case MAP_EBON_HOLD: // Scarlet Enclave (DK starting zone)
106 m_VisibleDistance = 125.0f;
107 break;
108 case MAP_SCOTT_TEST: // (box map)
109 m_VisibleDistance = 200.0f;
110 break;
111 }
112}
@ MAP_EBON_HOLD
Definition AreaDefines.h:262
@ MAP_SCOTT_TEST
Definition AreaDefines.h:190
static float GetMaxVisibleDistanceOnContinents()
Definition World.h:213

References GetId(), World::GetMaxVisibleDistanceOnContinents(), m_VisibleDistance, MAP_EBON_HOLD, and MAP_SCOTT_TEST.

Referenced by MapInstanced::InitVisibilityDistance(), and Map().

◆ InsertGameObjectModel()

void Map::InsertGameObjectModel ( GameObjectModel const &  model)
inline

◆ Instanceable()

◆ Is25ManRaid()

◆ IsBattleArena()

◆ IsBattleground()

bool Map::IsBattleground ( ) const
inline

◆ IsBattlegroundOrArena()

◆ isCellMarked()

bool Map::isCellMarked ( uint32  pCellId)
inline
321{ return marked_cells.test(pCellId); }
std::bitset< TOTAL_NUMBER_OF_CELLS_PER_MAP *TOTAL_NUMBER_OF_CELLS_PER_MAP > marked_cells
Definition Map.h:635

References marked_cells.

◆ IsDungeon()

bool Map::IsDungeon ( ) const
inline
299{ return i_mapEntry && i_mapEntry->IsDungeon(); }
bool IsDungeon() const
Definition DBCStructure.h:1387

References i_mapEntry, and MapEntry::IsDungeon().

Referenced by Group::_cancelHomebindIfInstance(), Group::_homebindIfInstance(), InstanceSaveMgr::_ResetOrWarnAll(), InstanceMap::AddPlayerToMap(), GameObject::AddToSkillupList(), Spell::CheckCast(), TransportMgr::CreateTransport(), ScriptedAI::DoTeleportAll(), CreatureAI::DoZoneInCombat(), Spell::EffectSanctuary(), Spell::EffectTeleportUnits(), UnitAI::EvadeTimerExpired(), SmartScript::FillScript(), WorldObject::GetInstanceScript(), Unit::GetMeleeAttackPoint(), SpellMgr::GetSpellIdForDifficulty(), misc_commandscript::HandleAppearCommand(), WorldSession::HandleAreaTriggerOpcode(), spell_freezing_circle::HandleDamage(), spell_item_nitro_boots::HandleDummy(), instance_commandscript::HandleInstanceSaveDataCommand(), WorldSession::HandleSetDungeonDifficultyOpcode(), WorldSession::HandleSetRaidDifficultyOpcode(), misc_commandscript::HandleSummonCommand(), InstanceSave::InsertToDB(), Player::IsAtGroupRewardDistance(), boss_ossirian::JustEngagedWith(), Unit::Kill(), WorldSession::LogoutPlayer(), Condition::Meets(), AchievementCriteriaData::Meets(), npc_image_of_medivh::npc_image_of_medivhAI::NextStep(), InstanceMap::PermBindAllPlayers(), SmartScript::ProcessAction(), boss_krystallus::boss_krystallusAI::RemoveStonedEffect(), CreatureTextMgr::SendChatPacket(), Player::SetEntryPoint(), Creature::SetLootRecipient(), lfg::LFGMgr::TeleportPlayer(), ToInstanceMap(), ToInstanceMap(), AchievementMgr::UpdateAchievementCriteria(), and Player::UpdateCharmedAI().

◆ IsGridCreated() [1/2]

bool Map::IsGridCreated ( float  x,
float  y 
) const
inline
220 {
222 }
bool IsGridCreated(GridCoord const &gridCoord) const
Definition Map.cpp:211

References Acore::ComputeGridCoord(), and IsGridCreated().

◆ IsGridCreated() [2/2]

bool Map::IsGridCreated ( GridCoord const &  gridCoord) const
212{
213 return _mapGridManager.IsGridCreated(gridCoord.x_coord, gridCoord.y_coord);
214}
bool IsGridCreated(uint16 const x, uint16 const y) const
Definition MapGridManager.cpp:72

References _mapGridManager, MapGridManager::IsGridCreated(), CoordPair< LIMIT >::x_coord, and CoordPair< LIMIT >::y_coord.

Referenced by IsGridCreated().

◆ IsGridLoaded() [1/2]

bool Map::IsGridLoaded ( float  x,
float  y 
) const
inline
215 {
217 }

References Acore::ComputeGridCoord(), and IsGridLoaded().

◆ IsGridLoaded() [2/2]

◆ IsHeroic()

bool Map::IsHeroic ( ) const
inline
@ DUNGEON_DIFFICULTY_HEROIC
Definition DBCEnums.h:270
@ RAID_DIFFICULTY_10MAN_HEROIC
Definition DBCEnums.h:275

References DUNGEON_DIFFICULTY_HEROIC, i_spawnMode, IsRaid(), and RAID_DIFFICULTY_10MAN_HEROIC.

Referenced by spell_svala_ritual_strike_aura::CalculateAmount(), boss_eregos::boss_eregosAI::DamageTaken(), npc_molten_golem::DamageTaken(), npc_orb_carrier::npc_orb_carrierAI::DoAction(), brann_bronzebeard::EndTribunalFight(), BattleExperienceEvent::Execute(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::GetData(), spell_freezing_circle::HandleDamage(), instance_commandscript::HandleInstanceGetBossStateCommand(), spell_prince_taldaram_conjure_flame_sphere::HandleScript(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::InstanceCleanup(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::IsHeroic(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::IsHeroic(), boss_krystallus::boss_krystallusAI::JustEngagedWith(), npc_tirion_fordring_tft::npc_tirion_fordringAI::JustReachedHome(), npc_frost_tomb::npc_frost_tomb(), instance_gundrak::instance_gundrak_InstanceMapScript::OnGameObjectCreate(), instance_gundrak::instance_gundrak_InstanceMapScript::OnGameObjectRemove(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::OnPlayerEnter(), at_shattered_halls_execution::OnTrigger(), instance_gundrak::instance_gundrak_InstanceMapScript::OnUnitDeath(), spell_blood_queen_pact_of_the_darkfallen_dmg_aura::PeriodicTick(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::ReadSaveDataMore(), npc_tirion_fordring_tft::npc_tirion_fordringAI::Reset(), brann_bronzebeard::SchedulePhaseAbilities(), ScriptedAI::ScriptedAI(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SetBossState(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::SetData(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::SetData(), instance_oculus::instance_oculus_InstanceMapScript::SetData(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::SetData(), npc_tirion_fordring_tft::npc_tirion_fordringAI::sGossipSelect(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::Update(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::Update(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::Update(), npc_time_rift::UpdateAI(), UpdateEncounterState(), instance_halls_of_reflection::UpdateOutro(), and instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::WriteSaveDataMore().

◆ isInLineOfSight()

bool Map::isInLineOfSight ( float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2,
uint32  phasemask,
LineOfSightChecks  checks,
VMAP::ModelIgnoreFlags  ignoreFlags 
) const
1568{
1569 if (!sWorld->getBoolConfig(CONFIG_VMAP_BLIZZLIKE_PVP_LOS))
1570 {
1572 {
1573 ignoreFlags = VMAP::ModelIgnoreFlags::Nothing;
1574 }
1575 }
1576
1577 if (!sWorld->getBoolConfig(CONFIG_VMAP_BLIZZLIKE_LOS_OPEN_WORLD))
1578 {
1579 if (IsWorldMap())
1580 {
1581 ignoreFlags = VMAP::ModelIgnoreFlags::Nothing;
1582 }
1583 }
1584
1585 if ((checks & LINEOFSIGHT_CHECK_VMAP) && !_mapCollisionData.GetStaticTree().isInLineOfSight(x1, y1, z1, x2, y2, z2, ignoreFlags))
1586 {
1587 return false;
1588 }
1589
1590 if (sWorld->getBoolConfig(CONFIG_CHECK_GOBJECT_LOS) && (checks & LINEOFSIGHT_CHECK_GOBJECT_ALL))
1591 {
1592 ignoreFlags = VMAP::ModelIgnoreFlags::Nothing;
1593 if (!(checks & LINEOFSIGHT_CHECK_GOBJECT_M2))
1594 {
1595 ignoreFlags = VMAP::ModelIgnoreFlags::M2;
1596 }
1597
1598 if (!_mapCollisionData.GetDynamicTree().isInLineOfSight(x1, y1, z1, x2, y2, z2, phasemask, ignoreFlags))
1599 {
1600 return false;
1601 }
1602 }
1603
1604 return true;
1605}
@ LINEOFSIGHT_CHECK_GOBJECT_M2
Definition Map.h:111
@ LINEOFSIGHT_CHECK_VMAP
Definition Map.h:109
@ LINEOFSIGHT_CHECK_GOBJECT_ALL
Definition Map.h:113
@ CONFIG_CHECK_GOBJECT_LOS
Definition WorldConfig.h:117
@ CONFIG_VMAP_BLIZZLIKE_LOS_OPEN_WORLD
Definition WorldConfig.h:138
@ CONFIG_VMAP_BLIZZLIKE_PVP_LOS
Definition WorldConfig.h:137
bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask, VMAP::ModelIgnoreFlags ignoreFlags) const
Definition DynamicTree.cpp:257
bool IsWorldMap() const
Definition Map.h:308
bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, VMAP::ModelIgnoreFlags ignoreFlags) const
Definition MapCollisionData.cpp:71

References _mapCollisionData, CONFIG_CHECK_GOBJECT_LOS, CONFIG_VMAP_BLIZZLIKE_LOS_OPEN_WORLD, CONFIG_VMAP_BLIZZLIKE_PVP_LOS, MapCollisionData::GetDynamicTree(), MapCollisionData::GetStaticTree(), IsBattlegroundOrArena(), DynamicMapTree::isInLineOfSight(), StaticVMapCollisionData::isInLineOfSight(), IsWorldMap(), LINEOFSIGHT_CHECK_GOBJECT_ALL, LINEOFSIGHT_CHECK_GOBJECT_M2, LINEOFSIGHT_CHECK_VMAP, VMAP::M2, VMAP::Nothing, and sWorld.

Referenced by Unit::_ExitVehicle(), RandomMovementGenerator< T >::_setRandomLocation(), WorldObject::IsWithinLOS(), WorldObject::IsWithinLOSInMap(), npc_ulduar_snow_mound::MoveInLineOfSight(), spell_blood_council_summon_shadow_resonance::SetDest(), and PathGenerator::ShortenPathUntilDist().

◆ IsInWater()

bool Map::IsInWater ( uint32  phaseMask,
float  x,
float  y,
float  z,
float  collisionHeight 
) const
1616{
1617 LiquidData const& liquidData = const_cast<Map*>(this)->GetLiquidData(phaseMask, x, y, pZ, collisionHeight, {});
1618 return (liquidData.Status & MAP_LIQUID_STATUS_SWIMMING) != 0;
1619}

References GetLiquidData(), MAP_LIQUID_STATUS_SWIMMING, and LiquidData::Status.

Referenced by CheckCollisionAndGetValidCoords(), ConfusedMovementGenerator< T >::DoInitialize(), PathGenerator::IsSwimmableSegment(), and Spell::SelectImplicitCasterDestTargets().

◆ IsNonRaidDungeon()

bool Map::IsNonRaidDungeon ( ) const
inline
300{ return i_mapEntry && i_mapEntry->IsNonRaidDungeon(); }
bool IsNonRaidDungeon() const
Definition DBCStructure.h:1388

References i_mapEntry, and MapEntry::IsNonRaidDungeon().

Referenced by WorldSession::HandleSetDungeonDifficultyOpcode(), and Player::RewardReputation().

◆ IsPlayerRedirectKickTimerActive()

bool Map::IsPlayerRedirectKickTimerActive ( )
inline
332{ return !_redirectKickTimer.Passed(); }
TimeTrackerSmall _redirectKickTimer
Definition Map.h:710
bool Passed() const
Definition Timer.h:244

References _redirectKickTimer, and TimeTrackerSmall::Passed().

◆ IsRaid()

◆ IsRaidOrHeroicDungeon()

bool Map::IsRaidOrHeroicDungeon ( ) const
inline
@ DUNGEON_DIFFICULTY_NORMAL
Definition DBCEnums.h:269

References DUNGEON_DIFFICULTY_NORMAL, i_spawnMode, and IsRaid().

Referenced by Unit::Kill(), and WorldSession::LogoutPlayer().

◆ IsRegularDifficulty()

bool Map::IsRegularDifficulty ( ) const
inline
295{ return GetDifficulty() == REGULAR_DIFFICULTY; }
@ REGULAR_DIFFICULTY
Definition DBCEnums.h:267

References GetDifficulty(), and REGULAR_DIFFICULTY.

◆ IsSpawnGroupActive()

bool Map::IsSpawnGroupActive ( uint32  groupId) const
2625{
2626 SpawnGroupTemplateData const* data = sObjectMgr->GetSpawnGroupData(groupId);
2627 if (!data)
2628 return false;
2629
2630 // System groups are always active
2631 if (data->flags & SPAWNGROUP_FLAG_SYSTEM)
2632 return true;
2633
2634 // Per-map toggled state: XOR with default.
2635 // MANUAL_SPAWN groups default to inactive; toggling makes them active.
2636 // Non-MANUAL groups default to active; toggling makes them inactive.
2637 bool toggled = _toggledSpawnGroupIds.count(groupId) != 0;
2638 bool defaultActive = !(data->flags & SPAWNGROUP_FLAG_MANUAL_SPAWN);
2639 return toggled != defaultActive; // XOR: toggled flips the default
2640}
@ SPAWNGROUP_FLAG_MANUAL_SPAWN
Definition SpawnData.h:46
@ SPAWNGROUP_FLAG_SYSTEM
Definition SpawnData.h:44
std::unordered_set< uint32 > _toggledSpawnGroupIds
Definition Map.h:674
Definition SpawnData.h:58
SpawnGroupFlags flags
Definition SpawnData.h:62

References _toggledSpawnGroupIds, SpawnGroupTemplateData::flags, sObjectMgr, SPAWNGROUP_FLAG_MANUAL_SPAWN, and SPAWNGROUP_FLAG_SYSTEM.

Referenced by GridObjectLoader::LoadCreatures(), GridObjectLoader::LoadGameObjects(), ProcessCreatureRespawn(), and ProcessGameObjectRespawn().

◆ IsUnderWater()

bool Map::IsUnderWater ( uint32  phaseMask,
float  x,
float  y,
float  z,
float  collisionHeight 
) const
1622{
1623 LiquidData const& liquidData = const_cast<Map*>(this)->GetLiquidData(phaseMask, x, y, z, collisionHeight, MAP_LIQUID_TYPE_WATER | MAP_LIQUID_TYPE_OCEAN);
1624 return liquidData.Status == LIQUID_MAP_UNDER_WATER;
1625}
#define MAP_LIQUID_TYPE_WATER
Definition GridTerrainData.h:35
#define MAP_LIQUID_TYPE_OCEAN
Definition GridTerrainData.h:36

References GetLiquidData(), LIQUID_MAP_UNDER_WATER, MAP_LIQUID_TYPE_OCEAN, MAP_LIQUID_TYPE_WATER, and LiquidData::Status.

Referenced by WorldSession::ProcessMovementInfo().

◆ IsWorldMap()

bool Map::IsWorldMap ( ) const
inline
308{ return i_mapEntry && i_mapEntry->IsWorldMap(); }
bool IsWorldMap() const
Definition DBCStructure.h:1394

References i_mapEntry, and MapEntry::IsWorldMap().

Referenced by isInLineOfSight().

◆ LoadAllGrids()

void Map::LoadAllGrids ( )
222{
223 for (uint32 cellX = 0; cellX < TOTAL_NUMBER_OF_CELLS_PER_MAP; cellX++)
224 for (uint32 cellY = 0; cellY < TOTAL_NUMBER_OF_CELLS_PER_MAP; cellY++)
226}
#define TOTAL_NUMBER_OF_CELLS_PER_MAP
Definition GridDefines.h:47
#define CENTER_GRID_CELL_ID
Definition GridDefines.h:44
#define SIZE_OF_GRID_CELL
Definition GridDefines.h:42
void LoadGrid(float x, float y)
Definition Map.cpp:216

References CENTER_GRID_CELL_ID, LoadGrid(), SIZE_OF_GRID_CELL, and TOTAL_NUMBER_OF_CELLS_PER_MAP.

Referenced by MapPreloadRequest::call(), OnCreateMap(), and World::SetInitialWorldSettings().

◆ LoadCorpseData()

void Map::LoadCorpseData ( )
3533{
3535 stmt->SetData(0, GetId());
3536 stmt->SetData(1, GetInstanceId());
3537
3538 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
3539 // SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, guildId, flags, dynFlags, time, corpseType, instanceId, phaseMask, guid FROM corpse WHERE mapId = ? AND instanceId = ?
3540 PreparedQueryResult result = CharacterDatabase.Query(stmt);
3541 if (!result)
3542 return;
3543
3544 do
3545 {
3546 Field* fields = result->Fetch();
3547 CorpseType type = CorpseType(fields[13].Get<uint8>());
3548 uint32 guid = fields[16].Get<uint32>();
3549 if (type >= MAX_CORPSE_TYPE || type == CORPSE_BONES)
3550 {
3551 LOG_ERROR("maps", "Corpse (guid: {}) have wrong corpse type ({}), not loading.", guid, type);
3552 continue;
3553 }
3554
3555 Corpse* corpse = new Corpse(type);
3556
3557 if (!corpse->LoadCorpseFromDB(GenerateLowGuid<HighGuid::Corpse>(), fields))
3558 {
3559 delete corpse;
3560 continue;
3561 }
3562
3563 AddCorpse(corpse);
3564
3565 corpse->UpdatePositionData();
3566 } while (result->NextRow());
3567}
@ CHAR_SEL_CORPSES
Definition CharacterDatabase.h:248
CorpseType
Definition Corpse.h:27
#define MAX_CORPSE_TYPE
Definition Corpse.h:32
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition DatabaseEnvFwd.h:45
bool LoadCorpseFromDB(ObjectGuid::LowType guid, Field *fields)
Definition Corpse.cpp:141
Class used to access individual fields of database query result.
Definition Field.h:99
std::enable_if_t< std::is_arithmetic_v< T >, T > Get() const
Definition Field.h:113

References AddCorpse(), CHAR_SEL_CORPSES, CharacterDatabase, CORPSE_BONES, Field::Get(), GetId(), GetInstanceId(), Corpse::LoadCorpseFromDB(), LOG_ERROR, MAX_CORPSE_TYPE, PreparedStatementBase::SetData(), and WorldObject::UpdatePositionData().

Referenced by MapMgr::CreateBaseMap().

◆ LoadGrid()

◆ LoadGridsInRange()

void Map::LoadGridsInRange ( Position const &  center,
float  radius 
)
229{
231 return;
232
233 float const x = center.GetPositionX();
234 float const y = center.GetPositionY();
235
236 CellCoord cellCoord(Acore::ComputeCellCoord(x, y));
237 if (!cellCoord.IsCoordValid())
238 return;
239
240 if (radius > SIZE_OF_GRIDS)
241 radius = SIZE_OF_GRIDS;
242
243 CellArea area = Cell::CalculateCellArea(x, y, radius);
244 if (!area)
245 return;
246
247 for (uint32 x = area.low_bound.x_coord; x <= area.high_bound.x_coord; ++x)
248 {
249 for (uint32 y = area.low_bound.y_coord; y <= area.high_bound.y_coord; ++y)
250 {
251 CellCoord cellCoord(x, y);
252 Cell cell(cellCoord);
253 EnsureGridLoaded(cell);
254 }
255 }
256}
#define SIZE_OF_GRIDS
Definition MapDefines.h:26
bool IsGridsFullyLoaded() const
Definition MapGridManager.cpp:134
Definition Cell.h:28
CellCoord high_bound
Definition Cell.h:41
CellCoord low_bound
Definition Cell.h:40
static CellArea CalculateCellArea(float x, float y, float radius)
Definition CellImpl.h:42

References _mapGridManager, Cell::CalculateCellArea(), Acore::ComputeCellCoord(), EnsureGridLoaded(), Position::GetPositionX(), Position::GetPositionY(), CellArea::high_bound, CoordPair< LIMIT >::IsCoordValid(), MapGridManager::IsGridsFullyLoaded(), CellArea::low_bound, SIZE_OF_GRIDS, CoordPair< LIMIT >::x_coord, and CoordPair< LIMIT >::y_coord.

Referenced by AddPlayerToMap(), Unit::ExecuteDelayedUnitRelocationEvent(), CinematicMgr::StartCinematicCamera(), and CinematicMgr::UpdateCinematic().

◆ LoadRespawnTimes()

void Map::LoadRespawnTimes ( )
2568{
2570 stmt->SetData(0, GetId());
2571 stmt->SetData(1, GetInstanceId());
2572 if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
2573 {
2574 do
2575 {
2576 Field* fields = result->Fetch();
2577 ObjectGuid::LowType lowguid = fields[0].Get<uint32>();
2578 time_t respawnTime = time_t(fields[1].Get<uint32>());
2579
2580 _creatureRespawnTimes[lowguid] = respawnTime;
2581 _respawnQueue.insert({respawnTime, SPAWN_TYPE_CREATURE, lowguid});
2582 } while (result->NextRow());
2583 }
2584
2585 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GO_RESPAWNS);
2586 stmt->SetData(0, GetId());
2587 stmt->SetData(1, GetInstanceId());
2588 if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
2589 {
2590 do
2591 {
2592 Field* fields = result->Fetch();
2593 ObjectGuid::LowType lowguid = fields[0].Get<uint32>();
2594 time_t respawnTime = time_t(fields[1].Get<uint32>());
2595
2596 _goRespawnTimes[lowguid] = respawnTime;
2597 _respawnQueue.insert({respawnTime, SPAWN_TYPE_GAMEOBJECT, lowguid});
2598 } while (result->NextRow());
2599 }
2600}
@ CHAR_SEL_CREATURE_RESPAWNS
Definition CharacterDatabase.h:254
@ CHAR_SEL_GO_RESPAWNS
Definition CharacterDatabase.h:259

References _creatureRespawnTimes, _goRespawnTimes, _respawnQueue, CHAR_SEL_CREATURE_RESPAWNS, CHAR_SEL_GO_RESPAWNS, CharacterDatabase, Field::Get(), GetId(), GetInstanceId(), PreparedStatementBase::SetData(), SPAWN_TYPE_CREATURE, and SPAWN_TYPE_GAMEOBJECT.

Referenced by MapMgr::CreateBaseMap().

◆ LogEncounterFinished()

void Map::LogEncounterFinished ( EncounterCreditType  type,
uint32  creditEntry 
)
3012{
3013 if (!IsRaid() || !GetEntry() || GetEntry()->Expansion() < 2) // only for wotlk raids, because logs take up tons of mysql memory
3014 return;
3015 InstanceMap* map = ToInstanceMap();
3016 if (!map)
3017 return;
3018 std::string playersInfo;
3019 char buffer[16384], buffer2[255];
3020 Map::PlayerList const& pl = map->GetPlayers();
3021 for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
3022 if (Player* p = itr->GetSource())
3023 {
3024 std::string auraStr;
3025 Unit::AuraApplicationMap const& a = p->GetAppliedAuras();
3026 for (auto iterator = a.begin(); iterator != a.end(); ++iterator)
3027 {
3028 snprintf(buffer2, 255, "%u(%u) ", iterator->first, iterator->second->GetEffectMask());
3029 auraStr += buffer2;
3030 }
3031
3032 snprintf(buffer, 16384, "%s (%s, acc: %u, ip: %s, guild: %u), xyz: (%.1f, %.1f, %.1f), auras: %s\n",
3033 p->GetName().c_str(), p->GetGUID().ToString().c_str(), p->GetSession()->GetAccountId(), p->GetSession()->GetRemoteAddress().c_str(), p->GetGuildId(), p->GetPositionX(), p->GetPositionY(), p->GetPositionZ(), auraStr.c_str());
3034 playersInfo += buffer;
3035 }
3036 CleanStringForMysqlQuery(playersInfo);
3037 CharacterDatabase.Execute("INSERT INTO log_encounter VALUES(NOW(), {}, {}, {}, {}, '{}')", GetId(), (uint32)GetDifficulty(), type, creditEntry, playersInfo);
3038}
void CleanStringForMysqlQuery(std::string &str)
Definition Common.cpp:97
LinkedListHead::Iterator< GridReference< MapGridType > > iterator
Definition GridRefMgr.h:30
Definition Map.h:724
Definition MapRefMgr.h:26
iterator begin()
Definition MapRefMgr.h:36
InstanceMap * ToInstanceMap()
Definition Map.h:390
boost::container::flat_multimap< uint32, AuraApplication * > AuraApplicationMap
Definition Unit.h:674

References MapRefMgr::begin(), CharacterDatabase, CleanStringForMysqlQuery(), MapRefMgr::end(), GetDifficulty(), GetEntry(), GetId(), GetPlayers(), IsRaid(), and ToInstanceMap().

Referenced by UpdateEncounterState().

◆ markCell()

void Map::markCell ( uint32  pCellId)
inline
322{ marked_cells.set(pCellId); }

References marked_cells.

Referenced by MarkNearbyCellsOf().

◆ MarkNearbyCellsOf()

void Map::MarkNearbyCellsOf ( WorldObject *  obj)
401{
402 // Check for valid position
403 if (!obj->IsPositionValid())
404 return;
405
406 // Update mobs/objects in ALL visible cells around object!
408 for (uint32 x = area.low_bound.x_coord; x <= area.high_bound.x_coord; ++x)
409 {
410 for (uint32 y = area.low_bound.y_coord; y <= area.high_bound.y_coord; ++y)
411 {
412 // marked cells are those that have been visited
413 uint32 cell_id = (y * TOTAL_NUMBER_OF_CELLS_PER_MAP) + x;
414 markCell(cell_id);
415 }
416 }
417}
void markCell(uint32 pCellId)
Definition Map.h:322
float GetGridActivationRange() const
Definition Object.cpp:1688
bool IsPositionValid() const
Definition Position.cpp:183

References Cell::CalculateCellArea(), WorldObject::GetGridActivationRange(), Position::GetPositionX(), Position::GetPositionY(), CellArea::high_bound, Position::IsPositionValid(), CellArea::low_bound, markCell(), TOTAL_NUMBER_OF_CELLS_PER_MAP, CoordPair< LIMIT >::x_coord, and CoordPair< LIMIT >::y_coord.

Referenced by Update().

◆ MoveAllCreaturesInMoveList()

void Map::MoveAllCreaturesInMoveList ( )
951{
952 for (std::vector<Creature*>::iterator itr = _creaturesToMove.begin(); itr != _creaturesToMove.end(); ++itr)
953 {
954 Creature* c = *itr;
955 if (c->FindMap() != this)
956 continue;
957
959 {
961 continue;
962 }
963
965 if (!c->IsInWorld())
966 continue;
967
968 Cell const& old_cell = c->GetCurrentCell();
969 Cell new_cell(c->GetPositionX(), c->GetPositionY());
970 if (c->IsFarVisible())
971 {
972 // Removes via GetCurrentCell, added back in AddToGrid
974 }
975
976 c->RemoveFromGrid();
977 if (old_cell.DiffGrid(new_cell))
978 EnsureGridLoaded(new_cell);
979 AddToGrid(c, new_cell);
980 }
981 _creaturesToMove.clear();
982}
void RemoveFromGrid()
Definition Object.h:380
void RemoveWorldObjectFromFarVisibleMap(WorldObject *obj)
Definition Map.cpp:658
Map * FindMap() const
Definition Object.h:638

References _creaturesToMove, MovableMapObject::_moveState, AddToGrid(), Cell::DiffGrid(), EnsureGridLoaded(), WorldObject::FindMap(), MovableMapObject::GetCurrentCell(), Position::GetPositionX(), Position::GetPositionY(), WorldObject::IsFarVisible(), Object::IsInWorld(), MAP_OBJECT_CELL_MOVE_ACTIVE, MAP_OBJECT_CELL_MOVE_NONE, GridObject< T >::RemoveFromGrid(), and RemoveWorldObjectFromFarVisibleMap().

Referenced by Update().

◆ MoveAllDynamicObjectsInMoveList()

void Map::MoveAllDynamicObjectsInMoveList ( )
1020{
1021 for (std::vector<DynamicObject*>::iterator itr = _dynamicObjectsToMove.begin(); itr != _dynamicObjectsToMove.end(); ++itr)
1022 {
1023 DynamicObject* dynObj = *itr;
1024 if (dynObj->FindMap() != this)
1025 continue;
1026
1028 {
1030 continue;
1031 }
1032
1034 if (!dynObj->IsInWorld())
1035 continue;
1036
1037 Cell const& old_cell = dynObj->GetCurrentCell();
1038 Cell new_cell(dynObj->GetPositionX(), dynObj->GetPositionY());
1039
1040 dynObj->RemoveFromGrid();
1041 if (old_cell.DiffGrid(new_cell))
1042 EnsureGridLoaded(new_cell);
1043 AddToGrid(dynObj, new_cell);
1044 }
1045 _dynamicObjectsToMove.clear();
1046}

References _dynamicObjectsToMove, MovableMapObject::_moveState, AddToGrid(), Cell::DiffGrid(), EnsureGridLoaded(), WorldObject::FindMap(), MovableMapObject::GetCurrentCell(), Position::GetPositionX(), Position::GetPositionY(), Object::IsInWorld(), MAP_OBJECT_CELL_MOVE_ACTIVE, MAP_OBJECT_CELL_MOVE_NONE, and GridObject< T >::RemoveFromGrid().

Referenced by Update().

◆ MoveAllGameObjectsInMoveList()

void Map::MoveAllGameObjectsInMoveList ( )
985{
986 for (std::vector<GameObject*>::iterator itr = _gameObjectsToMove.begin(); itr != _gameObjectsToMove.end(); ++itr)
987 {
988 GameObject* go = *itr;
989 if (go->FindMap() != this)
990 continue;
991
993 {
995 continue;
996 }
997
999 if (!go->IsInWorld())
1000 continue;
1001
1002 Cell const& old_cell = go->GetCurrentCell();
1003 Cell new_cell(go->GetPositionX(), go->GetPositionY());
1004
1005 if (go->IsFarVisible())
1006 {
1007 // Removes via GetCurrentCell, added back in AddToGrid
1009 }
1010
1011 go->RemoveFromGrid();
1012 if (old_cell.DiffGrid(new_cell))
1013 EnsureGridLoaded(new_cell);
1014 AddToGrid(go, new_cell);
1015 }
1016 _gameObjectsToMove.clear();
1017}

References _gameObjectsToMove, MovableMapObject::_moveState, AddToGrid(), Cell::DiffGrid(), EnsureGridLoaded(), WorldObject::FindMap(), MovableMapObject::GetCurrentCell(), Position::GetPositionX(), Position::GetPositionY(), WorldObject::IsFarVisible(), Object::IsInWorld(), MAP_OBJECT_CELL_MOVE_ACTIVE, MAP_OBJECT_CELL_MOVE_NONE, GridObject< T >::RemoveFromGrid(), and RemoveWorldObjectFromFarVisibleMap().

Referenced by Update().

◆ OnCreateMap()

void Map::OnCreateMap ( )
90{
91 // Instances load all grids by default (both base map and child maps)
92 if (GetInstanceId())
94
95 sScriptMgr->OnCreateMap(this);
96}
void LoadAllGrids()
Definition Map.cpp:221

References GetInstanceId(), LoadAllGrids(), and sScriptMgr.

Referenced by MapMgr::CreateBaseMap(), and MapInstanced::CreateBattleground().

◆ PlayDirectSoundToMap()

void Map::PlayDirectSoundToMap ( uint32  soundId,
uint32  zoneId = 0 
)
3281{
3282 Map::PlayerList const& players = GetPlayers();
3283 if (!players.IsEmpty())
3284 {
3286 data << uint32(soundId);
3287
3288 for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
3289 if (Player* player = itr->GetSource())
3290 if (!zoneId || player->GetZoneId() == zoneId)
3291 player->SendDirectMessage(&data);
3292 }
3293}
@ SMSG_PLAY_SOUND
Definition Opcodes.h:752

References MapRefMgr::begin(), MapRefMgr::end(), GetPlayers(), LinkedListHead::IsEmpty(), and SMSG_PLAY_SOUND.

Referenced by instance_naxxramas::Update().

◆ PlayerRelocation()

void Map::PlayerRelocation ( Player *  player,
float  x,
float  y,
float  z,
float  o 
)
805{
806 Cell old_cell(player->GetPositionX(), player->GetPositionY());
807 Cell new_cell(x, y);
808
809 if (old_cell.DiffGrid(new_cell) || old_cell.DiffCell(new_cell))
810 {
811 player->RemoveFromGrid();
812
813 if (old_cell.DiffGrid(new_cell))
814 EnsureGridLoaded(new_cell);
815
816 AddToGrid(player, new_cell);
817 }
818
819 player->Relocate(x, y, z, o);
820 if (player->IsVehicle())
822 player->UpdatePositionData();
823 player->UpdateObjectVisibility(false);
824}

References AddToGrid(), Cell::DiffCell(), Cell::DiffGrid(), EnsureGridLoaded(), Position::GetPositionX(), Position::GetPositionY(), Unit::GetVehicleKit(), Unit::IsVehicle(), Position::Relocate(), Vehicle::RelocatePassengers(), GridObject< T >::RemoveFromGrid(), Player::UpdateObjectVisibility(), and WorldObject::UpdatePositionData().

Referenced by at_icc_saurfang_portal::OnTrigger(), StaticTransport::UpdatePassengerPositions(), MotionTransport::UpdatePassengerPositions(), and Unit::UpdatePosition().

◆ ProcessCreatureRespawn()

void Map::ProcessCreatureRespawn ( ObjectGuid::LowType  spawnId)
2812{
2813 // Pool members are handled entirely by the pool system on this map's pool data
2814 if (uint32 poolId = sPoolMgr->IsPartOfAPool<Creature>(spawnId))
2815 {
2816 sPoolMgr->UpdatePool<Creature>(GetPoolData(), poolId, spawnId);
2818 return;
2819 }
2820
2821 CreatureData const* data = sObjectMgr->GetCreatureData(spawnId);
2822 if (!data)
2823 {
2825 return;
2826 }
2827
2828 // Compat-mode creatures handle their own respawn in-place — don't interfere.
2829 // Clean up the stale respawn time entry since the legacy system manages these.
2830 SpawnGroupTemplateData const* groupData = sObjectMgr->GetSpawnGroupData(data->spawnGroupId);
2831 if (!groupData || (groupData->flags & SPAWNGROUP_FLAG_COMPATIBILITY_MODE))
2832 {
2834 return;
2835 }
2836
2837 // Don't respawn if the spawn group is not active
2838 if (!IsSpawnGroupActive(data->spawnGroupId))
2839 {
2840 // Re-queue — will be checked again next ProcessRespawns() tick
2841 _respawnQueue.insert({GameTime::GetGameTime().count() + 5, SPAWN_TYPE_CREATURE, spawnId});
2842 return;
2843 }
2844
2845 // Skip if grid isn't loaded (will be handled in grid loader)
2846 if (!IsGridLoaded(data->posX, data->posY))
2847 {
2848 _respawnQueue.insert({GameTime::GetGameTime().count() + 5, SPAWN_TYPE_CREATURE, spawnId});
2849 return;
2850 }
2851
2852 // Skip if already alive
2853 auto bounds = _creatureBySpawnIdStore.equal_range(spawnId);
2854 for (auto itr = bounds.first; itr != bounds.second; ++itr)
2855 {
2856 if (itr->second->IsAlive())
2857 {
2859 return;
2860 }
2861 }
2862
2863 // Check linked_respawn: don't spawn if the master creature is still dead.
2864 // This mirrors the check in Creature::Respawn() for compat-mode creatures:
2865 // hard-reset creatures bypass it (they despawn on evade and must always
2866 // come back), and a creature linked to itself never auto-respawns.
2867 ObjectGuid dbtableHighGuid = ObjectGuid::Create<HighGuid::Unit>(data->id, spawnId);
2868 time_t linkedRespawntime = GetLinkedRespawnTime(dbtableHighGuid);
2869 CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(data->id);
2870 if (linkedRespawntime && !(cInfo && cInfo->HasFlagsExtra(CREATURE_FLAG_EXTRA_HARD_RESET)))
2871 {
2872 time_t now = GameTime::GetGameTime().count();
2873 time_t newRespawnTime;
2874 if (sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid) == dbtableHighGuid)
2875 newRespawnTime = now + DAY; // if linking self, never respawn (check delayed to next day)
2876 else
2877 newRespawnTime = (now > linkedRespawntime ? now : linkedRespawntime) + urand(5, MINUTE); // master is still dead; re-queue at the master's respawn time + a small offset
2878 SaveCreatureRespawnTime(spawnId, newRespawnTime);
2879 return;
2880 }
2881
2882 // Remove respawn time BEFORE LoadFromDB, otherwise the creature
2883 // reads it back and loads as DEAD instead of ALIVE
2885
2886 Creature* creature = new Creature();
2887 if (!creature->LoadCreatureFromDB(spawnId, this, true, true))
2888 delete creature;
2889}
constexpr auto DAY
Definition Common.h:49
@ CREATURE_FLAG_EXTRA_HARD_RESET
Definition CreatureData.h:77
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:44
@ SPAWNGROUP_FLAG_COMPATIBILITY_MODE
Definition SpawnData.h:45
bool LoadCreatureFromDB(ObjectGuid::LowType guid, Map *map, bool addToMap=true, bool allowDuplicate=false)
Definition Creature.cpp:1694
void RemoveCreatureRespawnTime(ObjectGuid::LowType dbGuid)
Definition Map.cpp:2506
time_t GetLinkedRespawnTime(ObjectGuid guid) const
Definition Map.cpp:3056
void SaveCreatureRespawnTime(ObjectGuid::LowType dbGuid, time_t &respawnTime)
Definition Map.cpp:2477
bool IsSpawnGroupActive(uint32 groupId) const
Definition Map.cpp:2624
SpawnedPoolData & GetPoolData()
Definition Map.h:384
Seconds GetGameTime()
Definition GameTime.cpp:38
Definition CreatureData.h:370
uint32 id
Definition CreatureData.h:372
Definition CreatureData.h:187
bool HasFlagsExtra(uint32 flag) const
Definition CreatureData.h:278
float posX
Definition SpawnData.h:71
float posY
Definition SpawnData.h:72
uint32 spawnGroupId
Definition SpawnData.h:78

References _creatureBySpawnIdStore, _respawnQueue, CREATURE_FLAG_EXTRA_HARD_RESET, DAY, SpawnGroupTemplateData::flags, GameTime::GetGameTime(), GetLinkedRespawnTime(), GetPoolData(), CreatureTemplate::HasFlagsExtra(), CreatureData::id, IsGridLoaded(), IsSpawnGroupActive(), Creature::LoadCreatureFromDB(), MINUTE, SpawnData::posX, SpawnData::posY, RemoveCreatureRespawnTime(), SaveCreatureRespawnTime(), sObjectMgr, SPAWN_TYPE_CREATURE, SPAWNGROUP_FLAG_COMPATIBILITY_MODE, SpawnData::spawnGroupId, sPoolMgr, and urand().

Referenced by ProcessRespawns().

◆ ProcessGameObjectRespawn()

void Map::ProcessGameObjectRespawn ( ObjectGuid::LowType  spawnId)
2892{
2893 // Pool members are handled entirely by the pool system on this map's pool data
2894 if (uint32 poolId = sPoolMgr->IsPartOfAPool<GameObject>(spawnId))
2895 {
2896 sPoolMgr->UpdatePool<GameObject>(GetPoolData(), poolId, spawnId);
2897 RemoveGORespawnTime(spawnId);
2898 return;
2899 }
2900
2901 GameObjectData const* data = sObjectMgr->GetGameObjectData(spawnId);
2902 if (!data)
2903 {
2904 RemoveGORespawnTime(spawnId);
2905 return;
2906 }
2907
2908 // Compat-mode gameobjects handle their own respawn — don't interfere.
2909 // Clean up the stale respawn time entry since the legacy system manages these.
2910 SpawnGroupTemplateData const* groupData = sObjectMgr->GetSpawnGroupData(data->spawnGroupId);
2911 if (!groupData || (groupData->flags & SPAWNGROUP_FLAG_COMPATIBILITY_MODE))
2912 {
2913 RemoveGORespawnTime(spawnId);
2914 return;
2915 }
2916
2917 // Don't respawn if the spawn group is not active
2918 if (!IsSpawnGroupActive(data->spawnGroupId))
2919 {
2920 _respawnQueue.insert({GameTime::GetGameTime().count() + 5, SPAWN_TYPE_GAMEOBJECT, spawnId});
2921 return;
2922 }
2923
2924 // Skip if grid isn't loaded (will be handled in grid loader)
2925 if (!IsGridLoaded(data->posX, data->posY))
2926 {
2927 _respawnQueue.insert({GameTime::GetGameTime().count() + 5, SPAWN_TYPE_GAMEOBJECT, spawnId});
2928 return;
2929 }
2930
2931 if (_gameobjectBySpawnIdStore.count(spawnId))
2932 {
2933 RemoveGORespawnTime(spawnId);
2934 return;
2935 }
2936
2937 // Remove respawn time BEFORE LoadFromDB, otherwise the GO
2938 // reads it back and loads as despawned
2939 RemoveGORespawnTime(spawnId);
2940
2941 GameObject* gameobject = new GameObject();
2942 if (!gameobject->LoadGameObjectFromDB(spawnId, this, true))
2943 delete gameobject;
2944}
virtual bool LoadGameObjectFromDB(ObjectGuid::LowType guid, Map *map, bool addToMap=true)
Definition GameObject.cpp:1103
void RemoveGORespawnTime(ObjectGuid::LowType dbGuid)
Definition Map.cpp:2551
Definition GameObjectData.h:715

References _gameobjectBySpawnIdStore, _respawnQueue, SpawnGroupTemplateData::flags, GameTime::GetGameTime(), GetPoolData(), IsGridLoaded(), IsSpawnGroupActive(), GameObject::LoadGameObjectFromDB(), SpawnData::posX, SpawnData::posY, RemoveGORespawnTime(), sObjectMgr, SPAWN_TYPE_GAMEOBJECT, SPAWNGROUP_FLAG_COMPATIBILITY_MODE, SpawnData::spawnGroupId, and sPoolMgr.

Referenced by ProcessRespawns().

◆ ProcessRespawns()

void Map::ProcessRespawns ( )
2786{
2787 time_t now = GameTime::GetGameTime().count();
2788
2789 // Process due respawns from the time-ordered queue.
2790 // Entries are sorted by respawnTime — once we hit a future time, we're done.
2791 while (!_respawnQueue.empty())
2792 {
2793 auto it = _respawnQueue.begin();
2794 if (it->respawnTime > now)
2795 break; // nothing else is due this tick
2796
2797 SpawnObjectType type = it->type;
2798 ObjectGuid::LowType spawnId = it->spawnId;
2799
2800 // Remove from queue first — handlers below call Remove*RespawnTime()
2801 // which also erases from queue, so we must pop before processing.
2802 _respawnQueue.erase(it);
2803
2804 if (type == SPAWN_TYPE_CREATURE)
2805 ProcessCreatureRespawn(spawnId);
2806 else if (type == SPAWN_TYPE_GAMEOBJECT)
2807 ProcessGameObjectRespawn(spawnId);
2808 }
2809}
SpawnObjectType
Definition SpawnData.h:26
void ProcessCreatureRespawn(ObjectGuid::LowType spawnId)
Definition Map.cpp:2811
void ProcessGameObjectRespawn(ObjectGuid::LowType spawnId)
Definition Map.cpp:2891

References _respawnQueue, GameTime::GetGameTime(), ProcessCreatureRespawn(), ProcessGameObjectRespawn(), SPAWN_TYPE_CREATURE, and SPAWN_TYPE_GAMEOBJECT.

Referenced by Update().

◆ RemoveAllObjectsInRemoveList()

void Map::RemoveAllObjectsInRemoveList ( )
1834{
1835 while (!i_objectsToRemove.empty())
1836 {
1837 std::unordered_set<WorldObject*>::iterator itr = i_objectsToRemove.begin();
1838 WorldObject* obj = *itr;
1839 i_objectsToRemove.erase(itr);
1840
1841 switch (obj->GetTypeId())
1842 {
1843 case TYPEID_CORPSE:
1844 {
1845 Corpse* corpse = ObjectAccessor::GetCorpse(*obj, obj->GetGUID());
1846 if (!corpse)
1847 LOG_ERROR("maps", "Tried to delete corpse/bones {} that is not in map.", obj->GetGUID().ToString());
1848 else
1849 RemoveFromMap(corpse, true);
1850 break;
1851 }
1853 RemoveFromMap((DynamicObject*)obj, true);
1854 break;
1855 case TYPEID_GAMEOBJECT:
1856 if (Transport* transport = obj->ToGameObject()->ToTransport())
1857 RemoveFromMap(transport, true);
1858 else
1859 RemoveFromMap(obj->ToGameObject(), true);
1860 break;
1861 case TYPEID_UNIT:
1862 // in case triggered sequence some spell can continue casting after prev CleanupsBeforeDelete call
1863 // make sure that like sources auras/etc removed before destructor start
1865 RemoveFromMap(obj->ToCreature(), true);
1866 break;
1867 default:
1868 LOG_ERROR("maps", "Non-grid object (TypeId: {}) is in grid object remove list, ignored.", obj->GetTypeId());
1869 break;
1870 }
1871 }
1872}
@ TYPEID_DYNAMICOBJECT
Definition ObjectGuid.h:41
@ TYPEID_GAMEOBJECT
Definition ObjectGuid.h:40
@ TYPEID_UNIT
Definition ObjectGuid.h:38
@ TYPEID_CORPSE
Definition ObjectGuid.h:42
void RemoveFromMap(T *, bool)
Definition Map.cpp:745
void CleanupsBeforeDelete(bool finalCleanup=true) override
Definition Unit.cpp:12236
Corpse * GetCorpse(WorldObject const &u, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:203

References Unit::CleanupsBeforeDelete(), ObjectAccessor::GetCorpse(), Object::GetGUID(), Object::GetTypeId(), i_objectsToRemove, LOG_ERROR, RemoveFromMap(), Object::ToCreature(), Object::ToGameObject(), ObjectGuid::ToString(), GameObject::ToTransport(), TYPEID_CORPSE, TYPEID_DYNAMICOBJECT, TYPEID_GAMEOBJECT, and TYPEID_UNIT.

Referenced by DelayedUpdate(), and MapGridManager::UnloadGrid().

◆ RemoveAllPlayers()

void Map::RemoveAllPlayers ( )
virtual

Reimplemented in BattlegroundMap.

1058{
1059 if (HavePlayers())
1060 {
1061 for (MapRefMgr::iterator itr = m_mapRefMgr.begin(); itr != m_mapRefMgr.end(); ++itr)
1062 {
1063 Player* player = itr->GetSource();
1064 if (!player->IsBeingTeleportedFar())
1065 {
1066 // this is happening for bg
1067 LOG_ERROR("maps", "Map::UnloadAll: player {} is still in map {} during unload, this should not happen!", player->GetName(), GetId());
1068 player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->GetOrientation());
1069 }
1070 }
1071 }
1072}
float m_homebindZ
Definition Player.h:2423
bool IsBeingTeleportedFar() const
Definition Player.h:2123
uint32 m_homebindMapId
Definition Player.h:2419
float m_homebindY
Definition Player.h:2422
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0, Unit *target=nullptr, bool newInstance=false)
Definition Player.cpp:1401
float m_homebindX
Definition Player.h:2421
std::string const & GetName() const
Definition Object.h:535

References MapRefMgr::begin(), MapRefMgr::end(), GetId(), WorldObject::GetName(), Position::GetOrientation(), HavePlayers(), Player::IsBeingTeleportedFar(), LOG_ERROR, Player::m_homebindMapId, Player::m_homebindX, Player::m_homebindY, Player::m_homebindZ, m_mapRefMgr, and Player::TeleportTo().

◆ RemoveCorpse()

void Map::RemoveCorpse ( Corpse *  corpse)
3085{
3086 ASSERT(corpse);
3087 GridCoord const gridCoord = Acore::ComputeGridCoord(corpse->GetPositionX(), corpse->GetPositionY());
3088
3089 corpse->DestroyForVisiblePlayers();
3090 if (corpse->IsInGrid())
3091 RemoveFromMap(corpse, false);
3092 else
3093 {
3094 corpse->RemoveFromWorld();
3095 corpse->ResetMap();
3096 }
3097
3098 _corpsesByGrid[gridCoord.GetId()].erase(corpse);
3099 if (corpse->GetType() != CORPSE_BONES)
3100 _corpsesByPlayer.erase(corpse->GetOwnerGUID());
3101 else
3102 _corpseBones.erase(corpse);
3103}
void RemoveFromWorld() override
Definition Corpse.cpp:53
bool IsInGrid() const
Definition Object.h:371
virtual void ResetMap()
Definition Object.cpp:2219
void DestroyForVisiblePlayers()
Definition Object.cpp:3055

References _corpseBones, _corpsesByGrid, _corpsesByPlayer, ASSERT, Acore::ComputeGridCoord(), CORPSE_BONES, WorldObject::DestroyForVisiblePlayers(), CoordPair< LIMIT >::GetId(), Corpse::GetOwnerGUID(), Position::GetPositionX(), Position::GetPositionY(), Corpse::GetType(), GridObject< T >::IsInGrid(), RemoveFromMap(), Corpse::RemoveFromWorld(), and WorldObject::ResetMap().

Referenced by ConvertCorpseToBones(), and RemoveOldCorpses().

◆ RemoveCreatureFromMoveList()

void Map::RemoveCreatureFromMoveList ( Creature *  c)
private

◆ RemoveCreatureRespawnTime()

void Map::RemoveCreatureRespawnTime ( ObjectGuid::LowType  dbGuid)
2507{
2508 auto itr = _creatureRespawnTimes.find(spawnId);
2509 if (itr != _creatureRespawnTimes.end())
2510 {
2511 _respawnQueue.erase({itr->second, SPAWN_TYPE_CREATURE, spawnId});
2512 _creatureRespawnTimes.erase(itr);
2513 }
2514
2516 stmt->SetData(0, spawnId);
2517 stmt->SetData(1, GetId());
2518 stmt->SetData(2, GetInstanceId());
2519 CharacterDatabase.Execute(stmt);
2520}
@ CHAR_DEL_CREATURE_RESPAWN
Definition CharacterDatabase.h:256

References _creatureRespawnTimes, _respawnQueue, CHAR_DEL_CREATURE_RESPAWN, CharacterDatabase, GetId(), GetInstanceId(), PreparedStatementBase::SetData(), and SPAWN_TYPE_CREATURE.

Referenced by Creature::DeleteFromDB(), ProcessCreatureRespawn(), RemoveRespawnTime(), Creature::Respawn(), and SaveCreatureRespawnTime().

◆ RemoveDynamicObjectFromMoveList()

void Map::RemoveDynamicObjectFromMoveList ( DynamicObject *  go)
private

◆ RemoveFromMap() [1/2]

template<class T >
void Map::RemoveFromMap ( T *  obj,
bool  remove 
)
746{
747 obj->RemoveFromWorld();
748
749 obj->RemoveFromGrid();
750
751 obj->ResetMap();
752
753 if (remove)
754 {
756 DeleteFromWorld(obj);
757 }
758}
void RemoveObjectFromMapUpdateList(WorldObject *obj)
Definition Map.cpp:623
void DeleteFromWorld(T *)
Definition Map.cpp:168

References DeleteFromWorld(), and RemoveObjectFromMapUpdateList().

Referenced by MotionTransport::DelayedTeleportTransport(), RemoveAllObjectsInRemoveList(), and RemoveCorpse().

◆ RemoveFromMap() [2/2]

template<>
void Map::RemoveFromMap ( Transport *  obj,
bool  remove 
)
762{
763 obj->RemoveFromWorld();
764
765 Map::PlayerList const& players = GetPlayers();
766 if (!players.IsEmpty())
767 {
768 UpdateData data;
769 obj->BuildOutOfRangeUpdateBlock(&data);
770 WorldPacket packet;
771 data.BuildPacket(packet);
772 // Skip players that are not in world
773 // Their client already received the destroy from SendRemoveTransports when leaving this map
774 for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
775 if (itr->GetSource()->IsInWorld() && itr->GetSource()->GetTransport() != obj)
776 itr->GetSource()->SendDirectMessage(&packet);
777 }
778
780 {
781 TransportsContainer::iterator itr = _transports.find(obj);
782 if (itr == _transports.end())
783 return;
784 if (itr == _transportsUpdateIter)
786 _transports.erase(itr);
787 }
788 else
789 _transports.erase(obj);
790
791 obj->ResetMap();
792
794
795 if (remove)
796 {
797 // if option set then object already saved at this moment
798 if (!sWorld->getBoolConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY))
799 obj->SaveRespawnTime();
800 DeleteFromWorld(obj);
801 }
802}
@ CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY
Definition WorldConfig.h:50
void RemoveFromWorld() override
Definition GameObject.cpp:185
void SaveRespawnTime() override
Definition GameObject.h:245
void BuildOutOfRangeUpdateBlock(UpdateData *data) const
Definition Object.cpp:267

References _transports, _transportsUpdateIter, MapRefMgr::begin(), Object::BuildOutOfRangeUpdateBlock(), UpdateData::BuildPacket(), CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY, DeleteFromWorld(), MapRefMgr::end(), GetPlayers(), LinkedListHead::IsEmpty(), GameObject::RemoveFromWorld(), RemoveObjectFromMapUpdateList(), WorldObject::ResetMap(), GameObject::SaveRespawnTime(), and sWorld.

◆ RemoveGameObjectFromMoveList()

void Map::RemoveGameObjectFromMoveList ( GameObject *  go)
private

◆ RemoveGameObjectModel()

void Map::RemoveGameObjectModel ( GameObjectModel const &  model)
inline

◆ RemoveGORespawnTime()

void Map::RemoveGORespawnTime ( ObjectGuid::LowType  dbGuid)
2552{
2553 auto itr = _goRespawnTimes.find(spawnId);
2554 if (itr != _goRespawnTimes.end())
2555 {
2556 _respawnQueue.erase({itr->second, SPAWN_TYPE_GAMEOBJECT, spawnId});
2557 _goRespawnTimes.erase(itr);
2558 }
2559
2561 stmt->SetData(0, spawnId);
2562 stmt->SetData(1, GetId());
2563 stmt->SetData(2, GetInstanceId());
2564 CharacterDatabase.Execute(stmt);
2565}
@ CHAR_DEL_GO_RESPAWN
Definition CharacterDatabase.h:261

References _goRespawnTimes, _respawnQueue, CHAR_DEL_GO_RESPAWN, CharacterDatabase, GetId(), GetInstanceId(), PreparedStatementBase::SetData(), and SPAWN_TYPE_GAMEOBJECT.

Referenced by GameObject::DeleteFromDB(), GameObject::LoadGameObjectFromDB(), ProcessGameObjectRespawn(), RemoveRespawnTime(), GameObject::Respawn(), and SaveGORespawnTime().

◆ RemoveObjectFromMapUpdateList()

void Map::RemoveObjectFromMapUpdateList ( WorldObject *  obj)

◆ RemoveOldCorpses()

void Map::RemoveOldCorpses ( )
3159{
3160 time_t now = GameTime::GetGameTime().count();
3161
3162 std::vector<ObjectGuid> corpses;
3163 corpses.reserve(_corpsesByPlayer.size());
3164
3165 for (auto const& p : _corpsesByPlayer)
3166 if (p.second->IsExpired(now))
3167 corpses.push_back(p.first);
3168
3169 for (ObjectGuid const& ownerGuid : corpses)
3170 ConvertCorpseToBones(ownerGuid);
3171
3172 std::vector<Corpse*> expiredBones;
3173 for (Corpse* bones : _corpseBones)
3174 if (bones->IsExpired(now))
3175 expiredBones.push_back(bones);
3176
3177 for (Corpse* bones : expiredBones)
3178 {
3179 RemoveCorpse(bones);
3180 delete bones;
3181 }
3182}

References _corpseBones, _corpsesByPlayer, ConvertCorpseToBones(), GameTime::GetGameTime(), and RemoveCorpse().

Referenced by server_commandscript::HandleServerCorpsesCommand(), and UpdateExpiredCorpses().

◆ RemovePlayerFromMap()

void Map::RemovePlayerFromMap ( Player *  player,
bool  remove 
)
virtual

Reimplemented in InstanceMap, and BattlegroundMap.

720{
722
723 player->GetThreatMgr().RemoveMeFromThreatLists(); // pussywizard: multithreading crashfix
724
725 player->RemoveFromWorld();
726 SendRemoveTransports(player);
727
728 if (player->IsInGrid())
729 player->RemoveFromGrid();
730 else
731 ASSERT(remove); //maybe deleted in logoutplayer when player is not in a map
732
733 sScriptMgr->OnPlayerLeaveMap(this, player);
734 if (remove)
735 {
736 DeleteFromWorld(player);
737 }
738}
#define MAP_INVALID_ZONE
Definition Map.cpp:49
void UpdatePlayerZoneStats(uint32 oldZone, uint32 newZone)
Definition Map.cpp:419
void SendRemoveTransports(Player *player)
Definition Map.cpp:1711
void RemoveFromWorld() override
Definition Player.cpp:1758
void RemoveMeFromThreatLists()
Definition ThreatManager.cpp:798
ThreatManager & GetThreatMgr()
Definition Unit.h:957
uint32 GetZoneId() const
Definition Object.cpp:3171

References ASSERT, DeleteFromWorld(), Unit::GetThreatMgr(), WorldObject::GetZoneId(), GridObject< T >::IsInGrid(), MAP_INVALID_ZONE, GridObject< T >::RemoveFromGrid(), Player::RemoveFromWorld(), ThreatManager::RemoveMeFromThreatLists(), SendRemoveTransports(), sScriptMgr, and UpdatePlayerZoneStats().

Referenced by WorldSession::HandleMoveWorldportAck(), WorldSession::HandleSetRaidDifficultyOpcode(), InstanceMap::RemovePlayerFromMap(), BattlegroundMap::RemovePlayerFromMap(), and Player::TeleportTo().

◆ RemoveRespawnTime()

void Map::RemoveRespawnTime ( SpawnObjectType  type,
ObjectGuid::LowType  spawnId 
)
inline
467 {
468 switch (type)
469 {
472 break;
474 RemoveGORespawnTime(spawnId);
475 break;
476 default:
477 break;
478 }
479 }

References RemoveCreatureRespawnTime(), RemoveGORespawnTime(), SPAWN_TYPE_CREATURE, and SPAWN_TYPE_GAMEOBJECT.

Referenced by SpawnGroupDespawn(), and SpawnGroupSpawn().

◆ RemoveUpdateObject()

void Map::RemoveUpdateObject ( Object *  obj)
inline
540 {
541 _updateObjects.erase(obj);
542 }

References _updateObjects.

Referenced by DeleteFromWorld(), and WorldObject::RemoveFromObjectUpdate().

◆ RemoveWorldObjectFromFarVisibleMap()

void Map::RemoveWorldObjectFromFarVisibleMap ( WorldObject *  obj)
659{
660 if (Creature* creature = obj->ToCreature())
661 {
662 Cell curr_cell = creature->GetCurrentCell();
663 MapGridType* grid = GetMapGrid(curr_cell.GridX(), curr_cell.GridY());
664 grid->RemoveFarVisibleObject(curr_cell.CellX(), curr_cell.CellY(), creature);
665 }
666 else if (GameObject* go = obj->ToGameObject())
667 {
668 Cell curr_cell = go->GetCurrentCell();
669 MapGridType* grid = GetMapGrid(curr_cell.GridX(), curr_cell.GridY());
670 grid->RemoveFarVisibleObject(curr_cell.CellX(), curr_cell.CellY(), go);
671 }
672}
void RemoveFarVisibleObject(uint16 const x, uint16 const y, SPECIFIC_OBJECT *obj)
Definition MapGrid.h:64

References Cell::CellX(), Cell::CellY(), GetMapGrid(), Cell::GridX(), Cell::GridY(), MapGrid< GRID_OBJECT_TYPES, FAR_VISIBLE_OBJECT_TYPES >::RemoveFarVisibleObject(), Object::ToCreature(), and Object::ToGameObject().

Referenced by MoveAllCreaturesInMoveList(), MoveAllGameObjectsInMoveList(), and WorldObject::RemoveFromMapVisibilityOverrideContainers().

◆ RemoveWorldObjectFromZoneWideVisibleMap()

void Map::RemoveWorldObjectFromZoneWideVisibleMap ( uint32  zoneId,
WorldObject *  obj 
)
681{
682 ZoneWideVisibleWorldObjectsMap::iterator itr = _zoneWideVisibleWorldObjectsMap.find(zoneId);
683 if (itr == _zoneWideVisibleWorldObjectsMap.end())
684 return;
685
686 itr->second.erase(obj);
687}

References _zoneWideVisibleWorldObjectsMap.

Referenced by WorldObject::ProcessPositionDataChanged(), and WorldObject::RemoveFromMapVisibilityOverrideContainers().

◆ resetMarkedCells()

void Map::resetMarkedCells ( )
inline
320{ marked_cells.reset(); }

References marked_cells.

Referenced by Update().

◆ SaveCreatureRespawnTime()

void Map::SaveCreatureRespawnTime ( ObjectGuid::LowType  dbGuid,
time_t &  respawnTime 
)
2478{
2479 if (!respawnTime)
2480 {
2481 // Delete only
2483 return;
2484 }
2485
2486 time_t now = GameTime::GetGameTime().count();
2487 if (GetInstanceResetPeriod() > 0 && respawnTime - now + 5 >= GetInstanceResetPeriod())
2488 respawnTime = now + YEAR;
2489
2490 // Remove old queue entry if updating an existing respawn time
2491 auto itr = _creatureRespawnTimes.find(spawnId);
2492 if (itr != _creatureRespawnTimes.end())
2493 _respawnQueue.erase({itr->second, SPAWN_TYPE_CREATURE, spawnId});
2494
2495 _creatureRespawnTimes[spawnId] = respawnTime;
2496 _respawnQueue.insert({respawnTime, SPAWN_TYPE_CREATURE, spawnId});
2497
2499 stmt->SetData(0, spawnId);
2500 stmt->SetData(1, uint32(respawnTime));
2501 stmt->SetData(2, GetId());
2502 stmt->SetData(3, GetInstanceId());
2503 CharacterDatabase.Execute(stmt);
2504}
@ CHAR_REP_CREATURE_RESPAWN
Definition CharacterDatabase.h:255
constexpr auto YEAR
Definition Common.h:52
time_t GetInstanceResetPeriod() const
Definition Map.h:442

References _creatureRespawnTimes, _respawnQueue, CHAR_REP_CREATURE_RESPAWN, CharacterDatabase, GameTime::GetGameTime(), GetId(), GetInstanceId(), GetInstanceResetPeriod(), RemoveCreatureRespawnTime(), PreparedStatementBase::SetData(), SPAWN_TYPE_CREATURE, and YEAR.

Referenced by misc_commandscript::HandleRespawnAllCommand(), misc_commandscript::HandleRespawnCreatureByEntryCommand(), misc_commandscript::HandleRespawnCreatureByGuidCommand(), ProcessCreatureRespawn(), Creature::Respawn(), CreatureGroup::RespawnRemovedMembers(), and Creature::SaveRespawnTime().

◆ SaveGORespawnTime()

void Map::SaveGORespawnTime ( ObjectGuid::LowType  dbGuid,
time_t &  respawnTime 
)
2523{
2524 if (!respawnTime)
2525 {
2526 // Delete only
2527 RemoveGORespawnTime(spawnId);
2528 return;
2529 }
2530
2531 time_t now = GameTime::GetGameTime().count();
2532 if (GetInstanceResetPeriod() > 0 && respawnTime - now + 5 >= GetInstanceResetPeriod())
2533 respawnTime = now + YEAR;
2534
2535 // Remove old queue entry if updating an existing respawn time
2536 auto itr = _goRespawnTimes.find(spawnId);
2537 if (itr != _goRespawnTimes.end())
2538 _respawnQueue.erase({itr->second, SPAWN_TYPE_GAMEOBJECT, spawnId});
2539
2540 _goRespawnTimes[spawnId] = respawnTime;
2541 _respawnQueue.insert({respawnTime, SPAWN_TYPE_GAMEOBJECT, spawnId});
2542
2544 stmt->SetData(0, spawnId);
2545 stmt->SetData(1, uint32(respawnTime));
2546 stmt->SetData(2, GetId());
2547 stmt->SetData(3, GetInstanceId());
2548 CharacterDatabase.Execute(stmt);
2549}
@ CHAR_REP_GO_RESPAWN
Definition CharacterDatabase.h:260

References _goRespawnTimes, _respawnQueue, CHAR_REP_GO_RESPAWN, CharacterDatabase, GameTime::GetGameTime(), GetId(), GetInstanceId(), GetInstanceResetPeriod(), RemoveGORespawnTime(), PreparedStatementBase::SetData(), SPAWN_TYPE_GAMEOBJECT, and YEAR.

Referenced by misc_commandscript::HandleRespawnAllCommand(), misc_commandscript::HandleRespawnGameObjectByEntryCommand(), misc_commandscript::HandleRespawnGameObjectByGuidCommand(), and GameObject::SaveRespawnTime().

◆ ScheduleCreatureRespawn()

void Map::ScheduleCreatureRespawn ( ObjectGuid  creatureGuid,
Milliseconds  respawnTimer,
Position  pos = Position() 
)
3185{
3186 Events.AddEventAtOffset([this, creatureGuid, pos]()
3187 {
3188 if (Creature* creature = GetCreature(creatureGuid))
3189 creature->Respawn();
3190 else
3191 SummonCreature(creatureGuid.GetEntry(), pos);
3192 }, respawnTimer);
3193}
TempSummon * SummonCreature(uint32 entry, Position const &pos, SummonPropertiesEntry const *properties=nullptr, uint32 duration=0, WorldObject *summoner=nullptr, uint32 spellId=0, uint32 vehId=0, bool visibleBySummonerOnly=false)
Definition Object.cpp:2246
Creature * GetCreature(ObjectGuid const &guid)
Definition Map.cpp:2442
uint32 GetEntry() const
Definition ObjectGuid.h:147

References GetCreature(), ObjectGuid::GetEntry(), and SummonCreature().

Referenced by Creature::DespawnOnEvade(), and Creature::ForcedDespawn().

◆ ScriptCommandStart()

void Map::ScriptCommandStart ( ScriptInfo const &  script,
uint32  delay,
Object *  source,
Object *  target 
)
  • If effects should be immediate, launch the script execution
70{
71 // NOTE: script record _must_ exist until command executed
72
73 // prepare static data
74 ObjectGuid sourceGUID = source ? source->GetGUID() : ObjectGuid::Empty;
75 ObjectGuid targetGUID = target ? target->GetGUID() : ObjectGuid::Empty;
76 ObjectGuid ownerGUID = (source && source->IsItem()) ? ((Item*)source)->GetOwnerGUID() : ObjectGuid::Empty;
77
78 ScriptAction sa;
79 sa.sourceGUID = sourceGUID;
80 sa.targetGUID = targetGUID;
81 sa.ownerGUID = ownerGUID;
82
83 sa.script = &script;
84 m_scriptSchedule.insert(ScriptScheduleMap::value_type(time_t(GameTime::GetGameTime().count() + delay), sa));
85
86 sScriptMgr->IncreaseScheduledScriptsCount();
87
89 if (delay == 0 && !i_scriptLock)
90 {
91 i_scriptLock = true;
93 i_scriptLock = false;
94 }
95}
Definition Item.h:220
void ScriptsProcess()
Process queued scripts.
Definition MapScripts.cpp:277
static ObjectGuid const Empty
Definition ObjectGuid.h:123
bool IsItem() const
Definition Object.h:231
Definition Map.h:87
ObjectGuid targetGUID
Definition Map.h:89
ObjectGuid ownerGUID
Definition Map.h:90
ObjectGuid sourceGUID
Definition Map.h:88
ScriptInfo const * script
Definition Map.h:91

References ObjectGuid::Empty, GameTime::GetGameTime(), Object::GetGUID(), i_scriptLock, Object::IsItem(), m_scriptSchedule, ScriptAction::ownerGUID, ScriptAction::script, ScriptsProcess(), ScriptAction::sourceGUID, sScriptMgr, and ScriptAction::targetGUID.

◆ ScriptsProcess()

void Map::ScriptsProcess ( )
private

Process queued scripts.

  • Process overdue queued scripts
Todo:
: Allow gameobjects to be targets and casters
278{
279 if (m_scriptSchedule.empty())
280 return;
281
283 ScriptScheduleMap::iterator iter = m_scriptSchedule.begin();
284 // ok as multimap is a *sorted* associative container
285 while (!m_scriptSchedule.empty() && (iter->first <= GameTime::GetGameTime().count()))
286 {
287 ScriptAction const& step = iter->second;
288
289 Object* source = nullptr;
290 if (step.sourceGUID)
291 {
292 switch (step.sourceGUID.GetHigh())
293 {
294 case HighGuid::Item: // as well as HIGHGUID_CONTAINER
295 if (Player* player = ObjectAccessor::GetPlayer(this, step.ownerGUID))
296 source = player->GetItemByGuid(step.sourceGUID);
297 break;
298 case HighGuid::Unit:
300 source = GetCreature(step.sourceGUID);
301 break;
302 case HighGuid::Pet:
303 source = GetPet(step.sourceGUID);
304 break;
305 case HighGuid::Player:
307 break;
310 source = GetGameObject(step.sourceGUID);
311 break;
312 case HighGuid::Corpse:
313 source = GetCorpse(step.sourceGUID);
314 break;
316 source = GetTransport(step.sourceGUID);
317 break;
318 default:
319 LOG_ERROR("maps.script", "{} source with unsupported high guid ({}).",
320 step.script->GetDebugInfo(), step.sourceGUID.ToString());
321 break;
322 }
323 }
324
325 WorldObject* target = nullptr;
326 if (step.targetGUID)
327 {
328 switch (step.targetGUID.GetHigh())
329 {
330 case HighGuid::Unit:
332 target = GetCreature(step.targetGUID);
333 break;
334 case HighGuid::Pet:
335 target = GetPet(step.targetGUID);
336 break;
337 case HighGuid::Player: // empty GUID case also
339 break;
342 target = GetGameObject(step.targetGUID);
343 break;
344 case HighGuid::Corpse:
345 target = GetCorpse(step.targetGUID);
346 break;
348 target = GetTransport(step.targetGUID);
349 break;
350 default:
351 LOG_ERROR("maps.script", "{} target with unsupported high guid ({}).",
352 step.script->GetDebugInfo(), step.targetGUID.ToString());
353 break;
354 }
355 }
356
357 switch (step.script->command)
358 {
360 {
362 {
363 LOG_ERROR("maps.script", "{} invalid chat type ({}) specified, skipping.", step.script->GetDebugInfo(), step.script->Talk.ChatType);
364 break;
365 }
366
368 {
369 source = _GetScriptPlayerSourceOrTarget(source, target, step.script);
370 }
371 else
372 {
373 source = _GetScriptCreatureSourceOrTarget(source, target, step.script);
374 }
375
376 if (source)
377 {
378 Unit* sourceUnit = source->ToUnit();
379 if (!sourceUnit)
380 {
381 LOG_ERROR("scripts", "{} source object ({}) is not an unit, skipping.", step.script->GetDebugInfo(), source->GetGUID().ToString());
382 break;
383 }
384
385 switch (step.script->Talk.ChatType)
386 {
387 case CHAT_TYPE_SAY:
388 sourceUnit->Say(step.script->Talk.TextID, target);
389 break;
390 case CHAT_TYPE_YELL:
391 sourceUnit->Yell(step.script->Talk.TextID, target);
392 break;
395 sourceUnit->TextEmote(step.script->Talk.TextID, target, step.script->Talk.ChatType == CHAT_TYPE_BOSS_EMOTE);
396 break;
399 {
400 Player* receiver = target ? target->ToPlayer() : nullptr;
401 if (!receiver)
402 LOG_ERROR("scripts", "{} attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo());
403 else
404 sourceUnit->Whisper(step.script->Talk.TextID, receiver, step.script->Talk.ChatType == CHAT_MSG_RAID_BOSS_WHISPER);
405 break;
406 }
407 default:
408 break; // must be already checked at load
409 }
410 }
411 break;
412 }
414 // Source or target must be Creature.
415 if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script))
416 {
418 cSource->SetUInt32Value(UNIT_NPC_EMOTESTATE, step.script->Emote.EmoteID);
419 else
420 cSource->HandleEmoteCommand(step.script->Emote.EmoteID);
421 }
422 break;
423
425 // Source or target must be Creature.
426 if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script))
427 {
428 // Validate field number.
429 if (step.script->FieldSet.FieldID <= OBJECT_FIELD_ENTRY || step.script->FieldSet.FieldID >= cSource->GetValuesCount())
430 LOG_ERROR("maps.script", "{} wrong field {} (max count: {}) in object ({}) specified, skipping.",
431 step.script->GetDebugInfo(), step.script->FieldSet.FieldID, cSource->GetValuesCount(), cSource->GetGUID().ToString());
432 else
433 cSource->SetUInt32Value(step.script->FieldSet.FieldID, step.script->FieldSet.FieldValue);
434 }
435 break;
436
438 // Source or target must be Creature.
439 if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script))
440 {
441 Unit* unit = (Unit*)cSource;
442 if (step.script->MoveTo.TravelTime != 0)
443 {
444 float speed = unit->GetDistance(step.script->MoveTo.DestX, step.script->MoveTo.DestY, step.script->MoveTo.DestZ) / ((float)step.script->MoveTo.TravelTime * 0.001f);
446 }
447 else
449 }
450 break;
451
453 // Source or target must be Creature.
454 if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script))
455 {
456 // Validate field number.
457 if (step.script->FlagToggle.FieldID <= OBJECT_FIELD_ENTRY || step.script->FlagToggle.FieldID >= cSource->GetValuesCount())
458 LOG_ERROR("maps.script", "{} wrong field {} (max count: {}) in object ({}) specified, skipping.",
459 step.script->GetDebugInfo(), step.script->FlagToggle.FieldID, cSource->GetValuesCount(), cSource->GetGUID().ToString());
460 else
461 cSource->SetFlag(step.script->FlagToggle.FieldID, step.script->FlagToggle.FieldValue);
462 }
463 break;
464
466 // Source or target must be Creature.
467 if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script))
468 {
469 // Validate field number.
470 if (step.script->FlagToggle.FieldID <= OBJECT_FIELD_ENTRY || step.script->FlagToggle.FieldID >= cSource->GetValuesCount())
471 LOG_ERROR("maps.script", "{} wrong field {} (max count: {}) in object ({}) specified, skipping.",
472 step.script->GetDebugInfo(), step.script->FlagToggle.FieldID, cSource->GetValuesCount(), cSource->GetGUID().ToString());
473 else
474 cSource->RemoveFlag(step.script->FlagToggle.FieldID, step.script->FlagToggle.FieldValue);
475 }
476 break;
477
480 {
481 // Source or target must be Creature.
482 if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script, true))
483 cSource->NearTeleportTo(step.script->TeleportTo.DestX, step.script->TeleportTo.DestY, step.script->TeleportTo.DestZ, step.script->TeleportTo.Orientation);
484 }
485 else
486 {
487 // Source or target must be Player.
488 if (Player* player = _GetScriptPlayerSourceOrTarget(source, target, step.script))
489 player->TeleportTo(step.script->TeleportTo.MapID, step.script->TeleportTo.DestX, step.script->TeleportTo.DestY, step.script->TeleportTo.DestZ, step.script->TeleportTo.Orientation);
490 }
491 break;
492
494 {
495 if (!source)
496 {
497 LOG_ERROR("maps.script", "{} source object is nullptr.", step.script->GetDebugInfo());
498 break;
499 }
500 if (!target)
501 {
502 LOG_ERROR("maps.script", "{} target object is nullptr.", step.script->GetDebugInfo());
503 break;
504 }
505
506 // when script called for item spell casting then target == (unit or GO) and source is player
507 WorldObject* worldObject;
508 Player* player = target->ToPlayer();
509 if (player)
510 {
511 if (!source->IsCreature() && !source->IsGameObject() && !source->IsPlayer())
512 {
513 LOG_ERROR("maps.script", "{} source is not unit, gameobject or player ({}), skipping.", step.script->GetDebugInfo(), source->GetGUID().ToString());
514 break;
515 }
516 worldObject = dynamic_cast<WorldObject*>(source);
517 }
518 else
519 {
520 player = source->ToPlayer();
521 if (player)
522 {
523 if (!target->IsCreature() && !target->IsGameObject() && !target->IsPlayer())
524 {
525 LOG_ERROR("maps.script", "{} target is not unit, gameobject or player ({}), skipping.", step.script->GetDebugInfo(), target->GetGUID().ToString());
526 break;
527 }
528 worldObject = dynamic_cast<WorldObject*>(target);
529 }
530 else
531 {
532 LOG_ERROR("maps.script", "{} neither source nor target is player (source: {}; target: {}), skipping.",
533 step.script->GetDebugInfo(), source->GetGUID().ToString(), target->GetGUID().ToString());
534 break;
535 }
536 }
537
538 // quest id and flags checked at script loading
539 if ((!worldObject->IsCreature() || ((Unit*)worldObject)->IsAlive()) &&
540 (step.script->QuestExplored.Distance == 0 || worldObject->IsWithinDistInMap(player, float(step.script->QuestExplored.Distance))))
541 player->GroupEventHappens(step.script->QuestExplored.QuestID, worldObject);
542 else
543 player->FailQuest(step.script->QuestExplored.QuestID);
544
545 break;
546 }
547
549 // Source or target must be Player.
550 if (Player* player = _GetScriptPlayerSourceOrTarget(source, target, step.script))
551 {
554 else
556 }
557 break;
558
561 {
562 LOG_ERROR("maps.script", "{} gameobject guid (datalong) is not specified.", step.script->GetDebugInfo());
563 break;
564 }
565
566 // Source or target must be WorldObject.
567 if (WorldObject* pSummoner = _GetScriptWorldObject(source, true, step.script))
568 {
570 if (!pGO)
571 {
572 LOG_ERROR("maps.script", "{} gameobject was not found (guid: {}).", step.script->GetDebugInfo(), step.script->RespawnGameobject.GOGuid);
573 break;
574 }
575
580 {
581 LOG_ERROR("maps.script", "{} can not be used with gameobject of type {} (guid: {}).",
583 break;
584 }
585
586 // Check that GO is not spawned
587 if (!pGO->isSpawned())
588 {
589 int32 nTimeToDespawn = std::max(5, int32(step.script->RespawnGameobject.DespawnDelay));
591 pGO->SetRespawnTime(nTimeToDespawn);
592
593 pGO->GetMap()->AddToMap(pGO);
594 }
595 }
596 break;
597
599 {
600 // Source must be WorldObject.
601 if (WorldObject* pSummoner = _GetScriptWorldObject(source, true, step.script))
602 {
604 LOG_ERROR("maps.script", "{} creature entry (datalong) is not specified.", step.script->GetDebugInfo());
605 else
606 {
608
609 float x = step.script->TempSummonCreature.PosX;
610 float y = step.script->TempSummonCreature.PosY;
611 float z = step.script->TempSummonCreature.PosZ;
612 float o = step.script->TempSummonCreature.Orientation;
613
615 if (Unit* trigger = pSummoner->SummonTrigger(x, y, z, o, 1))
616 if (trigger->FindNearestCreature(entry, 60.0f))
617 break;
618
619 if (!pSummoner->SummonCreature(entry, x, y, z, o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, step.script->TempSummonCreature.DespawnDelay))
620 LOG_ERROR("maps.script", "{} creature was not spawned (entry: {}).", step.script->GetDebugInfo(), step.script->TempSummonCreature.CreatureEntry);
621 }
622 }
623 break;
624 }
625
628 _ScriptProcessDoor(source, target, step.script);
629 break;
630
632 // Source must be Unit.
633 if (Unit* unit = _GetScriptUnit(source, true, step.script))
634 {
635 // Target must be GameObject.
636 if (!target)
637 {
638 LOG_ERROR("maps.script", "{} target object is nullptr.", step.script->GetDebugInfo());
639 break;
640 }
641
642 if (!target->IsGameObject())
643 {
644 LOG_ERROR("maps.script", "{} target object is not gameobject ({}), skipping.", step.script->GetDebugInfo(), target->GetGUID().ToString());
645 break;
646 }
647
648 if (GameObject* pGO = target->ToGameObject())
649 pGO->Use(unit);
650 }
651 break;
652
654 {
655 // Source (datalong2 != 0) or target (datalong2 == 0) must be Unit.
656 bool bReverse = step.script->RemoveAura.Flags & SF_REMOVEAURA_REVERSE;
657 if (Unit* unit = _GetScriptUnit(bReverse ? source : target, bReverse, step.script))
658 unit->RemoveAurasDueToSpell(step.script->RemoveAura.SpellID);
659 break;
660 }
661
663 {
665 if (!source && !target)
666 {
667 LOG_ERROR("maps.script", "{} source and target objects are nullptr.", step.script->GetDebugInfo());
668 break;
669 }
670
671 Unit* uSource = nullptr;
672 Unit* uTarget = nullptr;
673 // source/target cast spell at target/source (script->datalong2: 0: s->t 1: s->s 2: t->t 3: t->s
674 switch (step.script->CastSpell.Flags)
675 {
676 case SF_CASTSPELL_SOURCE_TO_TARGET: // source -> target
677 uSource = source ? source->ToUnit() : nullptr;
678 uTarget = target ? target->ToUnit() : nullptr;
679 break;
680 case SF_CASTSPELL_SOURCE_TO_SOURCE: // source -> source
681 uSource = source ? source->ToUnit() : nullptr;
682 uTarget = uSource;
683 break;
684 case SF_CASTSPELL_TARGET_TO_TARGET: // target -> target
685 uSource = target ? target->ToUnit() : nullptr;
686 uTarget = uSource;
687 break;
688 case SF_CASTSPELL_TARGET_TO_SOURCE: // target -> source
689 uSource = target ? target->ToUnit() : nullptr;
690 uTarget = source ? source->ToUnit() : nullptr;
691 break;
692 case SF_CASTSPELL_SEARCH_CREATURE: // source -> creature with entry
693 uSource = source ? source->ToUnit() : nullptr;
694 uTarget = uSource ? GetClosestCreatureWithEntry(uSource, std::abs(step.script->CastSpell.CreatureEntry), step.script->CastSpell.SearchRadius) : nullptr;
695 break;
696 }
697
698 if (!uSource || !uSource->IsUnit())
699 {
700 LOG_ERROR("maps.script", "{} no source unit found for spell {}", step.script->GetDebugInfo(), step.script->CastSpell.SpellID);
701 break;
702 }
703
704 if (!uTarget || !uTarget->IsUnit())
705 {
706 LOG_ERROR("maps.script", "{} no target unit found for spell {}", step.script->GetDebugInfo(), step.script->CastSpell.SpellID);
707 break;
708 }
709
710 bool triggered = (step.script->CastSpell.Flags != 4) ?
712 step.script->CastSpell.CreatureEntry < 0;
713 uSource->CastSpell(uTarget, step.script->CastSpell.SpellID, triggered);
714 break;
715 }
716
718 // Source must be WorldObject.
719 if (WorldObject* object = _GetScriptWorldObject(source, true, step.script))
720 {
721 // Playsound.Flags bitmask: 0/1=anyone/target
722 Player* player = nullptr;
724 {
725 // Target must be Player.
726 player = _GetScriptPlayer(target, false, step.script);
727 if (!target)
728 break;
729 }
730
731 // Playsound.Flags bitmask: 0/2/4=without/with distance dependent/radius
733 object->PlayRadiusSound(step.script->Playsound.SoundID, step.script->Playsound.Radius);
735 object->PlayDistanceSound(step.script->Playsound.SoundID, player);
736 else
737 object->PlayDirectSound(step.script->Playsound.SoundID, player);
738 }
739 break;
740
742 // Target or source must be Player.
743 if (Player* pReceiver = _GetScriptPlayerSourceOrTarget(source, target, step.script))
744 {
745 ItemPosCountVec dest;
746 InventoryResult msg = pReceiver->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, step.script->CreateItem.ItemEntry, step.script->CreateItem.Amount);
747 if (msg == EQUIP_ERR_OK)
748 {
749 if (Item* item = pReceiver->StoreNewItem(dest, step.script->CreateItem.ItemEntry, true))
750 pReceiver->SendNewItem(item, step.script->CreateItem.Amount, false, true);
751 }
752 else
753 pReceiver->SendEquipError(msg, nullptr, nullptr, step.script->CreateItem.ItemEntry);
754 }
755 break;
756
758 // Target or source must be Creature.
759 if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script, true))
760 cSource->DespawnOrUnsummon(Milliseconds(step.script->DespawnSelf.DespawnDelay));
761 break;
762
764 // Source must be Unit.
765 if (Unit* unit = _GetScriptUnit(source, true, step.script))
766 {
767 if (!sWaypointMgr->GetPath(step.script->LoadPath.PathID))
768 LOG_ERROR("maps.script", "{} source object has an invalid path ({}), skipping.", step.script->GetDebugInfo(), step.script->LoadPath.PathID);
769 else
771 }
772 break;
773
775 {
777 {
778 LOG_ERROR("maps.script", "{} creature entry is not specified, skipping.", step.script->GetDebugInfo());
779 break;
780 }
781 if (!step.script->CallScript.ScriptID)
782 {
783 LOG_ERROR("maps.script", "{} script id is not specified, skipping.", step.script->GetDebugInfo());
784 break;
785 }
786
787 Creature* cTarget = nullptr;
788 auto creatureBounds = _creatureBySpawnIdStore.equal_range(step.script->CallScript.CreatureEntry);
789 if (creatureBounds.first != creatureBounds.second)
790 {
791 // Prefer alive (last respawned) creature
792 auto creatureItr = std::find_if(creatureBounds.first, creatureBounds.second, [](Map::CreatureBySpawnIdContainer::value_type const& pair)
793 {
794 return pair.second->IsAlive();
795 });
796 cTarget = creatureItr != creatureBounds.second ? creatureItr->second : creatureBounds.first->second;
797 }
798
799 if (!cTarget)
800 {
801 LOG_ERROR("maps.script", "{} target was not found (entry: {})", step.script->GetDebugInfo(), step.script->CallScript.CreatureEntry);
802 break;
803 }
804
805 //Lets choose our ScriptMap map
807 //if no scriptmap present...
808 if (!datamap)
809 {
810 LOG_ERROR("maps.script", "{} unknown scriptmap ({}) specified, skipping.", step.script->GetDebugInfo(), step.script->CallScript.ScriptType);
811 break;
812 }
813
814 // Insert script into schedule but do not start it
815 ScriptsStart(*datamap, step.script->CallScript.ScriptID, cTarget, nullptr);
816 break;
817 }
818
820 // Source or target must be Creature.
821 if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script))
822 {
823 if (cSource->isDead())
824 LOG_ERROR("maps.script", "{} creature is already dead ({})", step.script->GetDebugInfo(), cSource->GetGUID().ToString());
825 else
826 {
827 cSource->setDeathState(DeathState::JustDied);
828 if (step.script->Kill.RemoveCorpse == 1)
829 cSource->RemoveCorpse();
830 }
831 }
832 break;
833
835 // Source must be Unit.
836 if (Unit* sourceUnit = _GetScriptUnit(source, true, step.script))
837 {
839 {
840 // Target must be Unit.
841 Unit* targetUnit = _GetScriptUnit(target, false, step.script);
842 if (!targetUnit)
843 break;
844
845 sourceUnit->SetFacingToObject(targetUnit);
846 }
847 else
848 sourceUnit->SetFacingTo(step.script->Orientation.Orientation);
849 }
850 break;
851
853 // Source must be Creature.
854 if (Creature* cSource = _GetScriptCreature(source, true, step.script))
855 cSource->LoadEquipment(step.script->Equip.EquipmentID);
856 break;
857
859 // Source must be Creature.
860 if (Creature* cSource = _GetScriptCreature(source, true, step.script))
861 cSource->SetDisplayId(step.script->Model.ModelID);
862 break;
863
865 // Source must be Player.
866 if (Player* player = _GetScriptPlayer(source, true, step.script))
868 break;
869
871 // Source must be Player.
872 if (Player* player = _GetScriptPlayer(source, true, step.script))
873 player->SendMovieStart(step.script->PlayMovie.MovieID);
874 break;
875
877 // Source must be Creature.
878 if (Creature* cSource = _GetScriptCreature(source, true, step.script))
879 {
880 if (!cSource->IsAlive())
881 return;
882
883 cSource->GetMotionMaster()->MoveIdle();
884
885 switch (step.script->Movement.MovementType)
886 {
888 cSource->GetMotionMaster()->MoveRandom((float)step.script->Movement.MovementDistance);
889 break;
891 cSource->GetMotionMaster()->MoveWaypoint(step.script->Movement.Path, false);
892 break;
893 }
894 }
895 break;
896
897 default:
898 LOG_ERROR("maps.script", "Unknown script command {}.", step.script->GetDebugInfo());
899 break;
900 }
901
902 m_scriptSchedule.erase(iter);
903 iter = m_scriptSchedule.begin();
904 sScriptMgr->DecreaseScheduledScriptCount();
905 }
906}
@ CHAT_TYPE_SAY
Definition CreatureData.h:412
@ CHAT_TYPE_TEXT_EMOTE
Definition CreatureData.h:414
@ CHAT_TYPE_BOSS_EMOTE
Definition CreatureData.h:415
@ CHAT_TYPE_WHISPER
Definition CreatureData.h:416
@ CHAT_TYPE_YELL
Definition CreatureData.h:413
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:27
@ GO_READY
Definition GameObject.h:111
InventoryResult
Definition Item.h:46
@ EQUIP_ERR_OK
Definition Item.h:47
@ NULL_BAG
Definition Item.h:40
@ NULL_SLOT
Definition Item.h:41
@ WAYPOINT_MOTION_TYPE
Definition MotionMaster.h:41
@ RANDOM_MOTION_TYPE
Definition MotionMaster.h:40
@ FORCED_MOVEMENT_NONE
Definition MotionMaster.h:86
ScriptMapMap * GetScriptsMapByType(ScriptsType type)
Definition ObjectMgr.cpp:84
@ SF_CASTSPELL_SOURCE_TO_SOURCE
Definition ObjectMgr.h:177
@ SF_CASTSPELL_SOURCE_TO_TARGET
Definition ObjectMgr.h:176
@ SF_CASTSPELL_TRIGGERED
Definition ObjectMgr.h:181
@ SF_CASTSPELL_TARGET_TO_SOURCE
Definition ObjectMgr.h:179
@ SF_REMOVEAURA_REVERSE
Definition ObjectMgr.h:173
@ SF_PLAYSOUND_DISTANCE_SOUND
Definition ObjectMgr.h:185
@ SF_TALK_USE_PLAYER
Definition ObjectMgr.h:161
@ SF_TELEPORT_USE_CREATURE
Definition ObjectMgr.h:167
@ SF_KILLCREDIT_REWARD_GROUP
Definition ObjectMgr.h:170
@ SF_PLAYSOUND_TARGET_PLAYER
Definition ObjectMgr.h:184
@ SF_CASTSPELL_TARGET_TO_TARGET
Definition ObjectMgr.h:178
@ SF_EMOTE_USE_STATE
Definition ObjectMgr.h:164
@ SF_CASTSPELL_SEARCH_CREATURE
Definition ObjectMgr.h:180
@ SF_PLAYSOUND_DISTANCE_RADIUS
Definition ObjectMgr.h:186
@ SF_ORIENTATION_FACE_TARGET
Definition ObjectMgr.h:189
@ SCRIPT_COMMAND_EMOTE
Definition ObjectMgr.h:96
@ SCRIPT_COMMAND_CREATE_ITEM
Definition ObjectMgr.h:112
@ SCRIPT_COMMAND_DESPAWN_SELF
Definition ObjectMgr.h:113
@ SCRIPT_COMMAND_CAST_SPELL
Definition ObjectMgr.h:110
@ SCRIPT_COMMAND_RESPAWN_GAMEOBJECT
Definition ObjectMgr.h:104
@ SCRIPT_COMMAND_QUEST_EXPLORED
Definition ObjectMgr.h:102
@ SCRIPT_COMMAND_ACTIVATE_OBJECT
Definition ObjectMgr.h:108
@ SCRIPT_COMMAND_TALK
Definition ObjectMgr.h:95
@ SCRIPT_COMMAND_EQUIP
Definition ObjectMgr.h:121
@ SCRIPT_COMMAND_FIELD_SET
Definition ObjectMgr.h:97
@ SCRIPT_COMMAND_PLAYMOVIE
Definition ObjectMgr.h:124
@ SCRIPT_COMMAND_CALLSCRIPT_TO_UNIT
Definition ObjectMgr.h:116
@ SCRIPT_COMMAND_TELEPORT_TO
Definition ObjectMgr.h:101
@ SCRIPT_COMMAND_MOVE_TO
Definition ObjectMgr.h:98
@ SCRIPT_COMMAND_FLAG_SET
Definition ObjectMgr.h:99
@ SCRIPT_COMMAND_TEMP_SUMMON_CREATURE
Definition ObjectMgr.h:105
@ SCRIPT_COMMAND_MOVEMENT
Definition ObjectMgr.h:125
@ SCRIPT_COMMAND_KILL_CREDIT
Definition ObjectMgr.h:103
@ SCRIPT_COMMAND_KILL
Definition ObjectMgr.h:117
@ SCRIPT_COMMAND_LOAD_PATH
Definition ObjectMgr.h:115
@ SCRIPT_COMMAND_ORIENTATION
Definition ObjectMgr.h:120
@ SCRIPT_COMMAND_PLAY_SOUND
Definition ObjectMgr.h:111
@ SCRIPT_COMMAND_MODEL
Definition ObjectMgr.h:122
@ SCRIPT_COMMAND_CLOSE_GOSSIP
Definition ObjectMgr.h:123
@ SCRIPT_COMMAND_REMOVE_AURA
Definition ObjectMgr.h:109
@ SCRIPT_COMMAND_FLAG_REMOVE
Definition ObjectMgr.h:100
std::map< uint32, ScriptMap > ScriptMapMap
Definition ObjectMgr.h:389
ScriptsType
Definition ObjectMgr.h:148
@ TEMPSUMMON_TIMED_OR_DEAD_DESPAWN
Definition Object.h:50
std::vector< ItemPosCount > ItemPosCountVec
Definition Player.h:758
Creature * GetClosestCreatureWithEntry(WorldObject *source, uint32 entry, float maxSearchRange, bool alive)
Definition ScriptedCreature.cpp:933
@ GAMEOBJECT_TYPE_TRAP
Definition SharedDefines.h:1570
@ GAMEOBJECT_TYPE_FISHINGNODE
Definition SharedDefines.h:1581
@ CHAT_MSG_RAID_BOSS_WHISPER
Definition SharedDefines.h:3427
@ UNIT_NPC_EMOTESTATE
Definition UpdateFields.h:140
@ OBJECT_FIELD_ENTRY
Definition UpdateFields.h:27
#define sWaypointMgr
Definition WaypointMgr.h:54
bool isSpawned() const
Definition GameObject.h:191
void SetLootState(LootState s, Unit *unit=nullptr)
Definition GameObject.cpp:2484
void SetRespawnTime(int32 respawn)
Definition GameObject.cpp:1288
void Use(Unit *user)
Definition GameObject.cpp:1479
static T * Find(ObjectGuid guid)
Definition ObjectAccessor.cpp:53
Player * _GetScriptPlayer(Object *obj, bool isSource, ScriptInfo const *scriptInfo) const
Definition MapScripts.cpp:171
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
Pet * GetPet(ObjectGuid const &guid)
Definition Map.cpp:2452
Creature * _GetScriptCreature(Object *obj, bool isSource, ScriptInfo const *scriptInfo) const
Definition MapScripts.cpp:186
void _ScriptProcessDoor(Object *source, Object *target, ScriptInfo const *scriptInfo) const
Definition MapScripts.cpp:217
WorldObject * _GetScriptWorldObject(Object *obj, bool isSource, ScriptInfo const *scriptInfo) const
Definition MapScripts.cpp:201
Corpse * GetCorpse(ObjectGuid const &guid)
Definition Map.cpp:2437
Player * _GetScriptPlayerSourceOrTarget(Object *source, Object *target, ScriptInfo const *scriptInfo) const
Definition MapScripts.cpp:98
Unit * _GetScriptUnit(Object *obj, bool isSource, ScriptInfo const *scriptInfo) const
Definition MapScripts.cpp:153
Transport * GetTransport(ObjectGuid const &guid)
Definition Map.cpp:2457
Creature * _GetScriptCreatureSourceOrTarget(Object *source, Object *target, ScriptInfo const *scriptInfo, bool bReverse=false) const
Definition MapScripts.cpp:120
void MovePoint(uint32 id, Position const &pos, ForcedMovement forcedMovement=FORCED_MOVEMENT_NONE, float speed=0.f, bool generatePath=true, bool forceDestination=true, std::optional< AnimTier > animTier=std::nullopt)
Definition MotionMaster.h:241
void MoveWaypoint(uint32 path_id, bool repeatable, PathSource pathSource=PathSource::WAYPOINT_MGR)
Move the unit following a specific path. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:1014
Definition Object.h:111
bool IsPlayer() const
Definition Object.h:207
bool IsGameObject() const
Definition Object.h:219
bool IsCreature() const
Definition Object.h:211
void SendCloseGossip()
Definition GossipDef.cpp:239
void KilledMonsterCredit(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition PlayerQuest.cpp:2001
void GroupEventHappens(uint32 questId, WorldObject const *pEventObject)
Definition PlayerQuest.cpp:1892
void SendMovieStart(uint32 MovieId)
Definition Player.cpp:5876
void FailQuest(uint32 quest_id)
Definition PlayerQuest.cpp:912
PlayerMenu * PlayerTalkClass
Definition Player.h:2286
void RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject *pRewardSource)
Definition Player.cpp:13046
void SetFacingToObject(WorldObject *object, Milliseconds timed=0ms)
Definition Unit.cpp:16078
void SetFacingTo(float ori)
Definition Unit.cpp:16068
virtual void Say(std::string_view text, Language language, WorldObject const *target=nullptr)
Definition Unit.cpp:16797
virtual void Yell(std::string_view text, Language language, WorldObject const *target=nullptr)
Definition Unit.cpp:16802
MotionMaster * GetMotionMaster()
Definition Unit.h:1761
virtual void TextEmote(std::string_view text, WorldObject const *target=nullptr, bool isBossEmote=false)
Definition Unit.cpp:16807
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:1372
void NearTeleportTo(Position &pos, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
Definition Unit.cpp:15572
virtual void Whisper(std::string_view text, Language language, Player *target, bool isBossWhisper=false)
Definition Unit.cpp:16812
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1386
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:1304
Creature * SummonTrigger(float x, float y, float z, float ang, uint32 dur, bool setLevel=false, CreatureAI *(*GetAI)(Creature *)=nullptr)
Definition Object.cpp:2502
Player * GetPlayer(Map const *, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:244
Definition ChatCommandTags.h:258
float Orientation
Definition ObjectMgr.h:253
struct ScriptInfo::@271::@294 Equip
uint32 Flags
Definition ObjectMgr.h:210
struct ScriptInfo::@271::@291 CallScript
struct ScriptInfo::@271::@278 FlagToggle
uint32 FieldID
Definition ObjectMgr.h:222
struct ScriptInfo::@271::@289 DespawnSelf
uint32 QuestID
Definition ObjectMgr.h:258
float SearchRadius
Definition ObjectMgr.h:307
int32 TextID
Definition ObjectMgr.h:211
struct ScriptInfo::@271::@285 RemoveAura
uint32 MovementType
Definition ObjectMgr.h:379
uint32 MovementDistance
Definition ObjectMgr.h:380
float DestX
Definition ObjectMgr.h:232
uint32 ItemEntry
Definition ObjectMgr.h:319
struct ScriptInfo::@271::@276 FieldSet
uint32 ChatType
Definition ObjectMgr.h:209
uint32 SoundID
Definition ObjectMgr.h:312
uint32 CheckIfExists
Definition ObjectMgr.h:278
struct ScriptInfo::@271::@279 TeleportTo
uint32 ScriptID
Definition ObjectMgr.h:337
uint32 ModelID
Definition ObjectMgr.h:367
uint32 FieldValue
Definition ObjectMgr.h:223
struct ScriptInfo::@271::@280 QuestExplored
float PosY
Definition ObjectMgr.h:281
ScriptCommands command
Definition ObjectMgr.h:197
float DestY
Definition ObjectMgr.h:233
struct ScriptInfo::@271::@274 Talk
uint32 PathID
Definition ObjectMgr.h:330
uint32 MapID
Definition ObjectMgr.h:246
uint32 IsRepeatable
Definition ObjectMgr.h:331
struct ScriptInfo::@271::@297 Movement
struct ScriptInfo::@271::@290 LoadPath
struct ScriptInfo::@271::@281 KillCredit
int32 Path
Definition ObjectMgr.h:381
struct ScriptInfo::@271::@282 RespawnGameobject
int32 RemoveCorpse
Definition ObjectMgr.h:345
float PosZ
Definition ObjectMgr.h:282
struct ScriptInfo::@271::@286 CastSpell
uint32 ScriptType
Definition ObjectMgr.h:338
struct ScriptInfo::@271::@292 Kill
struct ScriptInfo::@271::@288 CreateItem
uint32 DespawnDelay
Definition ObjectMgr.h:271
float PosX
Definition ObjectMgr.h:280
int32 Radius
Definition ObjectMgr.h:314
struct ScriptInfo::@271::@277 MoveTo
uint32 TravelTime
Definition ObjectMgr.h:229
uint32 Distance
Definition ObjectMgr.h:259
struct ScriptInfo::@271::@295 Model
uint32 SpellID
Definition ObjectMgr.h:297
std::string GetDebugInfo() const
Definition ObjectMgr.cpp:202
struct ScriptInfo::@271::@283 TempSummonCreature
float DestZ
Definition ObjectMgr.h:234
uint32 MovieID
Definition ObjectMgr.h:374
uint32 EquipmentID
Definition ObjectMgr.h:362
uint32 GOGuid
Definition ObjectMgr.h:270
struct ScriptInfo::@271::@275 Emote
struct ScriptInfo::@271::@287 Playsound
uint32 CreatureEntry
Definition ObjectMgr.h:264
uint32 Amount
Definition ObjectMgr.h:320
struct ScriptInfo::@271::@296 PlayMovie
uint32 EmoteID
Definition ObjectMgr.h:216

References _creatureBySpawnIdStore, _FindGameObject(), _GetScriptCreature(), _GetScriptCreatureSourceOrTarget(), _GetScriptPlayer(), _GetScriptPlayerSourceOrTarget(), _GetScriptUnit(), _GetScriptWorldObject(), _ScriptProcessDoor(), AddToMap(), ScriptInfo::Amount, ScriptInfo::CallScript, Unit::CastSpell(), ScriptInfo::CastSpell, CHAT_MSG_RAID_BOSS_WHISPER, CHAT_TYPE_BOSS_EMOTE, CHAT_TYPE_SAY, CHAT_TYPE_TEXT_EMOTE, CHAT_TYPE_WHISPER, CHAT_TYPE_YELL, ScriptInfo::ChatType, ScriptInfo::CheckIfExists, ScriptInfo::command, Corpse, ScriptInfo::CreateItem, ScriptInfo::CreatureEntry, ScriptInfo::DespawnDelay, ScriptInfo::DespawnSelf, ScriptInfo::DestX, ScriptInfo::DestY, ScriptInfo::DestZ, ScriptInfo::Distance, ScriptInfo::Emote, ScriptInfo::EmoteID, ScriptInfo::Equip, EQUIP_ERR_OK, ScriptInfo::EquipmentID, Player::FailQuest(), ScriptInfo::FieldID, ScriptInfo::FieldSet, ScriptInfo::FieldValue, HashMapHolder< T >::Find(), ScriptInfo::Flags, ScriptInfo::FlagToggle, FORCED_MOVEMENT_NONE, GameObject, GAMEOBJECT_TYPE_BUTTON, GAMEOBJECT_TYPE_DOOR, GAMEOBJECT_TYPE_FISHINGNODE, GAMEOBJECT_TYPE_TRAP, GetClosestCreatureWithEntry(), GetCorpse(), GetCreature(), ScriptInfo::GetDebugInfo(), WorldObject::GetDistance(), GetGameObject(), GameTime::GetGameTime(), GameObject::GetGoType(), Object::GetGUID(), ObjectGuid::GetHigh(), WorldObject::GetMap(), Unit::GetMotionMaster(), Position::GetOrientation(), GetPet(), ObjectAccessor::GetPlayer(), GetScriptsMapByType(), GetTransport(), GO_READY, ScriptInfo::GOGuid, Player::GroupEventHappens(), Object::IsCreature(), Object::IsGameObject(), Object::IsPlayer(), ScriptInfo::IsRepeatable, GameObject::isSpawned(), Object::IsUnit(), WorldObject::IsWithinDistInMap(), Item, ScriptInfo::ItemEntry, JustDied, ScriptInfo::Kill, ScriptInfo::KillCredit, ScriptInfo::LoadPath, LOG_ERROR, m_scriptSchedule, ScriptInfo::MapID, Mo_Transport, ScriptInfo::Model, ScriptInfo::ModelID, ScriptInfo::Movement, ScriptInfo::MovementDistance, ScriptInfo::MovementType, MotionMaster::MovePoint(), ScriptInfo::MoveTo, ScriptInfo::MovieID, Unit::NearTeleportTo(), NULL_BAG, NULL_SLOT, OBJECT_FIELD_ENTRY, ScriptInfo::Orientation, ScriptAction::ownerGUID, ScriptInfo::Path, ScriptInfo::PathID, Pet, Player, ScriptInfo::PlayMovie, ScriptInfo::Playsound, ScriptInfo::PosX, ScriptInfo::PosY, ScriptInfo::PosZ, ScriptInfo::QuestExplored, ScriptInfo::QuestID, ScriptInfo::Radius, RANDOM_MOTION_TYPE, ScriptInfo::RemoveAura, ScriptInfo::RemoveCorpse, ScriptInfo::RespawnGameobject, Unit::Say(), ScriptAction::script, SCRIPT_COMMAND_ACTIVATE_OBJECT, SCRIPT_COMMAND_CALLSCRIPT_TO_UNIT, SCRIPT_COMMAND_CAST_SPELL, SCRIPT_COMMAND_CLOSE_DOOR, SCRIPT_COMMAND_CLOSE_GOSSIP, SCRIPT_COMMAND_CREATE_ITEM, SCRIPT_COMMAND_DESPAWN_SELF, SCRIPT_COMMAND_EMOTE, SCRIPT_COMMAND_EQUIP, SCRIPT_COMMAND_FIELD_SET, SCRIPT_COMMAND_FLAG_REMOVE, SCRIPT_COMMAND_FLAG_SET, SCRIPT_COMMAND_KILL, SCRIPT_COMMAND_KILL_CREDIT, SCRIPT_COMMAND_LOAD_PATH, SCRIPT_COMMAND_MODEL, SCRIPT_COMMAND_MOVE_TO, SCRIPT_COMMAND_MOVEMENT, SCRIPT_COMMAND_OPEN_DOOR, SCRIPT_COMMAND_ORIENTATION, SCRIPT_COMMAND_PLAY_SOUND, SCRIPT_COMMAND_PLAYMOVIE, SCRIPT_COMMAND_QUEST_EXPLORED, SCRIPT_COMMAND_REMOVE_AURA, SCRIPT_COMMAND_RESPAWN_GAMEOBJECT, SCRIPT_COMMAND_TALK, SCRIPT_COMMAND_TELEPORT_TO, SCRIPT_COMMAND_TEMP_SUMMON_CREATURE, ScriptInfo::ScriptID, ScriptsStart(), ScriptInfo::ScriptType, ScriptInfo::SearchRadius, GameObject::SetLootState(), GameObject::SetRespawnTime(), SF_CASTSPELL_SEARCH_CREATURE, SF_CASTSPELL_SOURCE_TO_SOURCE, SF_CASTSPELL_SOURCE_TO_TARGET, SF_CASTSPELL_TARGET_TO_SOURCE, SF_CASTSPELL_TARGET_TO_TARGET, SF_CASTSPELL_TRIGGERED, SF_EMOTE_USE_STATE, SF_KILLCREDIT_REWARD_GROUP, SF_ORIENTATION_FACE_TARGET, SF_PLAYSOUND_DISTANCE_RADIUS, SF_PLAYSOUND_DISTANCE_SOUND, SF_PLAYSOUND_TARGET_PLAYER, SF_REMOVEAURA_REVERSE, SF_TALK_USE_PLAYER, SF_TELEPORT_USE_CREATURE, ScriptInfo::SoundID, ScriptAction::sourceGUID, ScriptInfo::SpellID, sScriptMgr, WorldObject::SummonTrigger(), sWaypointMgr, ScriptInfo::Talk, ScriptAction::targetGUID, ScriptInfo::TeleportTo, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, ScriptInfo::TempSummonCreature, Unit::TextEmote(), ScriptInfo::TextID, Object::ToGameObject(), Object::ToPlayer(), ObjectGuid::ToString(), Object::ToUnit(), Transport, ScriptInfo::TravelTime, Unit, UNIT_NPC_EMOTESTATE, Vehicle, WAYPOINT_MOTION_TYPE, Unit::Whisper(), and Unit::Yell().

Referenced by ScriptCommandStart(), ScriptsStart(), and Update().

◆ ScriptsStart()

void Map::ScriptsStart ( std::map< uint32, std::multimap< uint32, ScriptInfo > > const &  scripts,
uint32  id,
Object *  source,
Object *  target 
)

Put scripts in the execution queue.

  • Find the script map
  • Schedule script execution for all scripts in the script map
  • If one of the effects should be immediate, launch the script execution
32{
34 ScriptMapMap::const_iterator s = scripts.find(id);
35 if (s == scripts.end())
36 return;
37
38 // prepare static data
39 ObjectGuid sourceGUID = source ? source->GetGUID() : ObjectGuid::Empty; //some script commands doesn't have source
40 ObjectGuid targetGUID = target ? target->GetGUID() : ObjectGuid::Empty;
41 ObjectGuid ownerGUID = (source && source->IsItem()) ? ((Item*)source)->GetOwnerGUID() : ObjectGuid::Empty;
42
44 ScriptMap const* s2 = &(s->second);
45 bool immedScript = false;
46 for (ScriptMap::const_iterator iter = s2->begin(); iter != s2->end(); ++iter)
47 {
48 ScriptAction sa;
49 sa.sourceGUID = sourceGUID;
50 sa.targetGUID = targetGUID;
51 sa.ownerGUID = ownerGUID;
52
53 sa.script = &iter->second;
54 m_scriptSchedule.insert(ScriptScheduleMap::value_type(time_t(GameTime::GetGameTime().count() + iter->first), sa));
55 if (iter->first == 0)
56 immedScript = true;
57
58 sScriptMgr->IncreaseScheduledScriptsCount();
59 }
61 if (/*start &&*/ immedScript && !i_scriptLock)
62 {
63 i_scriptLock = true;
65 i_scriptLock = false;
66 }
67}
std::multimap< uint32, ScriptInfo > ScriptMap
Definition ObjectMgr.h:388

References ObjectGuid::Empty, GameTime::GetGameTime(), Object::GetGUID(), i_scriptLock, Object::IsItem(), m_scriptSchedule, ScriptAction::ownerGUID, ScriptAction::script, ScriptsProcess(), ScriptAction::sourceGUID, sScriptMgr, and ScriptAction::targetGUID.

Referenced by MotionTransport::DoEventIfAny(), FlightPathMovementGenerator::DoEventIfAny(), WorldSession::DoLootRelease(), WaypointMovementGenerator< Creature >::DoUpdate(), Spell::EffectDummy(), Spell::EffectScriptEffect(), Spell::EffectSendEvent(), WaypointMovementGenerator< Creature >::ProcessWaypointArrival(), ScriptsProcess(), and GameObject::Use().

◆ SendInitSelf()

void Map::SendInitSelf ( Player *  player)
1647{
1648 LOG_DEBUG("maps", "Creating player data for himself {}", player->GetGUID().ToString());
1649
1650 WorldPacket packet;
1651 UpdateData data;
1652
1653 // attach to player data current transport data
1654 if (Transport* transport = player->GetTransport())
1655 transport->BuildCreateUpdateBlockForPlayer(&data, player);
1656
1657 // build data for self presence in world at own client (one time for map)
1658 player->BuildCreateUpdateBlockForPlayer(&data, player);
1659
1660 // build and send self update packet before sending to player his own auras
1661 data.BuildPacket(packet);
1662 player->SendDirectMessage(&packet);
1663
1664 // send to player his own auras (this is needed here for timely initialization of some fields on client)
1665 player->GetAurasForTarget(player, true);
1666
1667 // clean buffers for further work
1668 packet.clear();
1669 data.Clear();
1670
1671 // build other passengers at transport also (they always visible and marked as visible and will not send at visibility update at add to map
1672 if (Transport* transport = player->GetTransport())
1673 for (Transport::PassengerSet::const_iterator itr = transport->GetPassengers().begin(); itr != transport->GetPassengers().end(); ++itr)
1674 if (player != (*itr) && player->HaveAtClient(*itr))
1675 (*itr)->BuildCreateUpdateBlockForPlayer(&data, player);
1676
1677 data.BuildPacket(packet);
1678 player->SendDirectMessage(&packet);
1679}
void clear()
Definition ByteBuffer.h:122
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:5864
bool HaveAtClient(WorldObject const *u) const
Definition Player.cpp:11595
void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) override
Definition Player.cpp:3989
void GetAurasForTarget(Unit *target, bool force=false)
Definition Player.cpp:12337
void Clear()
Definition UpdateData.cpp:71
Transport * GetTransport() const
Definition Object.h:701

References Player::BuildCreateUpdateBlockForPlayer(), UpdateData::BuildPacket(), UpdateData::Clear(), ByteBuffer::clear(), Player::GetAurasForTarget(), Object::GetGUID(), WorldObject::GetTransport(), Player::HaveAtClient(), LOG_DEBUG, Player::SendDirectMessage(), and ObjectGuid::ToString().

Referenced by AddPlayerToMap(), and WorldSession::HandlePlayerLoginToCharInWorld().

◆ SendInitTransports()

void Map::SendInitTransports ( Player *  player)
1693{
1694 if (_transports.empty())
1695 return;
1696
1697 // Hack to send out transports
1698 UpdateData transData;
1699 for (TransportsContainer::const_iterator itr = _transports.begin(); itr != _transports.end(); ++itr)
1700 if (*itr != player->GetTransport() && (!sToCloud9Sidecar->ClusterModeEnabled() || player->InSamePhase(*itr)))
1701 (*itr)->BuildCreateUpdateBlockForPlayer(&transData, player);
1702
1703 if (!transData.HasData())
1704 return;
1705
1706 WorldPacket packet;
1707 transData.BuildPacket(packet);
1708 player->SendDirectMessage(&packet);
1709}
#define sToCloud9Sidecar
Definition TC9Sidecar.h:81
bool HasData() const
Definition UpdateData.h:60
bool InSamePhase(WorldObject const *obj) const
Definition Object.h:524

References _transports, UpdateData::BuildPacket(), WorldObject::GetTransport(), UpdateData::HasData(), WorldObject::InSamePhase(), Player::SendDirectMessage(), and sToCloud9Sidecar.

Referenced by AddPlayerToMap(), and WorldSession::HandlePlayerLoginToCharInWorld().

◆ SendObjectUpdates()

void Map::SendObjectUpdates ( )
private
1731{
1732 UpdateDataMapType update_players;
1733
1734 while (!_updateObjects.empty())
1735 {
1736 Object* obj = *_updateObjects.begin();
1737 ASSERT(obj->IsInWorld());
1738
1739 _updateObjects.erase(_updateObjects.begin());
1740 obj->BuildUpdate(update_players);
1741 }
1742
1743 WorldPacket packet; // here we allocate a std::vector with a size of 0x10000
1744 for (UpdateDataMapType::iterator iter = update_players.begin(); iter != update_players.end(); ++iter)
1745 {
1746 if (!sScriptMgr->CanSendObjectUpdatesToPlayer(this, iter->first))
1747 {
1748 iter->second.Clear();
1749 continue;
1750 }
1751
1752 iter->second.BuildPacket(packet);
1753 iter->first->SendDirectMessage(&packet);
1754 packet.clear(); // clean the string
1755 }
1756}
std::unordered_map< Player *, UpdateData > UpdateDataMapType
Definition Object.h:106
virtual void BuildUpdate(UpdateDataMapType &)
Definition Object.h:198

References _updateObjects, ASSERT, Object::BuildUpdate(), ByteBuffer::clear(), Object::IsInWorld(), and sScriptMgr.

Referenced by Update().

◆ SendRemoveTransports()

void Map::SendRemoveTransports ( Player *  player)
1712{
1713 if (_transports.empty())
1714 return;
1715
1716 // Hack to send out transports
1717 UpdateData transData;
1718 for (TransportsContainer::const_iterator itr = _transports.begin(); itr != _transports.end(); ++itr)
1719 if (*itr != player->GetTransport())
1720 (*itr)->BuildOutOfRangeUpdateBlock(&transData);
1721
1722 if (!transData.HasData())
1723 return;
1724
1725 WorldPacket packet;
1726 transData.BuildPacket(packet);
1727 player->SendDirectMessage(&packet);
1728}

References _transports, UpdateData::BuildPacket(), WorldObject::GetTransport(), UpdateData::HasData(), and Player::SendDirectMessage().

Referenced by RemovePlayerFromMap().

◆ SendToPlayers()

void Map::SendToPlayers ( WorldPacket const *  data) const
1929{
1930 for (MapRefMgr::const_iterator itr = m_mapRefMgr.begin(); itr != m_mapRefMgr.end(); ++itr)
1931 itr->GetSource()->SendDirectMessage(data);
1932}

References MapRefMgr::begin(), MapRefMgr::end(), and m_mapRefMgr.

Referenced by boss_ossirian::JustEngagedWith(), and InstanceScript::SendEncounterUnit().

◆ SendZoneDynamicInfo()

void Map::SendZoneDynamicInfo ( uint32  zoneId,
Player *  player 
) const
3225{
3226 ZoneDynamicInfoMap::const_iterator itr = _zoneDynamicInfo.find(zoneId);
3227 if (itr == _zoneDynamicInfo.end())
3228 return;
3229
3230 if (uint32 music = itr->second.MusicId)
3231 player->SendDirectMessage(WorldPackets::Misc::PlayMusic(music).Write());
3232
3233 SendZoneWeather(itr->second, player);
3234
3235 if (uint32 overrideLight = itr->second.OverrideLightId)
3236 {
3237 WorldPacket data(SMSG_OVERRIDE_LIGHT, 4 + 4 + 4);
3238 data << uint32(_defaultLight);
3239 data << uint32(overrideLight);
3240 data << uint32(itr->second.LightFadeInTime);
3241 player->SendDirectMessage(&data);
3242 }
3243}
void SendZoneWeather(uint32 zoneId, Player *player) const
Definition Map.cpp:3245
Definition MiscPackets.h:58
@ SMSG_OVERRIDE_LIGHT
Definition Opcodes.h:1072

References _defaultLight, _zoneDynamicInfo, Player::SendDirectMessage(), SendZoneWeather(), and SMSG_OVERRIDE_LIGHT.

Referenced by Player::UpdateZone().

◆ SendZoneMessage()

bool Map::SendZoneMessage ( uint32  zone,
WorldPacket const *  packet,
WorldSession const *  self = nullptr,
TeamId  teamId = TEAM_NEUTRAL 
) const

Send a packet to all players (or players selected team) in the zone (except self if mentioned)

3197{
3198 bool foundPlayerToSend = false;
3199
3200 for (MapReference const& ref : GetPlayers())
3201 {
3202 Player* player = ref.GetSource();
3203 if (player->IsInWorld() &&
3204 player->GetZoneId() == zone &&
3205 player->GetSession() != self &&
3206 (teamId == TEAM_NEUTRAL || player->GetTeamId() == teamId))
3207 {
3208 player->SendDirectMessage(packet);
3209 foundPlayerToSend = true;
3210 }
3211 }
3212
3213 return foundPlayerToSend;
3214}
@ TEAM_NEUTRAL
Definition SharedDefines.h:750
Definition MapReference.h:25
TeamId GetTeamId(bool original=false) const
Definition Player.h:2139
WorldSession * GetSession() const
Definition Player.h:2031

References GetPlayers(), Player::GetSession(), Player::GetTeamId(), WorldObject::GetZoneId(), Object::IsInWorld(), Player::SendDirectMessage(), and TEAM_NEUTRAL.

Referenced by SendZoneText(), SetZoneMusic(), SetZoneOverrideLight(), SetZoneWeather(), and Weather::UpdateWeather().

◆ SendZoneText()

void Map::SendZoneText ( uint32  zoneId,
char const *  text,
WorldSession const *  self = nullptr,
TeamId  teamId = TEAM_NEUTRAL 
) const

Send a System Message to all players in the zone (except self if mentioned)

3218{
3219 WorldPacket data;
3220 ChatHandler::BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, text);
3221 SendZoneMessage(zoneId, &data, self, teamId);
3222}
@ CHAT_MSG_SYSTEM
Definition SharedDefines.h:3385
@ LANG_UNIVERSAL
Definition SharedDefines.h:723
static std::size_t BuildChatPacket(WorldPacket &data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag, std::string const &senderName="", std::string const &receiverName="", uint32 achievementId=0, bool gmMessage=false, std::string const &channelName="")
Definition Chat.cpp:273
bool SendZoneMessage(uint32 zone, WorldPacket const *packet, WorldSession const *self=nullptr, TeamId teamId=TEAM_NEUTRAL) const
Send a packet to all players (or players selected team) in the zone (except self if mentioned)
Definition Map.cpp:3196

References ChatHandler::BuildChatPacket(), CHAT_MSG_SYSTEM, LANG_UNIVERSAL, and SendZoneMessage().

Referenced by OPvPCapturePointEP_EWT::ChangeState(), OPvPCapturePointEP_NPT::ChangeState(), OPvPCapturePointEP_CGT::ChangeState(), OPvPCapturePointEP_PWT::ChangeState(), OPvPCapturePointHP::ChangeState(), OPvPCapturePointTF::ChangeState(), OPvPCapturePointZM_Beacon::ChangeState(), OPvPCapturePointNA::FactionTakeOver(), OutdoorPvPSI::HandleAreaTrigger(), OPvPCapturePointZM_Graveyard::HandleOpenGo(), and OPvPCapturePointNA::Update().

◆ SendZoneWeather() [1/2]

void Map::SendZoneWeather ( uint32  zoneId,
Player *  player 
) const
3246{
3247 ZoneDynamicInfoMap::const_iterator itr = _zoneDynamicInfo.find(zoneId);
3248 if (itr == _zoneDynamicInfo.end())
3249 return;
3250
3251 SendZoneWeather(itr->second, player);
3252}

References _zoneDynamicInfo, and SendZoneWeather().

Referenced by SendZoneDynamicInfo(), and SendZoneWeather().

◆ SendZoneWeather() [2/2]

void Map::SendZoneWeather ( ZoneDynamicInfo const &  zoneDynamicInfo,
Player *  player 
) const
3255{
3256 if (WeatherState weatherId = zoneDynamicInfo.WeatherId)
3257 {
3258 WorldPackets::Misc::Weather weather(weatherId, zoneDynamicInfo.WeatherGrade);
3259 player->SendDirectMessage(weather.Write());
3260 }
3261 else if (zoneDynamicInfo.DefaultWeather)
3262 zoneDynamicInfo.DefaultWeather->SendWeatherUpdateToPlayer(player);
3263 else
3265}
Definition MiscPackets.h:32
WeatherState
Definition Weather.h:46
static void SendFineWeatherUpdateToPlayer(Player *player)
Definition Weather.cpp:193

References ZoneDynamicInfo::DefaultWeather, Player::SendDirectMessage(), Weather::SendFineWeatherUpdateToPlayer(), ZoneDynamicInfo::WeatherGrade, ZoneDynamicInfo::WeatherId, and WorldPackets::Misc::Weather::Write().

◆ SetVisibilityRange()

◆ SetZoneMusic()

◆ SetZoneOverrideLight()

void Map::SetZoneOverrideLight ( uint32  zoneId,
uint32  lightId,
Milliseconds  fadeInTime 
)
3331{
3332 ZoneDynamicInfo& info = _zoneDynamicInfo[zoneId];
3333 info.OverrideLightId = lightId;
3334 info.LightFadeInTime = static_cast<uint32>(fadeInTime.count());
3335
3336 WorldPacket data(SMSG_OVERRIDE_LIGHT, 4 + 4 + 4);
3337 data << uint32(_defaultLight);
3338 data << uint32(lightId);
3339 data << uint32(static_cast<uint32>(fadeInTime.count()));
3340 SendZoneMessage(zoneId, &data);
3341}
uint32 LightFadeInTime
Definition Map.h:146
uint32 OverrideLightId
Definition Map.h:145

References _defaultLight, _zoneDynamicInfo, ZoneDynamicInfo::LightFadeInTime, ZoneDynamicInfo::OverrideLightId, SendZoneMessage(), and SMSG_OVERRIDE_LIGHT.

Referenced by boss_the_lich_king::boss_the_lich_kingAI::DoAction(), boss_malygos::EnterEvadeMode(), boss_malygos::MovementInform(), boss_the_lich_king::boss_the_lich_kingAI::SpellHitTarget(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), and boss_malygos::UpdateAI().

◆ SetZoneWeather()

void Map::SetZoneWeather ( uint32  zoneId,
WeatherState  weatherId,
float  weatherGrade 
)

◆ SpawnGroupDespawn()

bool Map::SpawnGroupDespawn ( uint32  groupId,
bool  deleteRespawnTimes = false 
)
2727{
2728 SpawnGroupTemplateData const* groupData = sObjectMgr->GetSpawnGroupData(groupId);
2729 if (!groupData || (groupData->flags & SPAWNGROUP_FLAG_SYSTEM))
2730 {
2731 LOG_ERROR("maps", "Tried to despawn non-existing (or system) spawn group {}. Blocked.", groupId);
2732 return false;
2733 }
2734
2735 if (groupData->mapId != SPAWNGROUP_MAP_UNSET && groupData->mapId != GetId())
2736 {
2737 LOG_ERROR("maps", "Tried to despawn group {} on map {}, but group has map {}. Blocked.",
2738 groupId, GetId(), groupData->mapId);
2739 return false;
2740 }
2741
2742 // Mark group as inactive on this map (toggle to inactive state)
2743 if (groupData->flags & SPAWNGROUP_FLAG_MANUAL_SPAWN)
2744 _toggledSpawnGroupIds.erase(groupId);
2745 else
2746 _toggledSpawnGroupIds.insert(groupId);
2747
2748 std::vector<WorldObject*> toUnload;
2749 auto range = sObjectMgr->GetSpawnDataForGroup(groupId);
2750 for (auto it = range.first; it != range.second; ++it)
2751 {
2752 SpawnData const* data = it->second;
2753 ObjectGuid::LowType spawnId = data->spawnId;
2754
2755 if (deleteRespawnTimes)
2756 RemoveRespawnTime(data->type, spawnId);
2757
2758 switch (data->type)
2759 {
2761 {
2762 auto bounds = _creatureBySpawnIdStore.equal_range(spawnId);
2763 for (auto itr = bounds.first; itr != bounds.second; ++itr)
2764 toUnload.emplace_back(itr->second);
2765 break;
2766 }
2768 {
2769 auto bounds = _gameobjectBySpawnIdStore.equal_range(spawnId);
2770 for (auto itr = bounds.first; itr != bounds.second; ++itr)
2771 toUnload.emplace_back(itr->second);
2772 break;
2773 }
2774 default:
2775 break;
2776 }
2777 }
2778
2779 for (WorldObject* obj : toUnload)
2780 obj->AddObjectToRemoveList();
2781
2782 return true;
2783}
constexpr uint32 SPAWNGROUP_MAP_UNSET
Definition SpawnData.h:55
void AddObjectToRemoveList(WorldObject *obj)
Definition Map.cpp:1823
void RemoveRespawnTime(SpawnObjectType type, ObjectGuid::LowType spawnId)
Definition Map.h:466
Definition SpawnData.h:66
ObjectGuid::LowType spawnId
Definition SpawnData.h:68
SpawnObjectType const type
Definition SpawnData.h:67
uint32 mapId
Definition SpawnData.h:61

References _creatureBySpawnIdStore, _gameobjectBySpawnIdStore, _toggledSpawnGroupIds, SpawnGroupTemplateData::flags, GetId(), LOG_ERROR, SpawnGroupTemplateData::mapId, RemoveRespawnTime(), sObjectMgr, SPAWN_TYPE_CREATURE, SPAWN_TYPE_GAMEOBJECT, SPAWNGROUP_FLAG_MANUAL_SPAWN, SPAWNGROUP_FLAG_SYSTEM, SPAWNGROUP_MAP_UNSET, SpawnData::spawnId, and SpawnData::type.

Referenced by gobject_commandscript::HandleGameObjectDespawnGroupCommand(), npc_commandscript::HandleNpcDespawnGroupCommand(), and SmartScript::ProcessAction().

◆ SpawnGroupSpawn()

bool Map::SpawnGroupSpawn ( uint32  groupId,
bool  ignoreRespawn = false,
bool  force = false 
)
2643{
2644 SpawnGroupTemplateData const* groupData = sObjectMgr->GetSpawnGroupData(groupId);
2645 if (!groupData || (groupData->flags & SPAWNGROUP_FLAG_SYSTEM))
2646 {
2647 LOG_ERROR("maps", "Tried to spawn non-existing (or system) spawn group {}. Blocked.", groupId);
2648 return false;
2649 }
2650
2651 if (groupData->mapId != SPAWNGROUP_MAP_UNSET && groupData->mapId != GetId())
2652 {
2653 LOG_ERROR("maps", "Tried to spawn group {} on map {}, but group has map {}. Blocked.",
2654 groupId, GetId(), groupData->mapId);
2655 return false;
2656 }
2657
2658 // Mark group as active on this map (toggle to active state)
2659 if (groupData->flags & SPAWNGROUP_FLAG_MANUAL_SPAWN)
2660 _toggledSpawnGroupIds.insert(groupId);
2661 else
2662 _toggledSpawnGroupIds.erase(groupId);
2663
2664 auto range = sObjectMgr->GetSpawnDataForGroup(groupId);
2665 for (auto it = range.first; it != range.second; ++it)
2666 {
2667 SpawnData const* data = it->second;
2668 ObjectGuid::LowType spawnId = data->spawnId;
2669
2670 // Check if there's already an alive instance
2671 if (!force)
2672 {
2673 if (data->type == SPAWN_TYPE_CREATURE)
2674 {
2675 auto bounds = _creatureBySpawnIdStore.equal_range(spawnId);
2676 bool alive = false;
2677 for (auto itr = bounds.first; itr != bounds.second; ++itr)
2678 if (itr->second->IsAlive())
2679 alive = true;
2680 if (alive)
2681 continue;
2682 }
2683 else if (data->type == SPAWN_TYPE_GAMEOBJECT)
2684 {
2685 if (_gameobjectBySpawnIdStore.count(spawnId))
2686 continue;
2687 }
2688 }
2689
2690 time_t respawnTime = GetRespawnTime(data->type, spawnId);
2691 if (respawnTime && respawnTime > GameTime::GetGameTime().count())
2692 {
2693 if (!force && !ignoreRespawn)
2694 continue;
2695 RemoveRespawnTime(data->type, spawnId);
2696 }
2697
2698 // Don't spawn if grid isn't loaded (will be handled in grid loader)
2699 if (!IsGridLoaded(data->posX, data->posY))
2700 continue;
2701
2702 switch (data->type)
2703 {
2705 {
2706 Creature* creature = new Creature();
2707 if (!creature->LoadCreatureFromDB(spawnId, this, true, true))
2708 delete creature;
2709 break;
2710 }
2712 {
2713 GameObject* gameobject = new GameObject();
2714 if (!gameobject->LoadGameObjectFromDB(spawnId, this, true))
2715 delete gameobject;
2716 break;
2717 }
2718 default:
2719 break;
2720 }
2721 }
2722
2723 return true;
2724}
time_t GetRespawnTime(SpawnObjectType type, ObjectGuid::LowType spawnId) const
Definition Map.h:454

References _creatureBySpawnIdStore, _gameobjectBySpawnIdStore, _toggledSpawnGroupIds, SpawnGroupTemplateData::flags, GameTime::GetGameTime(), GetId(), GetRespawnTime(), IsGridLoaded(), Creature::LoadCreatureFromDB(), GameObject::LoadGameObjectFromDB(), LOG_ERROR, SpawnGroupTemplateData::mapId, SpawnData::posX, SpawnData::posY, RemoveRespawnTime(), sObjectMgr, SPAWN_TYPE_CREATURE, SPAWN_TYPE_GAMEOBJECT, SPAWNGROUP_FLAG_MANUAL_SPAWN, SPAWNGROUP_FLAG_SYSTEM, SPAWNGROUP_MAP_UNSET, SpawnData::spawnId, and SpawnData::type.

Referenced by gobject_commandscript::HandleGameObjectSpawnGroupCommand(), npc_commandscript::HandleNpcSpawnGroupCommand(), and SmartScript::ProcessAction().

◆ StartPlayersRedirectKickTimer()

void Map::StartPlayersRedirectKickTimer ( )
1885{
1886 for (MapRefMgr::iterator itr = m_mapRefMgr.begin(); itr != m_mapRefMgr.end(); ++itr)
1887 itr->GetSource()->SendSystemMessage("Preparing to enter parallel dimension... One minute!\nAccelerate transfer: Teleport or type \"/ready\" in chat.");
1888
1891
1893
1894}
constexpr auto SECOND
Definition Common.h:46
TimeTrackerSmall _lastAnnounceRedirectKickTimer
Definition Map.h:711
void Update(int32 diff)
Definition Timer.h:239
void Reset(int32 interval)
Definition Timer.h:249

References _lastAnnounceRedirectKickTimer, _redirectKickTimer, MapRefMgr::begin(), MapRefMgr::end(), IN_MILLISECONDS, m_mapRefMgr, TimeTrackerSmall::Reset(), SECOND, and TimeTrackerSmall::Update().

◆ StopPlayersRedirectKickTimer()

void Map::StopPlayersRedirectKickTimer ( )

◆ SummonCreature()

TempSummon * Map::SummonCreature ( uint32  entry,
Position const &  pos,
SummonPropertiesEntry const *  properties = nullptr,
uint32  duration = 0,
WorldObject *  summoner = nullptr,
uint32  spellId = 0,
uint32  vehId = 0,
bool  visibleBySummonerOnly = false 
)
2247{
2248 uint32 mask = UNIT_MASK_SUMMON;
2249 if (properties)
2250 {
2251 switch (properties->Category)
2252 {
2254 mask = UNIT_MASK_GUARDIAN;
2255 break;
2257 mask = UNIT_MASK_PUPPET;
2258 break;
2260 mask = UNIT_MASK_MINION;
2261 break;
2265 {
2266 switch (properties->Type)
2267 {
2268 case SUMMON_TYPE_MINION:
2271 mask = UNIT_MASK_GUARDIAN;
2272 break;
2273 case SUMMON_TYPE_TOTEM:
2275 mask = UNIT_MASK_TOTEM;
2276 break;
2279 mask = UNIT_MASK_SUMMON;
2280 break;
2282 case SUMMON_TYPE_JEEVES:
2283 mask = UNIT_MASK_MINION;
2284 break;
2285 default:
2286 if (properties->Flags & 512) // Mirror Image, Summon Gargoyle
2287 mask = UNIT_MASK_GUARDIAN;
2288 break;
2289 }
2290 break;
2291 }
2292 default:
2293 return nullptr;
2294 }
2295 }
2296
2297 uint32 phase = PHASEMASK_NORMAL;
2298 if (summoner)
2299 phase = summoner->GetPhaseMask();
2300
2301 TempSummon* summon = nullptr;
2302 switch (mask)
2303 {
2304 case UNIT_MASK_SUMMON:
2305 summon = new TempSummon(properties, summoner ? summoner->GetGUID() : ObjectGuid::Empty);
2306 break;
2307 case UNIT_MASK_GUARDIAN:
2308 summon = new Guardian(properties, summoner ? summoner->GetGUID() : ObjectGuid::Empty);
2309 break;
2310 case UNIT_MASK_PUPPET:
2311 summon = new Puppet(properties, summoner ? summoner->GetGUID() : ObjectGuid::Empty);
2312 break;
2313 case UNIT_MASK_TOTEM:
2314 summon = new Totem(properties, summoner ? summoner->GetGUID() : ObjectGuid::Empty);
2315 break;
2316 case UNIT_MASK_MINION:
2317 summon = new Minion(properties, summoner ? summoner->GetGUID() : ObjectGuid::Empty);
2318 break;
2319 default:
2320 return nullptr;
2321 }
2322
2323 EnsureGridLoaded(Cell(pos.GetPositionX(), pos.GetPositionY()));
2324 if (!summon->Create(GenerateLowGuid<HighGuid::Unit>(), this, phase, entry, vehId, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()))
2325 {
2326 delete summon;
2327 return nullptr;
2328 }
2329
2330 summon->SetUInt32Value(UNIT_CREATED_BY_SPELL, spellId);
2331
2332 summon->SetHomePosition(pos);
2333
2334 summon->InitStats(duration);
2335
2336 summon->SetVisibleBySummonerOnly(visibleBySummonerOnly);
2337
2338 bool summonerHasTransport = summoner && summoner->GetTransport();
2339 bool summonerIsVehicle = summoner && summoner->IsUnit() && summoner->ToUnit()->IsVehicle();
2340 bool checkTransport = summon->GetOwnerGUID().IsPlayer() || (summonerHasTransport && !summonerIsVehicle);
2341 if (!AddToMap(summon->ToCreature(), checkTransport))
2342 {
2343 delete summon;
2344 return nullptr;
2345 }
2346
2347 summon->InitSummon();
2348
2349 // call MoveInLineOfSight for nearby players and creatures; players are visited
2350 // first (grid typelist order) so aggressive summons prefer them over pets/totems
2351 Acore::AIRelocationNotifier notifier(*summon, true);
2352 Cell::VisitObjects(summon, notifier, GetVisibilityRange());
2353
2354 return summon;
2355}
@ PHASEMASK_NORMAL
Definition Object.h:64
@ SUMMON_TYPE_VEHICLE2
Definition SharedDefines.h:3537
@ SUMMON_TYPE_LIGHTWELL
Definition SharedDefines.h:3538
@ SUMMON_TYPE_MINION
Definition SharedDefines.h:3530
@ SUMMON_TYPE_GUARDIAN
Definition SharedDefines.h:3529
@ SUMMON_TYPE_JEEVES
Definition SharedDefines.h:3539
@ SUMMON_TYPE_TOTEM
Definition SharedDefines.h:3531
@ SUMMON_TYPE_VEHICLE
Definition SharedDefines.h:3536
@ SUMMON_TYPE_MINIPET
Definition SharedDefines.h:3532
@ SUMMON_TYPE_GUARDIAN2
Definition SharedDefines.h:3533
@ SUMMON_CATEGORY_PET
Definition SharedDefines.h:3518
@ SUMMON_CATEGORY_VEHICLE
Definition SharedDefines.h:3520
@ SUMMON_CATEGORY_ALLY
Definition SharedDefines.h:3517
@ SUMMON_CATEGORY_PUPPET
Definition SharedDefines.h:3519
@ SUMMON_CATEGORY_WILD
Definition SharedDefines.h:3516
@ SUMMON_CATEGORY_UNK
Definition SharedDefines.h:3521
@ UNIT_MASK_PUPPET
Definition UnitDefines.h:165
@ UNIT_MASK_TOTEM
Definition UnitDefines.h:162
@ UNIT_MASK_SUMMON
Definition UnitDefines.h:159
@ UNIT_MASK_GUARDIAN
Definition UnitDefines.h:161
@ UNIT_MASK_MINION
Definition UnitDefines.h:160
@ UNIT_CREATED_BY_SPELL
Definition UpdateFields.h:138
void SetHomePosition(float x, float y, float z, float o)
Definition Creature.h:347
bool Create(ObjectGuid::LowType guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 vehId, float x, float y, float z, float ang, CreatureData const *data=nullptr)
Definition Creature.cpp:1168
Definition TemporarySummon.h:106
float GetVisibilityRange() const
Definition Map.h:200
Definition TemporarySummon.h:87
bool IsPlayer() const
Definition ObjectGuid.h:172
Definition TemporarySummon.h:125
Definition TemporarySummon.h:50
virtual void InitSummon()
Definition TemporarySummon.cpp:257
virtual void InitStats(uint32 lifetime)
Definition TemporarySummon.cpp:200
void SetVisibleBySummonerOnly(bool visibleBySummonerOnly)
Definition TemporarySummon.h:71
Definition Totem.h:51
ObjectGuid GetOwnerGUID() const override
Definition Unit.h:714
void SetUInt32Value(uint16 index, uint32 value)
Definition Unit.cpp:16980
Definition GridNotifiers.h:91
static void VisitObjects(WorldObject const *obj, T &visitor, float radius)
Definition CellImpl.h:165

References AddToMap(), SummonPropertiesEntry::Category, Creature::Create(), ObjectGuid::Empty, EnsureGridLoaded(), SummonPropertiesEntry::Flags, Object::GetGUID(), Position::GetOrientation(), Unit::GetOwnerGUID(), WorldObject::GetPhaseMask(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::GetTransport(), GetVisibilityRange(), TempSummon::InitStats(), TempSummon::InitSummon(), ObjectGuid::IsPlayer(), Object::IsUnit(), Unit::IsVehicle(), PHASEMASK_NORMAL, Creature::SetHomePosition(), Unit::SetUInt32Value(), TempSummon::SetVisibleBySummonerOnly(), SUMMON_CATEGORY_ALLY, SUMMON_CATEGORY_PET, SUMMON_CATEGORY_PUPPET, SUMMON_CATEGORY_UNK, SUMMON_CATEGORY_VEHICLE, SUMMON_CATEGORY_WILD, SUMMON_TYPE_GUARDIAN, SUMMON_TYPE_GUARDIAN2, SUMMON_TYPE_JEEVES, SUMMON_TYPE_LIGHTWELL, SUMMON_TYPE_MINION, SUMMON_TYPE_MINIPET, SUMMON_TYPE_TOTEM, SUMMON_TYPE_VEHICLE, SUMMON_TYPE_VEHICLE2, Object::ToCreature(), Object::ToUnit(), SummonPropertiesEntry::Type, UNIT_CREATED_BY_SPELL, UNIT_MASK_GUARDIAN, UNIT_MASK_MINION, UNIT_MASK_PUPPET, UNIT_MASK_SUMMON, UNIT_MASK_TOTEM, and Cell::VisitObjects().

Referenced by instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::ChromieWhisper(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::DoSummonGrandChampion(), Spell::EffectSummonType(), instance_forge_of_souls::instance_forge_of_souls_InstanceScript::HandleOutro(), spell_temple_of_atal_hakkar_awaken_the_soulflayer::HandleSendEvent(), spell_halion_damage_aoe_summon::HandleSummon(), spell_putricide_mutated_transformation::HandleSummon(), spell_q13010_jokkum_summon::HandleSummon(), spell_wintergrasp_create_vehicle::HandleSummon(), boss_varos::boss_varosAI::JustDied(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), instance_forge_of_souls::instance_forge_of_souls_InstanceScript::OnPlayerEnter(), instance_ulduar::instance_ulduar_InstanceMapScript::OnPlayerEnter(), at_tyrannus_event_starter::OnTrigger(), instance_karazhan::instance_karazhan_InstanceMapScript::OnUnitDeath(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnUnitDeath(), spell_halion_twilight_phasing::Phase(), instance_magisters_terrace::instance_magisters_terrace_InstanceMapScript::ProcessEvent(), instance_sethekk_halls::instance_sethekk_halls_InstanceMapScript::ProcessEvent(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::ProcessEvent(), instance_stratholme::instance_stratholme_InstanceMapScript::ProcessSlaughterEvent(), instance_blackrock_depths::ReplaceMoiraIfSaved(), boss_ossirian::Reset(), ScheduleCreatureRespawn(), instance_the_black_morass::instance_the_black_morass_InstanceMapScript::ScheduleNextPortal(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SetBossState(), instance_ulduar::instance_ulduar_InstanceMapScript::SetBossState(), instance_blackrock_depths::SetData(), instance_scholomance::instance_scholomance_InstanceMapScript::SetData(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::SetData(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::SetData(), instance_pit_of_saron::instance_pit_of_saron_InstanceScript::SetData(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SetData(), instance_zulfarrak::instance_zulfarrak_InstanceMapScript::SpawnPyramidWave(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SpawnSaurfangCampWorkers(), SummonCreatureGroup(), instance_violet_hold::instance_violet_hold_InstanceMapScript::SummonDefenseSystem(), Spell::SummonGuardian(), instance_zulaman::instance_zulaman_InstanceMapScript::SummonHostage(), instance_molten_core::SummonMajordomoExecutus(), WorldState::SummonMouth(), WorldState::SummonPallid(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SummonSaurfangCampVendor(), instance_blackrock_spire::SummonSolakarWave(), instance_blackwing_lair::Update(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::Update(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::Update(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::Update(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::Update(), instance_ulduar::instance_ulduar_InstanceMapScript::Update(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_brann_bronzebeard_algalon::UpdateAI(), and instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::UpdateEventState().

◆ SummonCreatureGroup()

void Map::SummonCreatureGroup ( uint8  group,
std::list< TempSummon * > *  list = nullptr 
)

Summons group of creatures.

Parameters
groupId of group to summon.
listList to store pointers to summoned creatures.
2365{
2366 std::vector<TempSummonData> const* data = sObjectMgr->GetSummonGroup(GetId(), SUMMONER_TYPE_MAP, group);
2367 if (!data)
2368 return;
2369
2370 for (std::vector<TempSummonData>::const_iterator itr = data->begin(); itr != data->end(); ++itr)
2371 if (TempSummon* summon = SummonCreature(itr->entry, itr->pos, nullptr, itr->time))
2372 if (list)
2373 list->push_back(summon);
2374}
@ SUMMONER_TYPE_MAP
Definition TemporarySummon.h:28

References GetId(), sObjectMgr, SummonCreature(), and SUMMONER_TYPE_MAP.

Referenced by at_ancient_leaf::OnTrigger(), instance_hyjal::instance_mount_hyjal_InstanceMapScript::ScheduleWaves(), instance_ulduar::instance_ulduar_InstanceMapScript::SpawnLeviathanOutro(), and instance_ulduar::instance_ulduar_InstanceMapScript::StartLeviathanOutroSequence().

◆ SummonGameObject() [1/2]

GameObject * Map::SummonGameObject ( uint32  entry,
float  x,
float  y,
float  z,
float  ang,
float  rotation0,
float  rotation1,
float  rotation2,
float  rotation3,
uint32  respawnTime,
bool  checkTransport = true 
)
2401{
2402 GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry);
2403 if (!goinfo)
2404 {
2405 LOG_ERROR("sql.sql", "Gameobject template {} not found in database!", entry);
2406 return nullptr;
2407 }
2408
2409 GameObject* go = sObjectMgr->IsGameObjectStaticTransport(entry) ? new StaticTransport() : new GameObject();
2410 if (!go->Create(GenerateLowGuid<HighGuid::GameObject>(), entry, this, PHASEMASK_NORMAL, x, y, z, ang, G3D::Quat(rotation0, rotation1, rotation2, rotation3), 100, GO_STATE_READY))
2411 {
2412 delete go;
2413 return nullptr;
2414 }
2415
2416 // Xinef: if gameobject is temporary, set custom spellid
2417 if (respawnTime)
2418 go->SetSpellId(1);
2419
2420 go->SetRespawnTime(respawnTime);
2421 go->SetSpawnedByDefault(false);
2422 AddToMap(go, checkTransport);
2423 return go;
2424}
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:271
void SetSpawnedByDefault(bool b)
Definition GameObject.h:198
void SetSpellId(uint32 id)
Definition GameObject.h:178
Definition Transport.h:120
Definition GameObjectData.h:32

References AddToMap(), GameObject::Create(), GO_STATE_READY, LOG_ERROR, PHASEMASK_NORMAL, GameObject::SetRespawnTime(), GameObject::SetSpawnedByDefault(), GameObject::SetSpellId(), and sObjectMgr.

Referenced by boss_thorim::DamageTaken(), boss_four_horsemen::boss_four_horsemenAI::JustDied(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnGameObjectCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SpawnSaurfangCampTents(), SummonGameObject(), SummonGameObjectGroup(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SummonSaurfangCampTeleporters(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::Update(), npc_belnistrasz::npc_belnistraszAI::UpdateAI(), and boss_mimiron::UpdateAI().

◆ SummonGameObject() [2/2]

GameObject * Map::SummonGameObject ( uint32  entry,
Position const &  pos,
float  rotation0 = 0.0f,
float  rotation1 = 0.0f,
float  rotation2 = 0.0f,
float  rotation3 = 0.0f,
uint32  respawnTime = 100,
bool  checkTransport = true 
)
2427{
2428 return SummonGameObject(entry, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), rotation0, rotation1, rotation2, rotation3, respawnTime, checkTransport);
2429}
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)
Definition Object.cpp:2400

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

◆ SummonGameObjectGroup()

void Map::SummonGameObjectGroup ( uint8  group,
std::list< GameObject * > *  list = nullptr 
)
2377{
2378 std::vector<GameObjectSummonData> const* data = sObjectMgr->GetGameObjectSummonGroup(GetId(), SUMMONER_TYPE_MAP, group);
2379 if (!data)
2380 return;
2381
2382 for (std::vector<GameObjectSummonData>::const_iterator itr = data->begin(); itr != data->end(); ++itr)
2383 if (GameObject* go = SummonGameObject(itr->entry, itr->pos.GetPositionX(), itr->pos.GetPositionY(), itr->pos.GetPositionZ(), itr->pos.GetOrientation(), itr->rot.x, itr->rot.y, itr->rot.z, itr->rot.w, itr->respawnTime))
2384 if (list)
2385 list->push_back(go);
2386}

References GetId(), sObjectMgr, SUMMONER_TYPE_MAP, and SummonGameObject().

Referenced by instance_ulduar::instance_ulduar_InstanceMapScript::SpawnLeviathanOutro(), and instance_stratholme::instance_stratholme_InstanceMapScript::SpawnScarletThread().

◆ ToBattlegroundMap() [1/2]

◆ ToBattlegroundMap() [2/2]

BattlegroundMap const * Map::ToBattlegroundMap ( ) const
inline
394{ if (IsBattlegroundOrArena()) return reinterpret_cast<BattlegroundMap const*>(this); return nullptr; }

References IsBattlegroundOrArena().

◆ ToInstanceMap() [1/2]

◆ ToInstanceMap() [2/2]

InstanceMap const * Map::ToInstanceMap ( ) const
inline
391{ if (IsDungeon()) return (InstanceMap const*)((InstanceMap*)this); else return nullptr; }

References IsDungeon().

◆ ToMapInstanced() [1/2]

MapInstanced * Map::ToMapInstanced ( )
inline
387{ if (Instanceable()) return reinterpret_cast<MapInstanced*>(this); else return nullptr; }
Definition MapInstanced.h:26
bool Instanceable() const
Definition Map.h:298

References Instanceable().

Referenced by MapMgr::DoForAllMaps(), and MapMgr::DoForAllMapsWithMapId().

◆ ToMapInstanced() [2/2]

MapInstanced const * Map::ToMapInstanced ( ) const
inline
388{ if (Instanceable()) return (MapInstanced const*)((MapInstanced*)this); else return nullptr; }

References Instanceable().

◆ UnloadAll()

void Map::UnloadAll ( )
virtual

Reimplemented in InstanceMap, and MapInstanced.

1075{
1076 // clear all delayed moves, useless anyway do this moves before map unload.
1077 _creaturesToMove.clear();
1078 _gameObjectsToMove.clear();
1079
1081 {
1082 MapGridType* grid = i->GetSource();
1083 ++i;
1084 if (grid)
1085 UnloadGrid(*grid);
1086 }
1087
1088 // pussywizard: crashfix, some npc can be left on transport (not a default passenger)
1089 if (!AllTransportsEmpty())
1091
1092 for (TransportsContainer::iterator itr = _transports.begin(); itr != _transports.end();)
1093 {
1094 Transport* transport = *itr;
1095 ++itr;
1096
1097 RemoveFromMap<Transport>(transport, true);
1098 }
1099
1100 _transports.clear();
1101
1102 for (auto& cellCorpsePair : _corpsesByGrid)
1103 {
1104 for (Corpse* corpse : cellCorpsePair.second)
1105 {
1106 corpse->RemoveFromWorld();
1107 corpse->ResetMap();
1108 delete corpse;
1109 }
1110 }
1111
1112 _corpsesByGrid.clear();
1113 _corpsesByPlayer.clear();
1114 _corpseBones.clear();
1115}
Definition GridRefMgr.h:28
iterator end()
Definition GridRefMgr.h:36
void AllTransportsRemovePassengers()
Definition Map.cpp:3049
bool UnloadGrid(MapGridType &grid)
Definition Map.cpp:1048
bool AllTransportsEmpty() const
Definition Map.cpp:3040

References _corpseBones, _corpsesByGrid, _corpsesByPlayer, _creaturesToMove, _gameObjectsToMove, _transports, AllTransportsEmpty(), AllTransportsRemovePassengers(), GridRefMgr< OBJECT >::end(), and UnloadGrid().

Referenced by InstanceMap::UnloadAll(), and MapInstanced::UnloadAll().

◆ UnloadGrid()

bool Map::UnloadGrid ( MapGridType &  grid)
1049{
1050 _mapGridManager.UnloadGrid(grid.GetX(), grid.GetY());
1051
1052 ASSERT(i_objectsToRemove.empty());
1053 LOG_DEBUG("maps", "Unloading grid[{}, {}] for map {} finished", grid.GetX(), grid.GetY(), GetId());
1054 return true;
1055}
void UnloadGrid(uint16 const x, uint16 const y)
Definition MapGridManager.cpp:49
uint16 GetY() const
Definition MapGrid.h:44
uint16 GetX() const
Definition MapGrid.h:43

References _mapGridManager, ASSERT, GetId(), MapGrid< GRID_OBJECT_TYPES, FAR_VISIBLE_OBJECT_TYPES >::GetX(), MapGrid< GRID_OBJECT_TYPES, FAR_VISIBLE_OBJECT_TYPES >::GetY(), i_objectsToRemove, LOG_DEBUG, and MapGridManager::UnloadGrid().

Referenced by UnloadAll().

◆ Update()

void Map::Update ( const uint32  t_diff,
const uint32  s_diff,
bool  thread = true 
)
virtual

Process any due respawns (non-compatibility mode spawns)

  • Process necessary scripts

Reimplemented in InstanceMap, and MapInstanced.

437{
438 if (t_diff)
440
441 // Update world sessions and players
443 {
444 Player* player = m_mapRefIter->GetSource();
445 if (player && player->IsInWorld())
446 {
447 // Update session
448 WorldSession* session = player->GetSession();
449 MapSessionFilter updater(session);
450 session->Update(s_diff, updater);
451
452 // update players at tick
453 if (!t_diff)
454 player->Update(s_diff);
455 }
456 }
457
458 Events.Update(t_diff);
459
460 if (!t_diff)
461 {
463 return;
464 }
465
468 {
469 if (_respawnCheckTimer <= t_diff)
470 {
472 _respawnCheckTimer = 5000; // Check every 5 seconds
473 }
474 else
475 _respawnCheckTimer -= t_diff;
476 }
477
480
481 // Update players
483 {
484 Player* player = m_mapRefIter->GetSource();
485
486 if (!player || !player->IsInWorld())
487 continue;
488
489 player->Update(s_diff);
490
492 {
493 MarkNearbyCellsOf(player);
494
495 // If player is using far sight, update viewpoint
496 if (WorldObject* viewPoint = player->GetViewpoint())
497 {
498 if (Creature* viewCreature = viewPoint->ToCreature())
499 MarkNearbyCellsOf(viewCreature);
500 else if (DynamicObject* viewObject = viewPoint->ToDynObject())
501 MarkNearbyCellsOf(viewObject);
502 }
503 }
504 }
505
507
509
511 if (!m_scriptSchedule.empty())
512 {
513 i_scriptLock = true;
515 i_scriptLock = false;
516 }
517
521
523
525
526 UpdateWeather(t_diff);
527 UpdateExpiredCorpses(t_diff);
528
529 sScriptMgr->OnMapUpdate(this, t_diff);
530
531 METRIC_VALUE("map_creatures", uint64(GetObjectsStore().Size<Creature>()),
532 METRIC_TAG("map_id", std::to_string(GetId())),
533 METRIC_TAG("map_instanceid", std::to_string(GetInstanceId())));
534
535 METRIC_VALUE("map_gameobjects", uint64(GetObjectsStore().Size<GameObject>()),
536 METRIC_TAG("map_id", std::to_string(GetId())),
537 METRIC_TAG("map_instanceid", std::to_string(GetInstanceId())));
538}
std::uint64_t uint64
Definition Define.h:106
#define METRIC_VALUE(category, value,...)
Definition Metric.h:197
#define METRIC_TAG(name, value)
Definition Metric.h:163
@ CONFIG_RESPAWN_FORCE_COMPATIBILITY_MODE
Definition WorldConfig.h:402
void update(uint32 diff)
Definition DynamicTree.cpp:142
Definition WorldSession.h:337
void HandleDelayedVisibility()
Definition Map.cpp:698
MapStoredObjectTypesContainer & GetObjectsStore()
Definition Map.h:358
void MoveAllGameObjectsInMoveList()
Definition Map.cpp:984
void ProcessRespawns()
Definition Map.cpp:2785
void UpdateNonPlayerObjects(uint32 const diff)
Definition Map.cpp:540
void MarkNearbyCellsOf(WorldObject *obj)
Definition Map.cpp:400
void UpdatePlayersRedirectKickEvent(uint32 diff)
Definition Map.cpp:1902
uint32 _respawnCheckTimer
Definition Map.h:675
void resetMarkedCells()
Definition Map.h:320
void UpdateWeather(uint32 const diff)
Definition Map.cpp:3267
void MoveAllDynamicObjectsInMoveList()
Definition Map.cpp:1019
void MoveAllCreaturesInMoveList()
Definition Map.cpp:950
MapRefMgr::iterator m_mapRefIter
Definition Map.h:616
void SendObjectUpdates()
Definition Map.cpp:1730
void UpdateExpiredCorpses(uint32 const diff)
Definition Map.cpp:1681
DynamicObject * ToDynObject()
Definition Object.h:228
void Update(uint32 time) override
Definition PlayerUpdates.cpp:53
WorldObject * GetViewpoint() const
Definition Player.cpp:13541
FROM * GetSource() const
Definition Reference.h:97
Player session in the World.
Definition WorldSession.h:430
bool Update(uint32 diff, PacketFilter &updater)
Update the WorldSession (triggered by World update)
Definition WorldSession.cpp:385
bool Passed()
Definition Timer.h:161
void Update(time_t diff)
Definition Timer.h:152

References _mapCollisionData, _respawnCheckTimer, _updatableObjectListRecheckTimer, MapRefMgr::begin(), CONFIG_RESPAWN_FORCE_COMPATIBILITY_MODE, MapRefMgr::end(), MapCollisionData::GetDynamicTree(), GetId(), GetInstanceId(), GetObjectsStore(), Player::GetSession(), Reference< TO, FROM >::GetSource(), Player::GetViewpoint(), HandleDelayedVisibility(), i_scriptLock, Object::IsInWorld(), m_mapRefIter, m_mapRefMgr, m_scriptSchedule, MarkNearbyCellsOf(), METRIC_TAG, METRIC_VALUE, MoveAllCreaturesInMoveList(), MoveAllDynamicObjectsInMoveList(), MoveAllGameObjectsInMoveList(), IntervalTimer::Passed(), ProcessRespawns(), resetMarkedCells(), ScriptsProcess(), SendObjectUpdates(), sScriptMgr, sWorld, Object::ToCreature(), Object::ToDynObject(), IntervalTimer::Update(), DynamicMapTree::update(), WorldSession::Update(), Player::Update(), UpdateExpiredCorpses(), UpdateNonPlayerObjects(), UpdatePlayersRedirectKickEvent(), and UpdateWeather().

Referenced by MapUpdateRequest::call(), InstanceMap::Update(), and MapInstanced::Update().

◆ UpdateEncounterState()

void Map::UpdateEncounterState ( EncounterCreditType  type,
uint32  creditEntry,
Unit *  source 
)
2947{
2948 Difficulty difficulty_fixed = (IsSharedDifficultyMap(GetId()) ? Difficulty(GetDifficulty() % 2) : GetDifficulty());
2949 DungeonEncounterList const* encounters;
2950 // 631 : ICC - 724 : Ruby Sanctum --- For heroic difficulties, for some reason, we don't have an encounter list, so we get the encounter list from normal diff. We shouldn't change difficulty_fixed variable.
2951 if ((GetId() == 631 || GetId() == 724) && IsHeroic())
2952 {
2953 encounters = sObjectMgr->GetDungeonEncounterList(GetId(), !Is25ManRaid() ? RAID_DIFFICULTY_10MAN_NORMAL : RAID_DIFFICULTY_25MAN_NORMAL);
2954 }
2955 else
2956 {
2957 encounters = sObjectMgr->GetDungeonEncounterList(GetId(), difficulty_fixed);
2958 }
2959
2960 if (!encounters)
2961 {
2962 return;
2963 }
2964
2965 uint32 dungeonId = 0;
2966 bool updated = false;
2967
2968 for (DungeonEncounterList::const_iterator itr = encounters->begin(); itr != encounters->end(); ++itr)
2969 {
2970 DungeonEncounter const* encounter = *itr;
2971 if (encounter->creditType == type && encounter->creditEntry == creditEntry)
2972 {
2973 if (source)
2974 if (InstanceScript* instanceScript = source->GetInstanceScript())
2975 {
2976 uint32 prevMask = instanceScript->GetCompletedEncounterMask();
2977 instanceScript->SetCompletedEncountersMask((1 << encounter->dbcEntry->encounterIndex) | instanceScript->GetCompletedEncounterMask(), true);
2978 if (prevMask != instanceScript->GetCompletedEncounterMask())
2979 updated = true;
2980 }
2981
2982 if (encounter->lastEncounterDungeon)
2983 {
2984 dungeonId = encounter->lastEncounterDungeon;
2985 break;
2986 }
2987 }
2988 }
2989
2990 // pussywizard:
2991 LogEncounterFinished(type, creditEntry);
2992
2993 sScriptMgr->OnAfterUpdateEncounterState(this, type, creditEntry, source, difficulty_fixed, encounters, dungeonId, updated);
2994
2995 if (dungeonId)
2996 {
2997 Map::PlayerList const& players = GetPlayers();
2998 for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
2999 {
3000 if (Player* player = i->GetSource())
3001 if (Group* grp = player->GetGroup())
3002 if (grp->isLFGGroup())
3003 {
3004 sLFGMgr->FinishDungeon(grp->GetGUID(), dungeonId, this);
3005 return;
3006 }
3007 }
3008 }
3009}
@ RAID_DIFFICULTY_10MAN_NORMAL
Definition DBCEnums.h:273
@ RAID_DIFFICULTY_25MAN_NORMAL
Definition DBCEnums.h:274
bool IsSharedDifficultyMap(uint32 mapid)
Definition DBCStores.cpp:841
#define sLFGMgr
Definition LFGMgr.h:665
std::list< DungeonEncounter const * > DungeonEncounterList
Definition ObjectMgr.h:716
Definition Group.h:177
Definition InstanceScript.h:143
bool Is25ManRaid() const
Definition Map.h:304
void LogEncounterFinished(EncounterCreditType type, uint32 creditEntry)
Definition Map.cpp:3011
bool IsHeroic() const
Definition Map.h:303
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1247
uint32 encounterIndex
Definition DBCStructure.h:898
Definition ObjectMgr.h:706
DungeonEncounterEntry const * dbcEntry
Definition ObjectMgr.h:710
EncounterCreditType creditType
Definition ObjectMgr.h:711
uint32 lastEncounterDungeon
Definition ObjectMgr.h:713
uint32 creditEntry
Definition ObjectMgr.h:712

References MapRefMgr::begin(), DungeonEncounter::creditEntry, DungeonEncounter::creditType, DungeonEncounter::dbcEntry, DungeonEncounterEntry::encounterIndex, MapRefMgr::end(), GetDifficulty(), GetId(), WorldObject::GetInstanceScript(), GetPlayers(), Is25ManRaid(), IsHeroic(), IsSharedDifficultyMap(), DungeonEncounter::lastEncounterDungeon, LogEncounterFinished(), RAID_DIFFICULTY_10MAN_NORMAL, RAID_DIFFICULTY_25MAN_NORMAL, sLFGMgr, sObjectMgr, and sScriptMgr.

Referenced by boss_eadric::boss_eadricAI::DamageTaken(), boss_illidari_council::DoAction(), Spell::finish(), instance_karazhan::instance_karazhan_InstanceMapScript::SetBossState(), boss_majordomo::SummonedCreatureDies(), and npc_grimstone::WaypointReached().

◆ UpdateExpiredCorpses()

void Map::UpdateExpiredCorpses ( uint32 const  diff)
1682{
1685 return;
1686
1688
1690}
void RemoveOldCorpses()
Definition Map.cpp:3158
void Reset()
Definition Timer.h:166

References _corpseUpdateTimer, IntervalTimer::Passed(), RemoveOldCorpses(), IntervalTimer::Reset(), and IntervalTimer::Update().

Referenced by Update().

◆ UpdateIteratorBack()

void Map::UpdateIteratorBack ( Player *  player)
2472{
2473 if (m_mapRefIter == player->GetMapRef())
2475}
MapReference const * nocheck_prev() const
Definition MapReference.h:49
MapReference & GetMapRef()
Definition Player.h:2540

References Player::GetMapRef(), m_mapRefIter, and MapReference::nocheck_prev().

Referenced by Player::ResetMap().

◆ UpdateNonPlayerObjects()

void Map::UpdateNonPlayerObjects ( uint32 const  diff)
private
541{
545
547 {
548 for (uint32 i = 0; i < _updatableObjectList.size();)
549 {
551 if (!obj->IsInWorld())
552 {
553 ++i;
554 continue;
555 }
556
557 obj->Update(diff);
558
559 if (!obj->IsUpdateNeeded())
560 {
562 // Intentional no iteration here, obj is swapped with last element in
563 // _updatableObjectList so next loop will update that object at the same index
564 }
565 else
566 ++i;
567 }
569 }
570 else
571 {
572 for (uint32 i = 0; i < _updatableObjectList.size(); ++i)
573 {
575 if (!obj->IsInWorld())
576 continue;
577
578 obj->Update(diff);
579 }
580 }
581}
void _AddObjectToUpdateList(WorldObject *obj)
Definition Map.cpp:597
virtual bool IsUpdateNeeded()
Definition Object.cpp:3247
virtual void Update(uint32 diff)
Definition Object.cpp:1077

References _AddObjectToUpdateList(), _pendingAddUpdatableObjectList, _RemoveObjectFromUpdateList(), _updatableObjectList, _updatableObjectListRecheckTimer, Object::IsInWorld(), WorldObject::IsUpdateNeeded(), IntervalTimer::Passed(), IntervalTimer::Reset(), and WorldObject::Update().

Referenced by Update().

◆ UpdatePlayersRedirectKickEvent()

void Map::UpdatePlayersRedirectKickEvent ( uint32  diff)
private
1903{
1905 return;
1906
1908
1910 {
1911 auto emptyPacket = WorldPacket();
1912 for (MapRefMgr::iterator itr = m_mapRefMgr.begin(); itr != m_mapRefMgr.end(); ++itr)
1913 itr->GetSource()->GetSession()->HandleTC9PrepareForRedirect(emptyPacket);
1914
1915 return;
1916 }
1917
1919 return;
1920
1922
1924 for (MapRefMgr::iterator itr = m_mapRefMgr.begin(); itr != m_mapRefMgr.end(); ++itr)
1925 itr->GetSource()->SendSystemMessage("Dimensional shift incoming! Prepare to transition in 5 seconds...");
1926}

References _lastAnnounceRedirectKickTimer, _redirectKickTimer, MapRefMgr::begin(), MapRefMgr::end(), m_mapRefMgr, TimeTrackerSmall::Passed(), and TimeTrackerSmall::Update().

Referenced by Update().

◆ UpdatePlayerZoneStats()

void Map::UpdatePlayerZoneStats ( uint32  oldZone,
uint32  newZone 
)
420{
421 // Nothing to do if no change
422 if (oldZone == newZone)
423 return;
424
425 if (oldZone != MAP_INVALID_ZONE)
426 {
427 uint32& oldZoneCount = _zonePlayerCountMap[oldZone];
428 if (oldZoneCount)
429 --oldZoneCount;
430 }
431
432 if (newZone != MAP_INVALID_ZONE)
433 ++_zonePlayerCountMap[newZone];
434}

References _zonePlayerCountMap, and MAP_INVALID_ZONE.

Referenced by RemovePlayerFromMap(), and Player::UpdateZone().

◆ UpdateWeather()

void Map::UpdateWeather ( uint32 const  diff)
3268{
3271 return;
3272
3273 for (auto&& zoneInfo : _zoneDynamicInfo)
3274 if (zoneInfo.second.DefaultWeather && !zoneInfo.second.DefaultWeather->Update(_weatherUpdateTimer.GetInterval()))
3275 zoneInfo.second.DefaultWeather.reset();
3276
3278}
virtual void Update(const uint32, const uint32, bool thread=true)
Definition Map.cpp:436

References _weatherUpdateTimer, _zoneDynamicInfo, IntervalTimer::GetInterval(), IntervalTimer::Passed(), IntervalTimer::Reset(), and IntervalTimer::Update().

Referenced by Update().

◆ Visit()

template<class T , class CONTAINER >
void Map::Visit ( Cell const &  cell,
TypeContainerVisitor< T, CONTAINER > &  visitor 
)
inline
779{
780 uint32 const grid_x = cell.GridX();
781 uint32 const grid_y = cell.GridY();
782
783 // If grid is not loaded, nothing to visit.
784 if (!IsGridLoaded(GridCoord(grid_x, grid_y)))
785 return;
786
787 GetMapGrid(grid_x, grid_y)->VisitCell(cell.CellX(), cell.CellY(), visitor);
788}
void VisitCell(uint16 const x, uint16 const y, TypeContainerVisitor< T, TT > &visitor)
Definition MapGrid.h:87

References Cell::CellX(), Cell::CellY(), GetMapGrid(), Cell::GridX(), Cell::GridY(), IsGridLoaded(), and MapGrid< GRID_OBJECT_TYPES, FAR_VISIBLE_OBJECT_TYPES >::VisitCell().

Referenced by Cell::Visit(), and Cell::VisitCircle().

Friends And Related Symbol Documentation

◆ GridObjectLoader

friend class GridObjectLoader
friend

◆ MapReference

friend class MapReference
friend

Member Data Documentation

◆ _corpseBones

std::unordered_set<Corpse*> Map::_corpseBones
private

◆ _corpsesByGrid

std::unordered_map<uint32, std::unordered_set<Corpse*> > Map::_corpsesByGrid
private

◆ _corpsesByPlayer

std::unordered_map<ObjectGuid, Corpse*> Map::_corpsesByPlayer
private

◆ _corpseUpdateTimer

IntervalTimer Map::_corpseUpdateTimer
private

Referenced by Map(), and UpdateExpiredCorpses().

◆ _creatureBySpawnIdStore

◆ _creatureRespawnTimes

◆ _creaturesToMove

std::vector<Creature*> Map::_creaturesToMove
private

◆ _defaultLight

uint32 Map::_defaultLight
private

◆ _dynamicObjectsToMove

std::vector<DynamicObject*> Map::_dynamicObjectsToMove
private

◆ _gameobjectBySpawnIdStore

◆ _gameObjectsToMove

std::vector<GameObject*> Map::_gameObjectsToMove
private

◆ _goRespawnTimes

std::unordered_map<ObjectGuid::LowType , time_t> Map::_goRespawnTimes
private

◆ _guidGenerators

std::map<HighGuid, std::unique_ptr<ObjectGuidGeneratorBase> > Map::_guidGenerators
private

◆ _instanceResetPeriod

time_t Map::_instanceResetPeriod
protected

◆ _lastAnnounceRedirectKickTimer

◆ _mapCollisionData

◆ _mapGridManager

◆ _objectsStore

◆ _pendingAddUpdatableObjectList

◆ _poolData

std::unique_ptr<SpawnedPoolData> Map::_poolData
private

Referenced by GetPoolData(), GetPoolData(), and Map().

◆ _redirectKickTimer

◆ _respawnCheckTimer

uint32 Map::_respawnCheckTimer {0}
private
675{0};

Referenced by Update().

◆ _respawnQueue

◆ _toggledSpawnGroupIds

std::unordered_set<uint32> Map::_toggledSpawnGroupIds
private

◆ _transports

◆ _transportsUpdateIter

TransportsContainer::iterator Map::_transportsUpdateIter
protected

Referenced by DelayedUpdate(), and RemoveFromMap().

◆ _updatableObjectList

◆ _updatableObjectListRecheckTimer

IntervalTimer Map::_updatableObjectListRecheckTimer
private

Referenced by Map(), Update(), and UpdateNonPlayerObjects().

◆ _updateObjects

std::unordered_set<Object*> Map::_updateObjects
private

◆ _weatherUpdateTimer

IntervalTimer Map::_weatherUpdateTimer
private

Referenced by Map(), and UpdateWeather().

◆ _zoneDynamicInfo

◆ _zonePlayerCountMap

std::unordered_map<uint32, uint32> Map::_zonePlayerCountMap
private

◆ _zoneWideVisibleWorldObjectsMap

◆ CreatureGroupHolder

◆ CustomData

DataMap Map::CustomData

◆ Events

EventProcessor Map::Events

◆ i_InstanceId

uint32 Map::i_InstanceId
protected

Referenced by GetInstanceId().

◆ i_mapEntry

◆ i_objectsForDelayedVisibility

std::unordered_set<Unit*> Map::i_objectsForDelayedVisibility

◆ i_objectsToRemove

std::unordered_set<WorldObject*> Map::i_objectsToRemove
private

◆ i_scriptLock

bool Map::i_scriptLock
private

◆ i_spawnMode

uint8 Map::i_spawnMode
protected

◆ Lock

std::mutex Map::Lock
protected

◆ m_mapRefIter

MapRefMgr::iterator Map::m_mapRefIter
protected

Referenced by Update(), and UpdateIteratorBack().

◆ m_mapRefMgr

◆ m_parentMap

Map* Map::m_parentMap
private

Referenced by GetParent(), and Map().

◆ m_scriptSchedule

ScriptScheduleMap Map::m_scriptSchedule
private

◆ m_unloadTimer

◆ m_VisibleDistance

◆ marked_cells

std::bitset<TOTAL_NUMBER_OF_CELLS_PER_MAP * TOTAL_NUMBER_OF_CELLS_PER_MAP> Map::marked_cells
private

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