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

#include "Map.h"

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

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
 
- Public Types inherited from GridRefMgr< NGridType >
typedef LinkedListHead::Iterator< GridReference< NGridType > > iterator
 
- Public Types inherited from RefMgr< TO, FROM >
typedef LinkedListHead::Iterator< Reference< TO, FROM > > iterator
 
- Public Types inherited from LinkedListHead
typedef Iterator< LinkedListElementiterator
 

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 VisitNearbyCellsOf (WorldObject *obj, TypeContainerVisitor< Acore::ObjectUpdater, GridTypeMapContainer > &gridVisitor, TypeContainerVisitor< Acore::ObjectUpdater, WorldTypeMapContainer > &worldVisitor, TypeContainerVisitor< Acore::ObjectUpdater, GridTypeMapContainer > &largeGridVisitor, TypeContainerVisitor< Acore::ObjectUpdater, WorldTypeMapContainer > &largeWorldVisitor)
 
void VisitNearbyCellsOfPlayer (Player *player, TypeContainerVisitor< Acore::ObjectUpdater, GridTypeMapContainer > &gridVisitor, TypeContainerVisitor< Acore::ObjectUpdater, WorldTypeMapContainer > &worldVisitor, TypeContainerVisitor< Acore::ObjectUpdater, GridTypeMapContainer > &largeGridVisitor, TypeContainerVisitor< Acore::ObjectUpdater, WorldTypeMapContainer > &largeWorldVisitor)
 
virtual void Update (const uint32, const uint32, bool thread=true)
 
float GetVisibilityRange () const
 
void SetVisibilityRange (float range)
 
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 (const Cell &cell, TypeContainerVisitor< T, CONTAINER > &visitor)
 
bool IsRemovalGrid (float x, float y) const
 
bool IsGridLoaded (float x, float y) const
 
void LoadGrid (float x, float y)
 
void LoadAllCells ()
 
bool UnloadGrid (NGridType &ngrid)
 
virtual void UnloadAll ()
 
uint32 GetId () const
 
Map const * GetParent () const
 
std::shared_mutex & GetMMapLock () const
 
void HandleDelayedVisibility ()
 
float GetHeight (float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
 
float GetGridHeight (float x, float y) const
 
float GetMinHeight (float x, float y) const
 
TransportGetTransportForPos (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, uint8 reqLiquidType=MAP_ALL_LIQUIDS)
 
LiquidData const GetLiquidData (uint32 phaseMask, float x, float y, float z, float collisionHeight, 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)
 
const char * 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)
 
void AddObjectToSwitchList (WorldObject *obj, bool on)
 
virtual void DelayedUpdate (const uint32 diff)
 
void resetMarkedCells ()
 
bool isCellMarked (uint32 pCellId)
 
void markCell (uint32 pCellId)
 
void resetMarkedCellsLarge ()
 
bool isCellMarkedLarge (uint32 pCellId)
 
void markCellLarge (uint32 pCellId)
 
bool HavePlayers () const
 
uint32 GetPlayersCountExceptGMs () const
 
void AddWorldObject (WorldObject *obj)
 
void RemoveWorldObject (WorldObject *obj)
 
void SendToPlayers (WorldPacket const *data) const
 
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. More...
 
void ScriptCommandStart (ScriptInfo const &script, uint32 delay, Object *source, Object *target)
 
template<class T >
void AddToActive (T *obj)
 
template<class T >
void RemoveFromActive (T *obj)
 
template<class T >
void SwitchGridContainers (T *obj, bool on)
 
void UpdateIteratorBack (Player *player)
 
TempSummonSummonCreature (uint32 entry, Position const &pos, SummonPropertiesEntry const *properties=nullptr, uint32 duration=0, WorldObject *summoner=nullptr, uint32 spellId=0, uint32 vehId=0, bool visibleBySummonerOnly=false)
 
GameObjectSummonGameObject (uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport=true)
 
GameObjectSummonGameObject (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)
 
CorpseGetCorpse (ObjectGuid const guid)
 
CreatureGetCreature (ObjectGuid const guid)
 
GameObjectGetGameObject (ObjectGuid const guid)
 
TransportGetTransport (ObjectGuid const guid)
 
DynamicObjectGetDynamicObject (ObjectGuid const guid)
 
PetGetPet (ObjectGuid const guid)
 
MapStoredObjectTypesContainerGetObjectsStore ()
 
CreatureBySpawnIdContainerGetCreatureBySpawnIdStore ()
 
GameObjectBySpawnIdContainerGetGameObjectBySpawnIdStore ()
 
std::unordered_set< Corpse * > const * GetCorpsesInCell (uint32 cellId) const
 
CorpseGetCorpseByPlayer (ObjectGuid const &ownerGuid) const
 
MapInstancedToMapInstanced ()
 
MapInstanced const * ToMapInstanced () const
 
InstanceMapToInstanceMap ()
 
InstanceMap const * ToInstanceMap () const
 
BattlegroundMapToBattlegroundMap ()
 
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. More...
 
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. More...
 
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 More...
 
void Balance ()
 
void RemoveGameObjectModel (const GameObjectModel &model)
 
void InsertGameObjectModel (const GameObjectModel &model)
 
bool ContainsGameObjectModel (const GameObjectModel &model) const
 
DynamicMapTree const & GetDynamicMapTree () const
 
bool GetObjectHitPos (uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float &rx, float &ry, float &rz, float modifyDist)
 
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)
 
void LoadRespawnTimes ()
 
void DeleteRespawnTimes ()
 
time_t GetInstanceResetPeriod () const
 
void ScheduleCreatureRespawn (ObjectGuid, Milliseconds)
 
void LoadCorpseData ()
 
void DeleteCorpseData ()
 
void AddCorpse (Corpse *corpse)
 
void RemoveCorpse (Corpse *corpse)
 
CorpseConvertCorpseToBones (ObjectGuid const ownerGuid, bool insignia=false)
 
void RemoveOldCorpses ()
 
void SendInitTransports (Player *player)
 
void SendRemoveTransports (Player *player)
 
void SendZoneDynamicInfo (Player *player)
 
void SendInitSelf (Player *player)
 
void PlayDirectSoundToMap (uint32 soundId, uint32 zoneId=0)
 
void SetZoneMusic (uint32 zoneId, uint32 musicId)
 
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)
 
GridMapGetGrid (float x, float y)
 
void EnsureGridCreated (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)
 
std::size_t GetActiveNonPlayersCount () const
 
virtual std::string GetDebugInfo () const
 
template<>
void AddToGrid (Creature *obj, Cell const &cell)
 
template<>
void AddToGrid (GameObject *obj, Cell const &cell)
 
template<>
void AddToGrid (DynamicObject *obj, Cell const &cell)
 
template<>
void AddToGrid (Corpse *obj, Cell const &cell)
 
template<>
void SwitchGridContainers (Creature *obj, bool on)
 
template<>
void SwitchGridContainers (GameObject *obj, bool on)
 
template<>
void DeleteFromWorld (Player *player)
 
template<>
void InitializeObject (Creature *)
 
template<>
void InitializeObject (GameObject *)
 
template<>
bool AddToMap (MotionTransport *obj, bool)
 
template<>
void RemoveFromMap (MotionTransport *obj, bool remove)
 
template<>
void AddToActive (Creature *c)
 
template<>
void AddToActive (DynamicObject *d)
 
template<>
void AddToActive (GameObject *d)
 
template<>
void RemoveFromActive (Creature *c)
 
template<>
void RemoveFromActive (DynamicObject *obj)
 
template<>
void RemoveFromActive (GameObject *obj)
 
- Public Member Functions inherited from GridRefMgr< NGridType >
GridReference< NGridType > * getFirst ()
 
GridReference< NGridType > * 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
 
LinkedListElementgetFirst ()
 
LinkedListElement const * getFirst () const
 
LinkedListElementgetLast ()
 
LinkedListElement const * getLast () const
 
void insertFirst (LinkedListElement *pElem)
 
void insertLast (LinkedListElement *pElem)
 
uint32 getSize () const
 
void incSize ()
 
void decSize ()
 

Static Public Member Functions

static bool ExistMap (uint32 mapid, int gx, int gy)
 
static bool ExistVMap (uint32 mapid, int gx, int gy)
 
static void DeleteRespawnTimesInDB (uint16 mapId, uint32 instanceId)
 

Public Attributes

std::unordered_set< Unit * > i_objectsForDelayedVisibility
 
CreatureGroupHolderType CreatureGroupHolder
 
TaskScheduler _creatureRespawnScheduler
 
DataMap CustomData
 

Protected Types

typedef std::set< WorldObject * > ActiveNonPlayers
 

Protected Attributes

std::mutex Lock
 
std::mutex GridLock
 
std::shared_mutex MMapLock
 
MapEntry const * i_mapEntry
 
uint8 i_spawnMode
 
uint32 i_InstanceId
 
uint32 m_unloadTimer
 
float m_VisibleDistance
 
DynamicMapTree _dynamicTree
 
time_t _instanceResetPeriod
 
MapRefMgr m_mapRefMgr
 
MapRefMgr::iterator m_mapRefIter
 
ActiveNonPlayers m_activeNonPlayers
 
ActiveNonPlayers::iterator m_activeNonPlayersIter
 
TransportsContainer _transports
 
TransportsContainer::iterator _transportsUpdateIter
 

Private Types

typedef std::multimap< time_t, ScriptActionScriptScheduleMap
 

Private Member Functions

void LoadMapAndVMap (int gx, int gy)
 
void LoadVMap (int gx, int gy)
 
void LoadMap (int gx, int gy, bool reload=false)
 
void LoadMMap (int gx, int gy)
 
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 IsGridLoaded (const GridCoord &) const
 
void EnsureGridCreated_i (const GridCoord &)
 
void buildNGridLinkage (NGridType *pNGridType)
 
NGridTypegetNGrid (uint32 x, uint32 y) const
 
bool EnsureGridLoaded (Cell const &)
 
bool isGridObjectDataLoaded (uint32 x, uint32 y) const
 
void setGridObjectDataLoaded (bool pLoaded, uint32 x, uint32 y)
 
void setNGrid (NGridType *grid, uint32 x, uint32 y)
 
void ScriptsProcess ()
 Process queued scripts. More...
 
void UpdateActiveCells (const float &x, const float &y, const uint32 t_diff)
 
void SendObjectUpdates ()
 
Player_GetScriptPlayerSourceOrTarget (Object *source, Object *target, const ScriptInfo *scriptInfo) const
 
Creature_GetScriptCreatureSourceOrTarget (Object *source, Object *target, const ScriptInfo *scriptInfo, bool bReverse=false) const
 
Unit_GetScriptUnit (Object *obj, bool isSource, const ScriptInfo *scriptInfo) const
 
Player_GetScriptPlayer (Object *obj, bool isSource, const ScriptInfo *scriptInfo) const
 
Creature_GetScriptCreature (Object *obj, bool isSource, const ScriptInfo *scriptInfo) const
 
WorldObject_GetScriptWorldObject (Object *obj, bool isSource, const ScriptInfo *scriptInfo) const
 
void _ScriptProcessDoor (Object *source, Object *target, const ScriptInfo *scriptInfo) const
 
GameObject_FindGameObject (WorldObject *pWorldObject, ObjectGuid::LowType guid) const
 
template<class T >
void AddToGrid (T *object, Cell const &cell)
 
template<class T >
void DeleteFromWorld (T *)
 
void AddToActiveHelper (WorldObject *obj)
 
void RemoveFromActiveHelper (WorldObject *obj)
 
template<HighGuid high>
ObjectGuidGeneratorBaseGetGuidSequenceGenerator ()
 

Private Attributes

std::vector< Creature * > _creaturesToMove
 
std::vector< GameObject * > _gameObjectsToMove
 
std::vector< DynamicObject * > _dynamicObjectsToMove
 
Mapm_parentMap
 
NGridTypei_grids [MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS]
 
GridMapGridMaps [MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS]
 
std::bitset< TOTAL_NUMBER_OF_CELLS_PER_MAP *TOTAL_NUMBER_OF_CELLS_PER_MAPmarked_cells
 
std::bitset< TOTAL_NUMBER_OF_CELLS_PER_MAP *TOTAL_NUMBER_OF_CELLS_PER_MAPmarked_cells_large
 
bool i_scriptLock
 
std::unordered_set< WorldObject * > i_objectsToRemove
 
std::map< WorldObject *, bool > i_objectsToSwitch
 
std::unordered_set< WorldObject * > i_worldObjects
 
ScriptScheduleMap m_scriptSchedule
 
std::unordered_map< ObjectGuid::LowType, time_t > _creatureRespawnTimes
 
std::unordered_map< ObjectGuid::LowType, time_t > _goRespawnTimes
 
ZoneDynamicInfoMap _zoneDynamicInfo
 
uint32 _defaultLight
 
std::map< HighGuid, std::unique_ptr< ObjectGuidGeneratorBase > > _guidGenerators
 
MapStoredObjectTypesContainer _objectsStore
 
CreatureBySpawnIdContainer _creatureBySpawnIdStore
 
GameObjectBySpawnIdContainer _gameobjectBySpawnIdStore
 
std::unordered_map< uint32, std::unordered_set< Corpse * > > _corpsesByCell
 
std::unordered_map< ObjectGuid, Corpse * > _corpsesByPlayer
 
std::unordered_set< Corpse * > _corpseBones
 
std::unordered_set< Object * > _updateObjects
 

Friends

class MapReference
 

Detailed Description

Member Typedef Documentation

◆ ActiveNonPlayers

typedef std::set<WorldObject*> Map::ActiveNonPlayers
protected

◆ CreatureBySpawnIdContainer

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

◆ GameObjectBySpawnIdContainer

◆ PlayerList

◆ ScriptScheduleMap

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

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 
423 {
424 CAN_ENTER = 0,
425 CANNOT_ENTER_ALREADY_IN_MAP = 1, // Player is already in the map
426 CANNOT_ENTER_NO_ENTRY, // No map entry was found for the target map ID
427 CANNOT_ENTER_UNINSTANCED_DUNGEON, // No instance template was found for dungeon map
428 CANNOT_ENTER_DIFFICULTY_UNAVAILABLE, // Requested instance difficulty is not available for target map
429 CANNOT_ENTER_NOT_IN_RAID, // Target instance is a raid instance and the player is not in a raid group
430 CANNOT_ENTER_CORPSE_IN_DIFFERENT_INSTANCE, // Player is dead and their corpse is not in target instance
431 CANNOT_ENTER_INSTANCE_BIND_MISMATCH, // Player's permanent instance save is not compatible with their group's current instance bind
432 CANNOT_ENTER_TOO_MANY_INSTANCES, // Player has entered too many instances recently
433 CANNOT_ENTER_MAX_PLAYERS, // Target map already has the maximum number of players allowed
434 CANNOT_ENTER_ZONE_IN_COMBAT, // A boss encounter is currently in progress on the target map
436 };
@ CANNOT_ENTER_CORPSE_IN_DIFFERENT_INSTANCE
Definition: Map.h:430
@ CANNOT_ENTER_TOO_MANY_INSTANCES
Definition: Map.h:432
@ CANNOT_ENTER_MAX_PLAYERS
Definition: Map.h:433
@ CANNOT_ENTER_ZONE_IN_COMBAT
Definition: Map.h:434
@ CAN_ENTER
Definition: Map.h:424
@ CANNOT_ENTER_ALREADY_IN_MAP
Definition: Map.h:425
@ CANNOT_ENTER_UNSPECIFIED_REASON
Definition: Map.h:435
@ CANNOT_ENTER_NO_ENTRY
Definition: Map.h:426
@ CANNOT_ENTER_DIFFICULTY_UNAVAILABLE
Definition: Map.h:428
@ CANNOT_ENTER_INSTANCE_BIND_MISMATCH
Definition: Map.h:431
@ CANNOT_ENTER_UNINSTANCED_DUNGEON
Definition: Map.h:427
@ CANNOT_ENTER_NOT_IN_RAID
Definition: Map.h:429

Constructor & Destructor Documentation

◆ Map()

Map::Map ( uint32  id,
uint32  InstanceId,
uint8  SpawnMode,
Map _parent = nullptr 
)
235 :
236 i_mapEntry(sMapStore.LookupEntry(id)), i_spawnMode(SpawnMode), i_InstanceId(InstanceId),
240{
241 m_parentMap = (_parent ? _parent : this);
242 for (unsigned int idx = 0; idx < MAX_NUMBER_OF_GRIDS; ++idx)
243 {
244 for (unsigned int j = 0; j < MAX_NUMBER_OF_GRIDS; ++j)
245 {
246 //z code
247 GridMaps[idx][j] = nullptr;
248 setNGrid(nullptr, idx, j);
249 }
250 }
251
252 //lets initialize visibility distance for map
254
255 sScriptMgr->OnCreateMap(this);
256}
#define MAX_NUMBER_OF_GRIDS
Definition: MapDefines.h:24
#define sScriptMgr
Definition: ScriptMgr.h:708
uint32 GetDefaultMapLight(uint32 mapId)
Definition: DBCStores.cpp:880
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
#define DEFAULT_VISIBILITY_DISTANCE
Definition: ObjectDefines.h:40
MapEntry const * i_mapEntry
Definition: Map.h:708
uint8 i_spawnMode
Definition: Map.h:709
TransportsContainer::iterator _transportsUpdateIter
Definition: Map.h:725
uint32 m_unloadTimer
Definition: Map.h:711
uint32 _defaultLight
Definition: Map.h:786
Map * m_parentMap
Definition: Map.h:739
bool i_scriptLock
Definition: Map.h:746
time_t _instanceResetPeriod
Definition: Map.h:714
ActiveNonPlayers m_activeNonPlayers
Definition: Map.h:720
float m_VisibleDistance
Definition: Map.h:712
virtual void InitVisibilityDistance()
Definition: Map.cpp:258
TransportsContainer _transports
Definition: Map.h:724
uint32 i_InstanceId
Definition: Map.h:710
ActiveNonPlayers::iterator m_activeNonPlayersIter
Definition: Map.h:721
GridMap * GridMaps[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS]
Definition: Map.h:742
void setNGrid(NGridType *grid, uint32 x, uint32 y)
Definition: Map.cpp:2602

References GridMaps, InitVisibilityDistance(), m_parentMap, MAX_NUMBER_OF_GRIDS, setNGrid(), and sScriptMgr.

◆ ~Map()

Map::~Map ( )
override
63{
64 // UnloadAll must be called before deleting the map
65
66 sScriptMgr->OnDestroyMap(this);
67
68 while (!i_worldObjects.empty())
69 {
70 WorldObject* obj = *i_worldObjects.begin();
71 ASSERT(obj->IsWorldObject());
72 LOG_DEBUG("maps", "Map::~Map: WorldObject TypeId is not a corpse! ({})", static_cast<uint8>(obj->GetTypeId()));
73 //ASSERT(obj->IsCorpse());
74 obj->RemoveFromWorld();
75 obj->ResetMap();
76 }
77
78 if (!m_scriptSchedule.empty())
79 sScriptMgr->DecreaseScheduledScriptCount(m_scriptSchedule.size());
80
81 //MMAP::MMapFactory::createOrGetMMapMgr()->unloadMap(GetId());
83}
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:168
std::uint8_t uint8
Definition: Define.h:109
#define ASSERT
Definition: Errors.h:68
static MMapMgr * createOrGetMMapMgr()
Definition: MMapFactory.cpp:27
bool unloadMapInstance(uint32 mapId, uint32 instanceId)
Definition: MMapMgr.cpp:279
TypeID GetTypeId() const
Definition: Object.h:124
Definition: Object.h:405
virtual void ResetMap()
Definition: Object.cpp:2131
bool IsWorldObject() const
Definition: Object.cpp:1074
void RemoveFromWorld() override
Definition: Object.cpp:1182
ScriptScheduleMap m_scriptSchedule
Definition: Map.h:752
uint32 GetId() const
Definition: Map.h:379
std::unordered_set< WorldObject * > i_worldObjects
Definition: Map.h:749

References ASSERT, MMAP::MMapFactory::createOrGetMMapMgr(), GetId(), Object::GetTypeId(), i_InstanceId, i_worldObjects, WorldObject::IsWorldObject(), LOG_DEBUG, m_scriptSchedule, WorldObject::RemoveFromWorld(), WorldObject::ResetMap(), sScriptMgr, and MMAP::MMapMgr::unloadMapInstance().

Member Function Documentation

◆ _FindGameObject()

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

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

Referenced by _ScriptProcessDoor(), and ScriptsProcess().

◆ _GetScriptCreature()

Creature * Map::_GetScriptCreature ( Object obj,
bool  isSource,
const ScriptInfo scriptInfo 
) const
inlineprivate
189{
190 Creature* creature = nullptr;
191 if (!obj)
192 LOG_ERROR("maps.script", "{} {} object is nullptr.", scriptInfo->GetDebugInfo(), isSource ? "source" : "target");
193 else
194 {
195 creature = obj->ToCreature();
196 if (!creature)
197 LOG_ERROR("maps.script", "{} {} object is not a creature ({}).", scriptInfo->GetDebugInfo(),
198 isSource ? "source" : "target", obj->GetGUID().ToString());
199 }
200 return creature;
201}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:156
Definition: Creature.h:46
Creature * ToCreature()
Definition: Object.h:202
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:109
std::string ToString() const
Definition: ObjectGuid.cpp:47
std::string GetDebugInfo() const
Definition: ObjectMgr.cpp:199

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

Referenced by ScriptsProcess().

◆ _GetScriptCreatureSourceOrTarget()

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

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,
const ScriptInfo scriptInfo 
) const
inlineprivate
174{
175 Player* player = nullptr;
176 if (!obj)
177 LOG_ERROR("maps.script", "{} {} object is nullptr.", scriptInfo->GetDebugInfo(), isSource ? "source" : "target");
178 else
179 {
180 player = obj->ToPlayer();
181 if (!player)
182 LOG_ERROR("maps.script", "{} {} object is not a player ({}).",
183 scriptInfo->GetDebugInfo(), isSource ? "source" : "target", obj->GetGUID().ToString());
184 }
185 return player;
186}
Player * ToPlayer()
Definition: Object.h:198
Definition: Player.h:1064

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

Referenced by ScriptsProcess().

◆ _GetScriptPlayerSourceOrTarget()

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

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,
const ScriptInfo scriptInfo 
) const
inlineprivate
156{
157 Unit* unit = nullptr;
158 if (!obj)
159 LOG_ERROR("maps.script", "{} {} object is nullptr.", scriptInfo->GetDebugInfo(), isSource ? "source" : "target");
160 else if (!obj->IsUnit())
161 LOG_ERROR("maps.script", "{} {} object is not unit (TypeId: {}, Entry: {}, GUID: {}), skipping.",
162 scriptInfo->GetDebugInfo(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUID().ToString());
163 else
164 {
165 unit = obj->ToUnit();
166 if (!unit)
167 LOG_ERROR("maps.script", "{} {} object could not be casted to unit.",
168 scriptInfo->GetDebugInfo(), isSource ? "source" : "target");
169 }
170 return unit;
171}
bool IsUnit() const
Definition: Object.h:205
Unit * ToUnit()
Definition: Object.h:206
Definition: Unit.h:630

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,
const ScriptInfo scriptInfo 
) const
inlineprivate
204{
205 WorldObject* pWorldObject = nullptr;
206 if (!obj)
207 LOG_ERROR("maps.script", "{} {} object is nullptr.",
208 scriptInfo->GetDebugInfo(), isSource ? "source" : "target");
209 else
210 {
211 pWorldObject = dynamic_cast<WorldObject*>(obj);
212 if (!pWorldObject)
213 LOG_ERROR("maps.script", "{} {} object is not a world object ({}).",
214 scriptInfo->GetDebugInfo(), isSource ? "source" : "target", obj->GetGUID().ToString());
215 }
216 return pWorldObject;
217}

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

Referenced by ScriptsProcess().

◆ _ScriptProcessDoor()

void Map::_ScriptProcessDoor ( Object source,
Object target,
const ScriptInfo scriptInfo 
) const
inlineprivate
220{
221 bool bOpen = false;
222 ObjectGuid::LowType guid = scriptInfo->ToggleDoor.GOGuid;
223 int32 nTimeToToggle = std::max(15, int32(scriptInfo->ToggleDoor.ResetDelay));
224 switch (scriptInfo->command)
225 {
227 bOpen = true;
228 break;
230 break;
231 default:
232 LOG_ERROR("maps.script", "{} unknown command for _ScriptProcessDoor.", scriptInfo->GetDebugInfo());
233 return;
234 }
235 if (!guid)
236 LOG_ERROR("maps.script", "{} door guid is not specified.", scriptInfo->GetDebugInfo());
237 else if (!source)
238 LOG_ERROR("maps.script", "{} source object is nullptr.", scriptInfo->GetDebugInfo());
239 else if (!source->IsUnit())
240 LOG_ERROR("maps.script", "{} source object is not unit ({}), skipping.", scriptInfo->GetDebugInfo(), source->GetGUID().ToString());
241 else
242 {
243 WorldObject* wSource = dynamic_cast <WorldObject*> (source);
244 if (!wSource)
245 LOG_ERROR("maps.script", "{} source object could not be casted to world object ({}), skipping.", scriptInfo->GetDebugInfo(), source->GetGUID().ToString());
246 else
247 {
248 GameObject* pDoor = _FindGameObject(wSource, guid);
249 if (!pDoor)
250 LOG_ERROR("maps.script", "{} gameobject was not found (guid: {}).", scriptInfo->GetDebugInfo(), guid);
251 else if (pDoor->GetGoType() != GAMEOBJECT_TYPE_DOOR)
252 LOG_ERROR("maps.script", "{} gameobject is not a door ({}).",
253 scriptInfo->GetDebugInfo(), pDoor->GetGUID().ToString());
254 else if (bOpen == (pDoor->GetGoState() == GO_STATE_READY))
255 {
256 pDoor->UseDoorOrButton(nTimeToToggle);
257
258 if (target && target->isType(TYPEMASK_GAMEOBJECT))
259 {
260 GameObject* goTarget = target->ToGameObject();
261 if (goTarget && goTarget->GetGoType() == GAMEOBJECT_TYPE_BUTTON)
262 goTarget->UseDoorOrButton(nTimeToToggle);
263 }
264 }
265 }
266 }
267}
std::int32_t int32
Definition: Define.h:103
@ SCRIPT_COMMAND_CLOSE_DOOR
Definition: ObjectMgr.h:107
@ SCRIPT_COMMAND_OPEN_DOOR
Definition: ObjectMgr.h:106
@ TYPEMASK_GAMEOBJECT
Definition: ObjectGuid.h:51
@ GO_STATE_READY
Definition: GameObjectData.h:691
@ GAMEOBJECT_TYPE_BUTTON
Definition: SharedDefines.h:1561
@ GAMEOBJECT_TYPE_DOOR
Definition: SharedDefines.h:1560
Definition: GameObject.h:121
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
bool isType(uint16 mask) const
Definition: Object.h:125
GameObject * ToGameObject()
Definition: Object.h:210
uint32 LowType
Definition: ObjectGuid.h:122
ScriptCommands command
Definition: ObjectMgr.h:196
uint32 ResetDelay
Definition: ObjectMgr.h:289
struct ScriptInfo::@262::@275 ToggleDoor
uint32 GOGuid
Definition: ObjectMgr.h:269
GameObject * _FindGameObject(WorldObject *pWorldObject, ObjectGuid::LowType guid) const
Definition: MapScripts.cpp:269

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)
3598{
3599 corpse->SetMap(this);
3600
3601 _corpsesByCell[corpse->GetCellCoord().GetId()].insert(corpse);
3602 if (corpse->GetType() != CORPSE_BONES)
3603 _corpsesByPlayer[corpse->GetOwnerGUID()] = corpse;
3604 else
3605 _corpseBones.insert(corpse);
3606}
@ CORPSE_BONES
Definition: Corpse.h:28
ObjectGuid GetOwnerGUID() const
Definition: Corpse.h:68
CellCoord const & GetCellCoord() const
Definition: Corpse.h:74
CorpseType GetType() const
Definition: Corpse.h:72
virtual void SetMap(Map *map)
Definition: Object.cpp:2105
uint32 GetId() const
Definition: GridDefines.h:148
std::unordered_map< ObjectGuid, Corpse * > _corpsesByPlayer
Definition: Map.h:803
std::unordered_map< uint32, std::unordered_set< Corpse * > > _corpsesByCell
Definition: Map.h:802
std::unordered_set< Corpse * > _corpseBones
Definition: Map.h:804

References _corpseBones, _corpsesByCell, _corpsesByPlayer, CORPSE_BONES, Corpse::GetCellCoord(), CoordPair< LIMIT >::GetId(), Corpse::GetOwnerGUID(), Corpse::GetType(), and WorldObject::SetMap().

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

◆ AddCreatureToMoveList()

void Map::AddCreatureToMoveList ( Creature c)
private
1086{
1088 _creaturesToMove.push_back(c);
1090}
@ MAP_OBJECT_CELL_MOVE_ACTIVE
Definition: Object.h:383
@ MAP_OBJECT_CELL_MOVE_NONE
Definition: Object.h:382
MapObjectCellMoveState _moveState
Definition: Object.h:401
std::vector< Creature * > _creaturesToMove
Definition: Map.h:677

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
1112{
1113 if (dynObj->_moveState == MAP_OBJECT_CELL_MOVE_NONE)
1114 _dynamicObjectsToMove.push_back(dynObj);
1115 dynObj->_moveState = MAP_OBJECT_CELL_MOVE_ACTIVE;
1116}
std::vector< DynamicObject * > _dynamicObjectsToMove
Definition: Map.h:679

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
1099{
1101 _gameObjectsToMove.push_back(go);
1103}
std::vector< GameObject * > _gameObjectsToMove
Definition: Map.h:678

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

Referenced by GameObjectRelocation().

◆ AddObjectToRemoveList()

void Map::AddObjectToRemoveList ( WorldObject obj)
2652{
2653 ASSERT(obj->GetMapId() == GetId() && obj->GetInstanceId() == GetInstanceId());
2654
2655 obj->CleanupsBeforeDelete(false); // remove or simplify at least cross referenced links
2656
2657 i_objectsToRemove.insert(obj);
2658 //LOG_DEBUG("maps", "Object ({}) added to removing list.", obj->GetGUID().ToString());
2659}
uint32 GetInstanceId() const
Definition: Object.h:443
virtual void CleanupsBeforeDelete(bool finalCleanup=true)
Definition: Object.cpp:1133
uint32 GetMapId() const
Definition: Position.h:276
std::unordered_set< WorldObject * > i_objectsToRemove
Definition: Map.h:747
uint32 GetInstanceId() const
Definition: Map.h:419

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

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

◆ AddObjectToSwitchList()

void Map::AddObjectToSwitchList ( WorldObject obj,
bool  on 
)
2662{
2663 ASSERT(obj->GetMapId() == GetId() && obj->GetInstanceId() == GetInstanceId());
2664 // i_objectsToSwitch is iterated only in Map::RemoveAllObjectsInRemoveList() and it uses
2665 // the contained objects only if IsCreature() , so we can return in all other cases
2666 if (!obj->IsCreature() && !obj->IsGameObject())
2667 return;
2668
2669 std::map<WorldObject*, bool>::iterator itr = i_objectsToSwitch.find(obj);
2670 if (itr == i_objectsToSwitch.end())
2671 i_objectsToSwitch.insert(itr, std::make_pair(obj, on));
2672 else if (itr->second != on)
2673 i_objectsToSwitch.erase(itr);
2674 else
2675 ABORT();
2676}
#define ABORT
Definition: Errors.h:76
bool IsGameObject() const
Definition: Object.h:209
bool IsCreature() const
Definition: Object.h:201
std::map< WorldObject *, bool > i_objectsToSwitch
Definition: Map.h:748

References ABORT, ASSERT, GetId(), WorldObject::GetInstanceId(), GetInstanceId(), WorldLocation::GetMapId(), i_objectsToSwitch, Object::IsCreature(), and Object::IsGameObject().

Referenced by WorldObject::SetWorldObject().

◆ AddPlayerToMap()

bool Map::AddPlayerToMap ( Player player)
virtual

Reimplemented in InstanceMap, and BattlegroundMap.

505{
506 CellCoord cellCoord = Acore::ComputeCellCoord(player->GetPositionX(), player->GetPositionY());
507 if (!cellCoord.IsCoordValid())
508 {
509 LOG_ERROR("maps", "Map::Add: Player ({}) has invalid coordinates X:{} Y:{} grid cell [{}:{}]",
510 player->GetGUID().ToString(), player->GetPositionX(), player->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
511 return false;
512 }
513
514 Cell cell(cellCoord);
515 EnsureGridLoaded(cell);
516 AddToGrid(player, cell);
517
518 // Check if we are adding to correct map
519 ASSERT (player->GetMap() == this);
520 player->SetMap(this);
521 player->AddToWorld();
522
523 SendInitTransports(player);
524 SendInitSelf(player);
525 SendZoneDynamicInfo(player);
526
527 player->m_clientGUIDs.clear();
528 player->UpdateObjectVisibility(false);
529
530 if (player->IsAlive())
531 ConvertCorpseToBones(player->GetGUID());
532
533 sScriptMgr->OnPlayerEnterMap(this, player);
534 return true;
535}
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:191
Map * GetMap() const
Definition: Object.h:531
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118
GuidUnorderedSet m_clientGUIDs
Definition: Player.h:2361
void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false) override
Definition: PlayerUpdates.cpp:1567
void AddToWorld() override
Definition: Player.cpp:1698
void SetMap(Map *map) override
Definition: Player.cpp:14674
bool IsAlive() const
Definition: Unit.h:1204
Definition: Cell.h:46
bool IsCoordValid() const
Definition: GridDefines.h:136
uint32 x_coord
Definition: GridDefines.h:153
uint32 y_coord
Definition: GridDefines.h:154
void SendZoneDynamicInfo(Player *player)
Definition: Map.cpp:3718
void SendInitSelf(Player *player)
Definition: Map.cpp:2529
void AddToGrid(T *object, Cell const &cell)
Definition: Map.cpp:276
void SendInitTransports(Player *player)
Definition: Map.cpp:2564
bool EnsureGridLoaded(Cell const &)
Definition: Map.cpp:467
Corpse * ConvertCorpseToBones(ObjectGuid const ownerGuid, bool insignia=false)
Definition: Map.cpp:3628

References AddToGrid(), Player::AddToWorld(), ASSERT, Acore::ComputeCellCoord(), ConvertCorpseToBones(), EnsureGridLoaded(), Object::GetGUID(), WorldObject::GetMap(), Position::GetPositionX(), Position::GetPositionY(), Unit::IsAlive(), CoordPair< LIMIT >::IsCoordValid(), LOG_ERROR, Player::m_clientGUIDs, SendInitSelf(), SendInitTransports(), SendZoneDynamicInfo(), 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().

◆ AddToActive() [1/4]

template<>
void Map::AddToActive ( Creature c)
2768{
2770}
void AddToActiveHelper(WorldObject *obj)
Definition: Map.h:761

References AddToActiveHelper().

◆ AddToActive() [2/4]

template<>
void Map::AddToActive ( DynamicObject d)
2774{
2776}

References AddToActiveHelper().

◆ AddToActive() [3/4]

template<>
void Map::AddToActive ( GameObject d)
2780{
2782}

References AddToActiveHelper().

◆ AddToActive() [4/4]

template<class T >
void Map::AddToActive ( T *  obj)
2762{
2763 AddToActiveHelper(obj);
2764}

References AddToActiveHelper().

Referenced by AddObjectHelper(), AddToMap(), and WorldObject::setActive().

◆ AddToActiveHelper()

void Map::AddToActiveHelper ( WorldObject obj)
inlineprivate
762 {
763 m_activeNonPlayers.insert(obj);
764 }

References m_activeNonPlayers.

Referenced by AddToActive().

◆ AddToGrid() [1/5]

template<>
void Map::AddToGrid ( Corpse obj,
Cell const &  cell 
)
320{
321 NGridType* grid = getNGrid(cell.GridX(), cell.GridY());
322 // Corpses are a special object type - they can be added to grid via a call to AddToMap
323 // or loaded through ObjectGridLoader.
324 // Both corpses loaded from database and these freshly generated by Player::CreateCoprse are added to _corpsesByCell
325 // ObjectGridLoader loads all corpses from _corpsesByCell even if they were already added to grid before it was loaded
326 // so we need to explicitly check it here (Map::AddToGrid is only called from Player::BuildPlayerRepop, not from ObjectGridLoader)
327 // to avoid failing an assertion in GridObject::AddToGrid
328 if (grid->isGridObjectDataLoaded())
329 {
330 if (obj->IsWorldObject())
331 grid->GetGridType(cell.CellX(), cell.CellY()).AddWorldObject(obj);
332 else
333 grid->GetGridType(cell.CellX(), cell.CellY()).AddGridObject(obj);
334 }
335}
void AddWorldObject(SPECIFIC_OBJECT *obj)
Definition: Grid.h:57
void AddGridObject(SPECIFIC_OBJECT *obj)
Definition: Grid.h:101
Definition: NGrid.h:37
bool isGridObjectDataLoaded() const
Definition: NGrid.h:65
GridType & GetGridType(const uint32 x, const uint32 y)
Definition: NGrid.h:45
NGridType * getNGrid(uint32 x, uint32 y) const
Definition: Map.h:686

References Grid< ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::AddGridObject(), Grid< ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::AddWorldObject(), Cell::CellX(), Cell::CellY(), NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::GetGridType(), getNGrid(), Cell::GridX(), Cell::GridY(), NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::isGridObjectDataLoaded(), and WorldObject::IsWorldObject().

◆ AddToGrid() [2/5]

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

◆ AddToGrid() [3/5]

◆ AddToGrid() [4/5]

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

◆ AddToGrid() [5/5]

template<class T >
void Map::AddToGrid ( T *  object,
Cell const &  cell 
)
private
277{
278 NGridType* grid = getNGrid(cell.GridX(), cell.GridY());
279 if (obj->IsWorldObject())
280 grid->GetGridType(cell.CellX(), cell.CellY()).template AddWorldObject<T>(obj);
281 else
282 grid->GetGridType(cell.CellX(), cell.CellY()).template AddGridObject<T>(obj);
283}

References Cell::CellX(), Cell::CellY(), NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::GetGridType(), getNGrid(), Cell::GridX(), and Cell::GridY().

Referenced by AddPlayerToMap(), AddToMap(), MoveAllCreaturesInMoveList(), MoveAllDynamicObjectsInMoveList(), MoveAllGameObjectsInMoveList(), and PlayerRelocation().

◆ AddToMap() [1/2]

template<>
bool Map::AddToMap ( MotionTransport obj,
bool   
)
613{
614 //TODO: Needs clean up. An object should not be added to map twice.
615 if (obj->IsInWorld())
616 return true;
617
619 if (!cellCoord.IsCoordValid())
620 {
621 LOG_ERROR("maps", "Map::Add: Object {} has invalid coordinates X:{} Y:{} grid cell [{}:{}]",
622 obj->GetGUID().ToString(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
623 return false; //Should delete object
624 }
625
626 Cell cell(cellCoord);
627 if (obj->isActiveObject())
628 EnsureGridLoaded(cell);
629
630 obj->AddToWorld();
631
632 if (obj->isActiveObject())
633 AddToActive(obj);
634
635 _transports.insert(obj);
636
637 // Broadcast creation to players
638 if (!GetPlayers().IsEmpty())
639 {
640 for (Map::PlayerList::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
641 {
642 if (itr->GetSource()->GetTransport() != obj)
643 {
644 UpdateData data;
645 obj->BuildCreateUpdateBlockForPlayer(&data, itr->GetSource());
646 WorldPacket packet;
647 data.BuildPacket(packet);
648 itr->GetSource()->SendDirectMessage(&packet);
649 }
650 }
651 }
652
653 return true;
654}
bool IsEmpty() const
Definition: LinkedList.h:97
Definition: LinkedList.h:139
void AddToWorld() override
Definition: GameObject.cpp:140
bool IsInWorld() const
Definition: Object.h:104
virtual void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target)
Definition: Object.cpp:189
bool isActiveObject() const
Definition: Object.h:574
Definition: UpdateData.h:52
bool BuildPacket(WorldPacket &packet)
Definition: UpdateData.cpp:48
iterator begin()
Definition: GridRefMgr.h:35
void AddToActive(T *obj)
Definition: Map.cpp:2761
PlayerList const & GetPlayers() const
Definition: Map.h:486
iterator end()
Definition: MapRefMgr.h:37
Definition: WorldPacket.h:27

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

◆ AddToMap() [2/2]

template<class T >
bool Map::AddToMap ( T *  obj,
bool  checkTransport = false 
)
556{
557 //TODO: Needs clean up. An object should not be added to map twice.
558 if (obj->IsInWorld())
559 {
560 ASSERT(obj->IsInGrid());
561 obj->UpdateObjectVisibility(true);
562 return true;
563 }
564
565 CellCoord cellCoord = Acore::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
566 //It will create many problems (including crashes) if an object is not added to grid after creation
567 //The correct way to fix it is to make AddToMap return false and delete the object if it is not added to grid
568 //But now AddToMap is used in too many places, I will just see how many ASSERT failures it will cause
569 ASSERT(cellCoord.IsCoordValid());
570 if (!cellCoord.IsCoordValid())
571 {
572 LOG_ERROR("maps", "Map::AddToMap: Object {} has invalid coordinates X:{} Y:{} grid cell [{}:{}]",
573 obj->GetGUID().ToString(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
574 return false; //Should delete object
575 }
576
577 Cell cell(cellCoord);
578 if (obj->isActiveObject())
579 EnsureGridLoaded(cell);
580 else
581 EnsureGridCreated(GridCoord(cell.GridX(), cell.GridY()));
582
583 AddToGrid(obj, cell);
584
585 //Must already be set before AddToMap. Usually during obj->Create.
586 //obj->SetMap(this);
587 obj->AddToWorld();
588
589 if (checkTransport)
590 if (!(obj->IsGameObject() && obj->ToGameObject()->IsTransport())) // dont add transport to transport ;d
591 if (Transport* transport = GetTransportForPos(obj->GetPhaseMask(), obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj))
592 transport->AddPassenger(obj, true);
593
594 InitializeObject(obj);
595
596 if (obj->isActiveObject())
597 AddToActive(obj);
598
599 //something, such as vehicle, needs to be update immediately
600 //also, trigger needs to cast spell, if not update, cannot see visual
601 obj->UpdateObjectVisibility(true);
602
603 // Xinef: little hack for vehicles, accessories have to be added after visibility update so they wont fall off the vehicle, moved from Creature::AIM_Initialize
604 // Initialize vehicle, this is done only for summoned npcs, DB creatures are handled by grid loaders
605 if (obj->IsCreature())
606 if (Vehicle* vehicle = obj->ToCreature()->GetVehicleKit())
607 vehicle->Reset();
608 return true;
609}
CoordPair< MAX_NUMBER_OF_GRIDS > GridCoord
Definition: GridDefines.h:169
Definition: Transport.h:29
Definition: Vehicle.h:28
void InitializeObject(T *obj)
Definition: Map.cpp:538
Transport * GetTransportForPos(uint32 phase, float x, float y, float z, WorldObject *worldobject=nullptr)
Definition: Map.cpp:2013
void EnsureGridCreated(const GridCoord &)
Definition: Map.cpp:432

References AddToActive(), 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(), 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(), PoolGroup< T >::Spawn1Object(), Battlefield::SpawnCreature(), Battlefield::SpawnGameObject(), SummonCreature(), SummonGameObject(), WorldObject::SummonGameObject(), Player::SummonPet(), and GameObject::Update().

◆ AddUpdateObject()

void Map::AddUpdateObject ( Object obj)
inline
645 {
646 _updateObjects.insert(obj);
647 }
std::unordered_set< Object * > _updateObjects
Definition: Map.h:806

References _updateObjects.

Referenced by WorldObject::AddToObjectUpdate().

◆ AddWorldObject()

void Map::AddWorldObject ( WorldObject obj)
inline
480{ i_worldObjects.insert(obj); }

References i_worldObjects.

Referenced by WorldObject::SetMap(), and SwitchGridContainers().

◆ AfterPlayerUnlinkFromMap()

void Map::AfterPlayerUnlinkFromMap ( )
virtual

◆ AllTransportsEmpty()

bool Map::AllTransportsEmpty ( ) const
3566{
3567 for (TransportsContainer::const_iterator itr = _transports.begin(); itr != _transports.end(); ++itr)
3568 if (!(*itr)->GetPassengers().empty())
3569 return false;
3570
3571 return true;
3572}

References _transports.

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

◆ AllTransportsRemovePassengers()

void Map::AllTransportsRemovePassengers ( )
3575{
3576 for (TransportsContainer::const_iterator itr = _transports.begin(); itr != _transports.end(); ++itr)
3577 while (!(*itr)->GetPassengers().empty())
3578 (*itr)->RemovePassenger(*((*itr)->GetPassengers().begin()), true);
3579}

References _transports.

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

◆ Balance()

void Map::Balance ( )
inline
void balance()
Definition: DynamicTree.cpp:132
DynamicMapTree _dynamicTree
Definition: Map.h:713

References _dynamicTree, and DynamicMapTree::balance().

Referenced by EnsureGridLoaded().

◆ buildNGridLinkage()

void Map::buildNGridLinkage ( NGridType pNGridType)
inlineprivate
684{ pNGridType->link(this); }
void link(GridRefMgr< NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES > > *pTo)
Definition: NGrid.h:61

References NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES >::link().

Referenced by EnsureGridCreated_i().

◆ 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
3882{
3883 return CanReachPositionAndGetValidCoords(source, source->GetPositionX(), source->GetPositionY(), source->GetPositionZ(), destX, destY, destZ, failOnCollision, failOnSlopes);
3884}
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:3841

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
3887{
3888 if (!CheckCollisionAndGetValidCoords(source, startX, startY, startZ, destX, destY, destZ, failOnCollision))
3889 {
3890 return false;
3891 }
3892
3893 Unit const* unit = source->ToUnit();
3894 // if it's not an unit (Object) then we do not have to continue
3895 // with walkable checks
3896 if (!unit)
3897 {
3898 return true;
3899 }
3900
3901 /*
3902 * Walkable checks
3903 */
3904 bool isWaterNext = HasEnoughWater(unit, destX, destY, destZ);
3905 Creature const* creature = unit->ToCreature();
3906 bool cannotEnterWater = isWaterNext && (creature && !creature->CanEnterWater());
3907 bool cannotWalkOrFly = !isWaterNext && !source->ToPlayer() && !unit->CanFly() && (creature && !creature->CanWalk());
3908 if (cannotEnterWater || cannotWalkOrFly ||
3909 (failOnSlopes && !PathGenerator::IsWalkableClimb(startX, startY, startZ, destX, destY, destZ, source->GetCollisionHeight())))
3910 {
3911 return false;
3912 }
3913
3914 return true;
3915}
bool CanWalk() const
Definition: Creature.h:81
bool CanEnterWater() const override
Definition: Creature.cpp:3258
virtual bool CanFly() const =0
bool HasEnoughWater(WorldObject const *searcher, float x, float y, float z) const
Definition: Map.cpp:2512
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:3924
bool IsWalkableClimb(float const *v1, float const *v2) const
Definition: PathGenerator.cpp:951

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.

3842{
3843 G3D::Vector3 prevPath = path->GetStartPosition();
3844 for (auto& vector : path->GetPath())
3845 {
3846 float x = vector.x;
3847 float y = vector.y;
3848 float z = vector.z;
3849
3850 if (!CanReachPositionAndGetValidCoords(source, prevPath.x, prevPath.y, prevPath.z, x, y, z, failOnCollision, failOnSlopes))
3851 {
3852 destX = x;
3853 destY = y;
3854 destZ = z;
3855 return false;
3856 }
3857
3858 prevPath = vector;
3859 }
3860
3861 destX = prevPath.x;
3862 destY = prevPath.y;
3863 destZ = prevPath.z;
3864
3865 return true;
3866}
Movement::PointsArray const & GetPath() const
Definition: PathGenerator.h:91
G3D::Vector3 const & GetStartPosition() const
Definition: PathGenerator.h:87

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

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

◆ CanUnload()

bool Map::CanUnload ( uint32  diff)
inline
323 {
324 if (!m_unloadTimer)
325 return false;
326
327 if (m_unloadTimer <= diff)
328 return true;
329
330 m_unloadTimer -= diff;
331 return false;
332 }

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
3925{
3926 // Prevent invalid coordinates here, position is unchanged
3927 if (!Acore::IsValidMapCoord(startX, startY, startZ) || !Acore::IsValidMapCoord(destX, destY, destZ))
3928 {
3929 LOG_FATAL("maps", "Map::CheckCollisionAndGetValidCoords invalid coordinates startX: {}, startY: {}, startZ: {}, destX: {}, destY: {}, destZ: {}", startX, startY, startZ, destX, destY, destZ);
3930 return false;
3931 }
3932
3933 bool isWaterNext = IsInWater(source->GetPhaseMask(), destX, destY, destZ, source->GetCollisionHeight());
3934
3935 PathGenerator path(source);
3936
3937 // Use a detour raycast to get our first collision point
3938 path.SetUseRaycast(true);
3939 bool result = path.CalculatePath(startX, startY, startZ, destX, destY, destZ, false);
3940
3941 Unit const* unit = source->ToUnit();
3942 bool notOnGround = path.GetPathType() & PATHFIND_NOT_USING_PATH
3943 || isWaterNext || (unit && unit->IsFlying());
3944
3945 // Check for valid path types before we proceed
3946 if (!result || (!notOnGround && path.GetPathType() & ~(PATHFIND_NORMAL | PATHFIND_SHORTCUT | PATHFIND_INCOMPLETE | PATHFIND_FARFROMPOLY_END)))
3947 {
3948 return false;
3949 }
3950
3951 G3D::Vector3 endPos = path.GetPath().back();
3952 destX = endPos.x;
3953 destY = endPos.y;
3954 destZ = endPos.z;
3955
3956 // collision check
3957 bool collided = false;
3958
3959 // check static LOS
3960 float halfHeight = source->GetCollisionHeight() * 0.5f;
3961
3962 // Unit is not on the ground, check for potential collision via vmaps
3963 if (notOnGround)
3964 {
3965 bool col = VMAP::VMapFactory::createOrGetVMapMgr()->GetObjectHitPos(source->GetMapId(),
3966 startX, startY, startZ + halfHeight,
3967 destX, destY, destZ + halfHeight,
3968 destX, destY, destZ, -CONTACT_DISTANCE);
3969
3970 destZ -= halfHeight;
3971
3972 // Collided with static LOS object, move back to collision point
3973 if (col)
3974 {
3975 collided = true;
3976 }
3977 }
3978
3979 // check dynamic collision
3980 bool col = source->GetMap()->GetObjectHitPos(source->GetPhaseMask(),
3981 startX, startY, startZ + halfHeight,
3982 destX, destY, destZ + halfHeight,
3983 destX, destY, destZ, -CONTACT_DISTANCE);
3984
3985 destZ -= halfHeight;
3986
3987 // Collided with a gameobject, move back to collision point
3988 if (col)
3989 {
3990 collided = true;
3991 }
3992
3993 float groundZ = VMAP_INVALID_HEIGHT_VALUE;
3994 source->UpdateAllowedPositionZ(destX, destY, destZ, &groundZ);
3995
3996 // position has no ground under it (or is too far away)
3997 if (groundZ <= INVALID_HEIGHT && unit && !unit->CanFly())
3998 {
3999 // fall back to gridHeight if any
4000 float gridHeight = GetGridHeight(destX, destY);
4001 if (gridHeight > INVALID_HEIGHT)
4002 {
4003 destZ = gridHeight + unit->GetHoverHeight();
4004 }
4005 else
4006 {
4007 return false;
4008 }
4009 }
4010
4011 return !failOnCollision || !collided;
4012}
#define LOG_FATAL(filterType__,...)
Definition: Log.h:152
#define VMAP_INVALID_HEIGHT_VALUE
Definition: IVMapMgr.h:49
#define INVALID_HEIGHT
Definition: Map.h:165
@ PATHFIND_FARFROMPOLY_END
Definition: PathGenerator.h:55
@ PATHFIND_NOT_USING_PATH
Definition: PathGenerator.h:52
@ PATHFIND_NORMAL
Definition: PathGenerator.h:48
@ PATHFIND_SHORTCUT
Definition: PathGenerator.h:49
@ PATHFIND_INCOMPLETE
Definition: PathGenerator.h:50
#define CONTACT_DISTANCE
Definition: ObjectDefines.h:23
bool IsValidMapCoord(float c)
Definition: GridDefines.h:216
static VMapMgr2 * createOrGetVMapMgr()
Definition: VMapFactory.cpp:27
bool GetObjectHitPos(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2, float &rx, float &ry, float &rz, float modifyDist) override
Definition: VMapMgr2.cpp:201
float GetHoverHeight() const
Definition: Unit.h:1703
bool IsFlying() const
Definition: Unit.h:1701
bool IsInWater(uint32 phaseMask, float x, float y, float z, float collisionHeight) const
Definition: Map.cpp:2500
float GetGridHeight(float x, float y) const
Definition: Map.cpp:2077
Definition: PathGenerator.h:60

References PathGenerator::CalculatePath(), CanFly, CONTACT_DISTANCE, VMAP::VMapFactory::createOrGetVMapMgr(), WorldObject::GetCollisionHeight(), GetGridHeight(), Unit::GetHoverHeight(), WorldObject::GetMap(), WorldLocation::GetMapId(), GetObjectHitPos(), VMAP::VMapMgr2::GetObjectHitPos(), PathGenerator::GetPath(), PathGenerator::GetPathType(), WorldObject::GetPhaseMask(), 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 ( const GameObjectModel model) const
inline
562{ return _dynamicTree.contains(model);}
bool contains(const GameObjectModel &) const
Definition: DynamicTree.cpp:127

References _dynamicTree, and DynamicMapTree::contains().

◆ ConvertCorpseToBones()

Corpse * Map::ConvertCorpseToBones ( ObjectGuid const  ownerGuid,
bool  insignia = false 
)
3629{
3630 Corpse* corpse = GetCorpseByPlayer(ownerGuid);
3631 if (!corpse)
3632 return nullptr;
3633
3634 RemoveCorpse(corpse);
3635
3636 // remove corpse from DB
3637 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
3638 corpse->DeleteFromDB(trans);
3639 CharacterDatabase.CommitTransaction(trans);
3640
3641 Corpse* bones = NULL;
3642
3643 // create the bones only if the map and the grid is loaded at the corpse's location
3644 // ignore bones creating option in case insignia
3645 if ((insignia ||
3647 !IsRemovalGrid(corpse->GetPositionX(), corpse->GetPositionY()))
3648 {
3649 // Create bones, don't change Corpse
3650 bones = new Corpse();
3651 bones->Create(corpse->GetGUID().GetCounter());
3652
3653 for (uint8 i = OBJECT_FIELD_TYPE + 1; i < CORPSE_END; ++i) // don't overwrite guid and object type
3654 bones->SetUInt32Value(i, corpse->GetUInt32Value(i));
3655
3656 bones->SetCellCoord(corpse->GetCellCoord());
3657 bones->Relocate(corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetOrientation());
3658 bones->SetPhaseMask(corpse->GetPhaseMask(), false);
3659
3661 bones->SetGuidValue(CORPSE_FIELD_OWNER, corpse->GetOwnerGUID());
3662
3663 for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
3664 if (corpse->GetUInt32Value(CORPSE_FIELD_ITEM + i))
3665 bones->SetUInt32Value(CORPSE_FIELD_ITEM + i, 0);
3666
3667 AddCorpse(bones);
3668
3669 bones->UpdatePositionData();
3670
3671 // add bones in grid store if grid loaded where corpse placed
3672 AddToMap(bones);
3673 }
3674
3675 // all references to the corpse should be removed at this point
3676 delete corpse;
3677
3678 return bones;
3679}
@ CONFIG_DEATH_BONES_BG_OR_ARENA
Definition: IWorld.h:111
@ CONFIG_DEATH_BONES_WORLD
Definition: IWorld.h:110
@ CORPSE_FLAG_BONES
Definition: Corpse.h:40
@ CORPSE_FLAG_UNK2
Definition: Corpse.h:42
@ 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
@ EQUIPMENT_SLOT_END
Definition: Player.h:694
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
Definition: DatabaseEnvFwd.h:70
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define sWorld
Definition: World.h:444
Definition: Corpse.h:49
bool Create(ObjectGuid::LowType guidlow)
Definition: Corpse.cpp:61
void SetCellCoord(CellCoord const &cellCoord)
Definition: Corpse.h:75
void DeleteFromDB(CharacterDatabaseTransaction trans)
Definition: Corpse.cpp:119
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:305
void SetGuidValue(uint16 index, ObjectGuid value)
Definition: Object.cpp:723
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:650
virtual void SetPhaseMask(uint32 newPhaseMask, bool update)
Definition: Object.cpp:2873
uint32 GetPhaseMask() const
Definition: Object.h:446
void UpdatePositionData()
Definition: Object.cpp:1154
LowType GetCounter() const
Definition: ObjectGuid.h:145
float GetPositionZ() const
Definition: Position.h:119
float GetOrientation() const
Definition: Position.h:120
void Relocate(float x, float y)
Definition: Position.h:73
bool IsBattlegroundOrArena() const
Definition: Map.h:456
void AddCorpse(Corpse *corpse)
Definition: Map.cpp:3597
bool IsRemovalGrid(float x, float y) const
Definition: Map.h:363
Corpse * GetCorpseByPlayer(ObjectGuid const &ownerGuid) const
Definition: Map.h:534
bool AddToMap(T *, bool checkTransport=false)
Definition: Map.cpp:555
void RemoveCorpse(Corpse *corpse)
Definition: Map.cpp:3608

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(), IsRemovalGrid(), 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 
)
1023{
1024 Cell old_cell = creature->GetCurrentCell();
1025 Cell new_cell(x, y);
1026
1027 if (old_cell.DiffGrid(new_cell) || old_cell.DiffCell(new_cell))
1028 {
1029 if (old_cell.DiffGrid(new_cell))
1030 EnsureGridLoaded(new_cell);
1031
1032 AddCreatureToMoveList(creature);
1033 }
1034 else
1036
1037 creature->Relocate(x, y, z, o);
1038 if (creature->IsVehicle())
1039 creature->GetVehicleKit()->RelocatePassengers();
1040 creature->UpdatePositionData();
1041 creature->UpdateObjectVisibility(false);
1042}
Cell const & GetCurrentCell() const
Definition: Object.h:397
bool IsVehicle() const
Definition: Unit.h:713
void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false) override
Definition: Unit.cpp:19086
Vehicle * GetVehicleKit() const
Definition: Unit.h:1672
void RelocatePassengers()
Definition: Vehicle.cpp:496
bool DiffGrid(const Cell &cell) const
Definition: Cell.h:64
bool DiffCell(const Cell &cell) const
Definition: Cell.h:58
void AddCreatureToMoveList(Creature *c)
Definition: Map.cpp:1085
void RemoveCreatureFromMoveList(Creature *c)
Definition: Map.cpp:1092

References AddCreatureToMoveList(), Cell::DiffCell(), Cell::DiffGrid(), EnsureGridLoaded(), MovableMapObject::GetCurrentCell(), Unit::GetVehicleKit(), Unit::IsVehicle(), Position::Relocate(), Vehicle::RelocatePassengers(), RemoveCreatureFromMoveList(), 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.

2636{
2638 {
2641
2642 if (!transport->IsInWorld())
2643 continue;
2644
2645 transport->DelayedUpdate(t_diff);
2646 }
2647
2649}
Definition: Transport.h:48
void DelayedUpdate(uint32 diff)
Definition: Transport.cpp:240
void RemoveAllObjectsInRemoveList()
Definition: Map.cpp:2678

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

Referenced by MapInstanced::DelayedUpdate().

◆ DeleteCorpseData()

void Map::DeleteCorpseData ( )
4052{
4053 // DELETE FROM corpse WHERE mapId = ? AND instanceId = ?
4055 stmt->SetData(0, GetId());
4056 stmt->SetData(1, GetInstanceId());
4057 CharacterDatabase.Execute(stmt);
4058}
@ CHAR_DEL_CORPSES_FROM_MAP
Definition: CharacterDatabase.h:247
Definition: PreparedStatement.h:158
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition: PreparedStatement.h:78

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)
425{
427
428 RemoveUpdateObject(player); //TODO: I do not know why we need this, it should be removed in ~Object anyway
429 delete player;
430}
void RemoveObject(T *object)
Definition: ObjectAccessor.h:99
void RemoveUpdateObject(Object *obj)
Definition: Map.h:649

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

◆ DeleteFromWorld() [2/2]

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

Referenced by RemoveFromMap(), and RemovePlayerFromMap().

◆ DeleteRespawnTimes()

void Map::DeleteRespawnTimes ( )
3451{
3452 _creatureRespawnTimes.clear();
3453 _goRespawnTimes.clear();
3454
3456}
static void DeleteRespawnTimesInDB(uint16 mapId, uint32 instanceId)
Definition: Map.cpp:3458
std::unordered_map< ObjectGuid::LowType, time_t > _creatureRespawnTimes
Definition: Map.h:782
std::unordered_map< ObjectGuid::LowType, time_t > _goRespawnTimes
Definition: Map.h:783

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

Referenced by InstanceMap::UnloadAll().

◆ DeleteRespawnTimesInDB()

void Map::DeleteRespawnTimesInDB ( uint16  mapId,
uint32  instanceId 
)
static
3459{
3461 stmt->SetData(0, mapId);
3462 stmt->SetData(1, instanceId);
3463 CharacterDatabase.Execute(stmt);
3464
3465 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GO_RESPAWN_BY_INSTANCE);
3466 stmt->SetData(0, mapId);
3467 stmt->SetData(1, instanceId);
3468 CharacterDatabase.Execute(stmt);
3469}
@ CHAR_DEL_CREATURE_RESPAWN_BY_INSTANCE
Definition: CharacterDatabase.h:253
@ CHAR_DEL_GO_RESPAWN_BY_INSTANCE
Definition: CharacterDatabase.h:258

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

◆ DynamicObjectRelocation()

void Map::DynamicObjectRelocation ( DynamicObject go,
float  x,
float  y,
float  z,
float  o 
)
1066{
1067 Cell old_cell = dynObj->GetCurrentCell();
1068 Cell new_cell(x, y);
1069
1070 if (old_cell.DiffGrid(new_cell) || old_cell.DiffCell(new_cell))
1071 {
1072 if (old_cell.DiffGrid(new_cell))
1073 EnsureGridLoaded(new_cell);
1074
1076 }
1077 else
1079
1080 dynObj->Relocate(x, y, z, o);
1081 dynObj->SetPositionDataUpdate();
1082 dynObj->UpdateObjectVisibility(false);
1083}
void RemoveDynamicObjectFromMoveList(DynamicObject *go)
Definition: Map.cpp:1118
void AddDynamicObjectToMoveList(DynamicObject *go)
Definition: Map.cpp:1111

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 ( const GridCoord p)
433{
434 if (getNGrid(p.x_coord, p.y_coord)) // pussywizard
435 return;
436 std::lock_guard<std::mutex> guard(GridLock);
438}
std::mutex GridLock
Definition: Map.h:705
void EnsureGridCreated_i(const GridCoord &)
Definition: Map.cpp:442

References EnsureGridCreated_i(), getNGrid(), GridLock, CoordPair< LIMIT >::x_coord, and CoordPair< LIMIT >::y_coord.

Referenced by AddToMap(), EnsureGridLoaded(), GetGrid(), and LoadMap().

◆ EnsureGridCreated_i()

void Map::EnsureGridCreated_i ( const GridCoord p)
private
443{
444 if (!getNGrid(p.x_coord, p.y_coord))
445 {
446 // pussywizard: moved setNGrid to the end of the function
448
449 // build a linkage between this map and NGridType
450 buildNGridLinkage(ngt); // pussywizard: getNGrid(x, y) changed to: ngt
451
452 //z coord
453 int gx = (MAX_NUMBER_OF_GRIDS - 1) - p.x_coord;
454 int gy = (MAX_NUMBER_OF_GRIDS - 1) - p.y_coord;
455
456 if (!GridMaps[gx][gy])
457 {
458 LoadMapAndVMap(gx, gy);
459 }
460
461 // pussywizard: moved here
462 setNGrid(ngt, p.x_coord, p.y_coord);
463 }
464}
NGrid< MAX_NUMBER_OF_CELLS, Player, AllWorldObjectTypes, AllGridObjectTypes > NGridType
Definition: GridDefines.h:78
void LoadMapAndVMap(int gx, int gy)
Definition: Map.cpp:225
void buildNGridLinkage(NGridType *pNGridType)
Definition: Map.h:684

References buildNGridLinkage(), getNGrid(), GridMaps, LoadMapAndVMap(), MAX_NUMBER_OF_GRIDS, setNGrid(), CoordPair< LIMIT >::x_coord, and CoordPair< LIMIT >::y_coord.

Referenced by EnsureGridCreated().

◆ EnsureGridLoaded()

bool Map::EnsureGridLoaded ( Cell const &  cell)
private
468{
469 EnsureGridCreated(GridCoord(cell.GridX(), cell.GridY()));
470 NGridType* grid = getNGrid(cell.GridX(), cell.GridY());
471
472 ASSERT(grid);
473 if (!isGridObjectDataLoaded(cell.GridX(), cell.GridY()))
474 {
475 //if (!isGridObjectDataLoaded(cell.GridX(), cell.GridY()))
476 //{
477 LOG_DEBUG("maps", "Loading grid[{}, {}] for map {} instance {}", cell.GridX(), cell.GridY(), GetId(), i_InstanceId);
478
479 setGridObjectDataLoaded(true, cell.GridX(), cell.GridY());
480
481 ObjectGridLoader loader(*grid, this, cell);
482 loader.LoadN();
483
484 Balance();
485 return true;
486 //}
487 }
488
489 return false;
490}
Definition: ObjectGridLoader.h:30
void Balance()
Definition: Map.h:559
void setGridObjectDataLoaded(bool pLoaded, uint32 x, uint32 y)
Definition: Map.h:694
bool isGridObjectDataLoaded(uint32 x, uint32 y) const
Definition: Map.h:693

References ASSERT, Balance(), EnsureGridCreated(), GetId(), getNGrid(), Cell::GridX(), Cell::GridY(), i_InstanceId, isGridObjectDataLoaded(), ObjectGridLoader::LoadN(), LOG_DEBUG, and setGridObjectDataLoaded().

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

◆ ExistMap()

bool Map::ExistMap ( uint32  mapid,
int  gx,
int  gy 
)
static
86{
87 int len = sWorld->GetDataPath().length() + strlen("maps/%03u%02u%02u.map") + 1;
88 char* tmp = new char[len];
89 snprintf(tmp, len, (char*)(sWorld->GetDataPath() + "maps/%03u%02u%02u.map").c_str(), mapid, gx, gy);
90
91 bool ret = false;
92 FILE* pf = fopen(tmp, "rb");
93
94 if (!pf)
95 LOG_ERROR("maps", "Map file '{}': does not exist!", tmp);
96 else
97 {
98 map_fileheader header;
99 if (fread(&header, sizeof(header), 1, pf) == 1)
100 {
101 if (header.mapMagic != MapMagic.asUInt || header.versionMagic != MapVersionMagic)
102 {
103 LOG_ERROR("maps", "Map file '{}' is from an incompatible map version (%.*u v{}), %.*s v{} is expected. Please pull your source, recompile tools and recreate maps using the updated mapextractor, then replace your old map files with new files.",
104 tmp, 4, header.mapMagic, header.versionMagic, 4, MapMagic.asChar, MapVersionMagic);
105 }
106
107 else
108 ret = true;
109 }
110 fclose(pf);
111 }
112 delete [] tmp;
113 return ret;
114}
uint32 MapVersionMagic
Definition: Map.cpp:51
u_map_magic MapMagic
Definition: Map.cpp:50
char asChar[4]
Definition: Map.cpp:46
uint32 asUInt
Definition: Map.cpp:47
Definition: Map.h:90
uint32 mapMagic
Definition: Map.h:91
uint32 versionMagic
Definition: Map.h:92

References u_map_magic::asChar, u_map_magic::asUInt, LOG_ERROR, MapMagic, map_fileheader::mapMagic, MapVersionMagic, sWorld, and map_fileheader::versionMagic.

Referenced by MapMgr::ExistMapAndVMap(), and misc_commandscript::HandleGPSCommand().

◆ ExistVMap()

bool Map::ExistVMap ( uint32  mapid,
int  gx,
int  gy 
)
static
117{
119 {
120 if (vmgr->isMapLoadingEnabled())
121 {
122 VMAP::LoadResult result = vmgr->existsMap((sWorld->GetDataPath() + "vmaps").c_str(), mapid, gx, gy);
123 std::string name = vmgr->getDirFileName(mapid, gx, gy);
124 switch (result)
125 {
127 break;
129 LOG_ERROR("maps", "VMap file '{}' does not exist", (sWorld->GetDataPath() + "vmaps/" + name));
130 LOG_ERROR("maps", "Please place VMAP files (*.vmtree and *.vmtile) in the vmap directory ({}), or correct the DataDir setting in your worldserver.conf file.", (sWorld->GetDataPath() + "vmaps/"));
131 return false;
133 LOG_ERROR("maps", "VMap file '{}' couldn't be loaded", (sWorld->GetDataPath() + "vmaps/" + name));
134 LOG_ERROR("maps", "This is because the version of the VMap file and the version of this module are different, please re-extract the maps with the tools compiled with this module.");
135 return false;
136 }
137 }
138 }
139
140 return true;
141}
LoadResult
Definition: IVMapMgr.h:42
Definition: IVMapMgr.h:78

References VMAP::VMapFactory::createOrGetVMapMgr(), VMAP::FileNotFound, LOG_ERROR, VMAP::Success, sWorld, and VMAP::VersionMismatch.

Referenced by MapMgr::ExistMapAndVMap(), and misc_commandscript::HandleGPSCommand().

◆ GameObjectRelocation()

void Map::GameObjectRelocation ( GameObject go,
float  x,
float  y,
float  z,
float  o 
)
1045{
1046 Cell old_cell = go->GetCurrentCell();
1047 Cell new_cell(x, y);
1048
1049 if (old_cell.DiffGrid(new_cell) || old_cell.DiffCell(new_cell))
1050 {
1051 if (old_cell.DiffGrid(new_cell))
1052 EnsureGridLoaded(new_cell);
1053
1055 }
1056 else
1058
1059 go->Relocate(x, y, z, o);
1060 go->UpdateModelPosition();
1062 go->UpdateObjectVisibility(false);
1063}
void UpdateModelPosition()
Definition: GameObject.cpp:2910
void SetPositionDataUpdate()
Definition: Object.cpp:1145
virtual void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false)
Definition: Object.cpp:2969
void AddGameObjectToMoveList(GameObject *go)
Definition: Map.cpp:1098
void RemoveGameObjectFromMoveList(GameObject *go)
Definition: Map.cpp:1105

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(), MotionTransport::UpdatePassengerPositions(), and StaticTransport::UpdatePosition().

◆ GenerateLowGuid()

◆ GetActiveNonPlayersCount()

std::size_t Map::GetActiveNonPlayersCount ( ) const
inline
655 {
656 return m_activeNonPlayers.size();
657 }

References m_activeNonPlayers.

Referenced by debug_commandscript::HandleDebugObjectCountMap().

◆ GetAllTransports()

TransportsContainer const & Map::GetAllTransports ( ) const
inline
633{ return _transports; }

References _transports.

Referenced by npc_preparations_for_war_vehicle::UpdateAI().

◆ GetAreaId()

uint32 Map::GetAreaId ( uint32  phaseMask,
float  x,
float  y,
float  z 
) const
2148{
2149 uint32 mogpFlags;
2150 int32 adtId, rootId, groupId;
2151 float vmapZ = z;
2152 bool hasVmapArea = GetAreaInfo(phaseMask, x, y, vmapZ, mogpFlags, adtId, rootId, groupId);
2153
2154 uint32 gridAreaId = 0;
2155 float gridMapHeight = INVALID_HEIGHT;
2156 if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y))
2157 {
2158 gridAreaId = gmap->getArea(x, y);
2159 gridMapHeight = gmap->getHeight(x, y);
2160 }
2161
2162 uint16 areaId = 0;
2163
2164 // floor is the height we are closer to (but only if above)
2165 if (hasVmapArea && G3D::fuzzyGe(z, vmapZ - GROUND_HEIGHT_TOLERANCE) && (G3D::fuzzyLt(z, gridMapHeight - GROUND_HEIGHT_TOLERANCE) || vmapZ > gridMapHeight))
2166 {
2167 // wmo found
2168 if (WMOAreaTableEntry const* wmoEntry = GetWMOAreaTableEntryByTripple(rootId, adtId, groupId))
2169 areaId = wmoEntry->areaId;
2170
2171 if (!areaId)
2172 areaId = gridAreaId;
2173 }
2174 else
2175 areaId = gridAreaId;
2176
2177 if (!areaId)
2178 areaId = i_mapEntry->linked_zone;
2179
2180 return areaId;
2181}
std::uint32_t uint32
Definition: Define.h:107
std::uint16_t uint16
Definition: Define.h:108
WMOAreaTableEntry const * GetWMOAreaTableEntryByTripple(int32 rootid, int32 adtid, int32 groupid)
Definition: DBCStores.cpp:694
float const GROUND_HEIGHT_TOLERANCE
Definition: SharedDefines.h:26
Definition: Map.h:202
Definition: Map.h:313
GridMap * GetGrid(float x, float y)
Definition: Map.cpp:1977
bool GetAreaInfo(uint32 phaseMask, float x, float y, float z, uint32 &mogpflags, int32 &adtId, int32 &rootId, int32 &groupId) const
Definition: Map.cpp:2098
uint32 linked_zone
Definition: DBCStructure.h:1333
Definition: DBCStructure.h:2131

References GetAreaInfo(), GetGrid(), 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
2099{
2100 float vmap_z = z;
2101 float dynamic_z = z;
2102 float check_z = z;
2104 uint32 vflags;
2105 int32 vadtId;
2106 int32 vrootId;
2107 int32 vgroupId;
2108 uint32 dflags;
2109 int32 dadtId;
2110 int32 drootId;
2111 int32 dgroupId;
2112
2113 bool hasVmapAreaInfo = vmgr->GetAreaInfo(GetId(), x, y, vmap_z, vflags, vadtId, vrootId, vgroupId);
2114 bool hasDynamicAreaInfo = _dynamicTree.GetAreaInfo(x, y, dynamic_z, phaseMask, dflags, dadtId, drootId, dgroupId);
2115 auto useVmap = [&]() { check_z = vmap_z; flags = vflags; adtId = vadtId; rootId = vrootId; groupId = vgroupId; };
2116 auto useDyn = [&]() { check_z = dynamic_z; flags = dflags; adtId = dadtId; rootId = drootId; groupId = dgroupId; };
2117
2118 if (hasVmapAreaInfo)
2119 {
2120 if (hasDynamicAreaInfo && dynamic_z > vmap_z)
2121 useDyn();
2122 else
2123 useVmap();
2124 }
2125 else if (hasDynamicAreaInfo)
2126 {
2127 useDyn();
2128 }
2129
2130 if (hasVmapAreaInfo || hasDynamicAreaInfo)
2131 {
2132 // check if there's terrain between player height and object height
2133 if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y))
2134 {
2135 float mapHeight = gmap->getHeight(x, y);
2136 // z + 2.0f condition taken from GetHeight(), not sure if it's such a great choice...
2137 if (z + 2.0f > mapHeight && mapHeight > check_z)
2138 return false;
2139 }
2140
2141 return true;
2142 }
2143
2144 return false;
2145}
bool GetAreaInfo(float x, float y, float &z, uint32 phasemask, uint32 &flags, int32 &adtId, int32 &rootId, int32 &groupId) const
Definition: DynamicTree.cpp:311
virtual bool GetAreaInfo(uint32 pMapId, float x, float y, float &z, uint32 &flags, int32 &adtId, int32 &rootId, int32 &groupId) const =0

References _dynamicTree, VMAP::VMapFactory::createOrGetVMapMgr(), DynamicMapTree::GetAreaInfo(), VMAP::IVMapMgr::GetAreaInfo(), GetGrid(), and GetId().

Referenced by GetAreaId().

◆ GetCorpse()

Corpse * Map::GetCorpse ( ObjectGuid const  guid)
3310{
3311 return _objectsStore.Find<Corpse>(guid);
3312}
SPECIFIC_TYPE * Find(KEY_TYPE const &handle)
Definition: TypeContainer.h:145
MapStoredObjectTypesContainer _objectsStore
Definition: Map.h:799

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

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

◆ GetCorpseByPlayer()

Corpse * Map::GetCorpseByPlayer ( ObjectGuid const &  ownerGuid) const
inline
535 {
536 auto itr = _corpsesByPlayer.find(ownerGuid);
537 if (itr != _corpsesByPlayer.end())
538 return itr->second;
539
540 return nullptr;
541 }

References _corpsesByPlayer.

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

◆ GetCorpsesInCell()

std::unordered_set< Corpse * > const * Map::GetCorpsesInCell ( uint32  cellId) const
inline
526 {
527 auto itr = _corpsesByCell.find(cellId);
528 if (itr != _corpsesByCell.end())
529 return &itr->second;
530
531 return nullptr;
532 }

References _corpsesByCell.

Referenced by ObjectWorldLoader::Visit().

◆ GetCreature()

Creature * Map::GetCreature ( ObjectGuid const  guid)
3315{
3316 return _objectsStore.Find<Creature>(guid);
3317}

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

Referenced by Battleground::_ProcessResurrect(), instance_blood_furnace::instance_blood_furnace_InstanceMapScript::ActivatePrisoners(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::AddWave1(), 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(), instance_forge_of_souls::instance_forge_of_souls_InstanceScript::CheckAchievementCriteriaMeet(), instance_obsidian_sanctum::instance_obsidian_sanctum_InstanceMapScript::CheckAchievementCriteriaMeet(), spell_sha_fire_nova::CheckFireTotem(), instance_molten_core::instance_molten_core_InstanceMapScript::CheckMajordomoExecutus(), boss_prince_valanar_icc::boss_prince_valanarAI::CheckRoom(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::CheckTombReset(), instance_stratholme::instance_stratholme_InstanceMapScript::CheckZiggurats(), instance_the_black_morass::instance_the_black_morass_InstanceMapScript::CleanupInstance(), violet_hold_trashAI::ClearDoorSealAura(), npc_hor_lich_king::npc_hor_lich_kingAI::DoAction(), npc_vh_void_sentry::npc_vh_void_sentryAI::DoAction(), instance_molten_core::instance_molten_core_InstanceMapScript::DoAction(), boss_ayamiss::DoAction(), instance_obsidian_sanctum::instance_obsidian_sanctum_InstanceMapScript::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(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::DoSummonGrandChampion(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::DoWipe1(), instance_blackrock_spire::instance_blackrock_spireMapScript::Dragonspireroomcheck(), Spell::EffectDestroyAllTotems(), Spell::EffectScriptEffect(), BattlegroundEY::EventTeamCapturedPoint(), Battleground::GetBGCreature(), boss_erekem::boss_erekemAI::GetChainHealTargetGUID(), Battlefield::GetCreature(), InstanceScript::GetCreature(), ObjectAccessor::GetCreature(), npc_ranshalla::npc_ranshallaAI::GetSpeakerByEntry(), SmartScript::GetTargets(), WorldSession::HandleAreaSpiritHealerQueryOpcode(), WorldSession::HandleAreaSpiritHealerQueueOpcode(), WorldSession::HandleAutostoreLootItemOpcode(), WorldSession::HandleBattlemasterHelloOpcode(), WorldSession::HandleBattlemasterJoinArena(), BattlegroundIC::HandleCapturedNodes(), 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(), WorldSession::HandleTotemDestroyed(), 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_ulduar::instance_ulduar_InstanceMapScript::IsEncounterInProgress(), instance_zulfarrak::instance_zulfarrak_InstanceMapScript::IsWaveAllDead(), npc_ranshalla::npc_ranshallaAI::JustDidDialogueStep(), boss_rajaxx::JustDied(), boss_jormungarAI::JustDied(), npc_ulduar_hodir_priest::npc_ulduar_hodir_priestAI::JustDied(), npc_ulduar_hodir_druid::npc_ulduar_hodir_druidAI::JustDied(), npc_ulduar_hodir_shaman::npc_ulduar_hodir_shamanAI::JustDied(), npc_ulduar_hodir_mage::npc_ulduar_hodir_mageAI::JustDied(), boss_skarvald_the_constructor::boss_skarvald_the_constructorAI::JustDied(), boss_dalronn_the_controller::boss_dalronn_the_controllerAI::JustDied(), npc_ichor_globule::npc_ichor_globuleAI::JustDied(), npc_vh_void_sentry::npc_vh_void_sentryAI::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::boss_skarvald_the_constructorAI::JustEngagedWith(), boss_dalronn_the_controller::boss_dalronn_the_controllerAI::JustEngagedWith(), boss_erekem::boss_erekemAI::JustEngagedWith(), npc_erekem_guard::npc_erekem_guardAI::JustEngagedWith(), Player::KilledMonsterCredit(), boss_professor_putricide::boss_professor_putricideAI::MovementInform(), npc_hor_lich_king::npc_hor_lich_kingAI::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::instance_blackwing_lair_InstanceMapScript::OnCreatureCreate(), instance_magisters_terrace::instance_magisters_terrace_InstanceMapScript::OnCreatureCreate(), instance_shadowfang_keep::instance_shadowfang_keep_InstanceMapScript::OnCreatureCreate(), instance_sunwell_plateau::instance_sunwell_plateau_InstanceMapScript::OnCreatureCreate(), instance_ruby_sanctum::instance_ruby_sanctum_InstanceMapScript::OnCreatureCreate(), instance_pit_of_saron::instance_pit_of_saron_InstanceScript::OnCreatureCreate(), instance_ulduar::instance_ulduar_InstanceMapScript::OnCreatureCreate(), instance_molten_core::instance_molten_core_InstanceMapScript::OnGameObjectCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnGameObjectCreate(), instance_naxxramas::instance_naxxramas_InstanceMapScript::OnGameObjectRemove(), instance_ruby_sanctum::instance_ruby_sanctum_InstanceMapScript::OnPlayerEnter(), instance_forge_of_souls::instance_forge_of_souls_InstanceScript::OnPlayerEnter(), instance_pit_of_saron::instance_pit_of_saron_InstanceScript::OnPlayerEnter(), instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::OnPlayerEnter(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::OnUnitDeath(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnUnitDeath(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnUnitDeath(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnUnitDeath(), BattlegroundAV::PopulateNode(), BattlegroundIC::PostUpdateImpl(), instance_blackrock_spire::instance_blackrock_spireMapScript::ProcessEvent(), instance_eye_of_eternity::instance_eye_of_eternity_InstanceMapScript::ProcessEvent(), instance_stratholme::instance_stratholme_InstanceMapScript::ProcessSlaughterEvent(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::RandomizeCompositionsAndShow(), instance_zulgurub::instance_zulgurub_InstanceMapScript::RemoveHakkarPowerStack(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::ReplaceMoiraIfSaved(), boss_tyrannus::boss_tyrannusAI::Reset(), instance_blood_furnace::instance_blood_furnace_InstanceMapScript::ResetPrisoners(), ScheduleCreatureRespawn(), ScriptsProcess(), instance_zulfarrak::instance_zulfarrak_InstanceMapScript::SendAddsUpStairs(), Player::SendLoot(), instance_molten_core::instance_molten_core_InstanceMapScript::SetBossState(), instance_naxxramas::instance_naxxramas_InstanceMapScript::SetBossState(), instance_magtheridons_lair::instance_magtheridons_lair_InstanceMapScript::SetBossState(), instance_blackrock_spire::instance_blackrock_spireMapScript::SetBossState(), instance_blackwing_lair::instance_blackwing_lair_InstanceMapScript::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::instance_blackrock_depths_InstanceMapScript::SetData(), instance_blackrock_spire::instance_blackrock_spireMapScript::SetData(), instance_blackwing_lair::instance_blackwing_lair_InstanceMapScript::SetData(), instance_karazhan::instance_karazhan_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::instance_halls_of_reflection_InstanceMapScript::SetData(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SetData(), instance_eye_of_eternity::instance_eye_of_eternity_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_utgarde_keep::instance_utgarde_keep_InstanceMapScript::SetData(), instance_utgarde_pinnacle::instance_utgarde_pinnacle_InstanceMapScript::SetData(), instance_violet_hold::instance_violet_hold_InstanceMapScript::SetData(), instance_magtheridons_lair::instance_magtheridons_lair_InstanceMapScript::SetData(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::SetData(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::SpawnAnubArak(), instance_ulduar::instance_ulduar_InstanceMapScript::SpawnLeviathanEncounterVehicles(), instance_violet_hold::instance_violet_hold_InstanceMapScript::StartBossEncounter(), instance_molten_core::instance_molten_core_InstanceMapScript::SummonMajordomoExecutus(), instance_blackrock_spire::instance_blackrock_spireMapScript::SummonSolakarWave(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::TombOfSevenEvent(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::TombOfSevenReset(), instance_blackwing_lair::instance_blackwing_lair_InstanceMapScript::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::instance_halls_of_reflection_InstanceMapScript::Update(), instance_naxxramas::instance_naxxramas_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::boss_vaelAI::UpdateAI(), boss_black_knight::boss_black_knightAI::UpdateAI(), npc_fos_corrupted_soul_fragment::npc_fos_corrupted_soul_fragmentAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::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(), boss_anubrekhan::boss_anubrekhanAI::UpdateAI(), boss_faerlina::boss_faerlinaAI::UpdateAI(), npc_power_spark::npc_power_sparkAI::UpdateAI(), boss_erekem::boss_erekemAI::UpdateAI(), boss_xevozz::boss_xevozzAI::UpdateAI(), npc_vh_teleportation_portal::npc_vh_teleportation_portalAI::UpdateAI(), npc_ichor_globule::npc_ichor_globuleAI::UpdateAI(), and Player::UpdateTriggerVisibility().

◆ GetCreatureBySpawnIdStore()

◆ GetCreatureRespawnTime()

time_t Map::GetCreatureRespawnTime ( ObjectGuid::LowType  dbGuid) const
inline
574 {
575 std::unordered_map<ObjectGuid::LowType /*dbGUID*/, time_t>::const_iterator itr = _creatureRespawnTimes.find(dbGuid);
576 if (itr != _creatureRespawnTimes.end())
577 return itr->second;
578
579 return time_t(0);
580 }

References _creatureRespawnTimes.

Referenced by GetLinkedRespawnTime(), and Creature::LoadCreatureFromDB().

◆ GetDebugInfo()

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

Reimplemented in InstanceMap.

4061{
4062 std::stringstream sstr;
4063 sstr << std::boolalpha
4064 << "Id: " << GetId() << " InstanceId: " << GetInstanceId() << " Difficulty: " << std::to_string(GetDifficulty())
4065 << " HasPlayers: " << HavePlayers();
4066 return sstr.str();
4067}
bool HavePlayers() const
Definition: Map.h:477
Difficulty GetDifficulty() const
Definition: Map.h:443

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)
3339{
3340 return _objectsStore.Find<DynamicObject>(guid);
3341}
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
460 {
461 if (!i_mapEntry)
462 return false;
463 return i_mapEntry->GetEntrancePos(mapid, x, y);
464 }
bool GetEntrancePos(int32 &mapid, float &x, float &y) const
Definition: DBCStructure.h:1360

References MapEntry::GetEntrancePos(), and i_mapEntry.

◆ GetEntry()

◆ GetFullTerrainStatusForPosition()

void Map::GetFullTerrainStatusForPosition ( uint32  phaseMask,
float  x,
float  y,
float  z,
float  collisionHeight,
PositionFullTerrainStatus data,
uint8  reqLiquidType = MAP_ALL_LIQUIDS 
)
2288{
2289 GridMap* gmap = GetGrid(x, y);
2290
2292 VMAP::AreaAndLiquidData vmapData;
2293 // VMAP::AreaAndLiquidData dynData;
2294 VMAP::AreaAndLiquidData* wmoData = nullptr;
2295 vmgr->GetAreaAndLiquidData(GetId(), x, y, z, reqLiquidType, vmapData);
2296 // _dynamicTree.GetAreaAndLiquidData(x, y, z, phaseMask, reqLiquidType, dynData);
2297
2298 uint32 gridAreaId = 0;
2299 float gridMapHeight = INVALID_HEIGHT;
2300 if (gmap)
2301 {
2302 gridAreaId = gmap->getArea(x, y);
2303 gridMapHeight = gmap->getHeight(x, y);
2304 }
2305
2306 bool useGridLiquid = true;
2307
2308 // floor is the height we are closer to (but only if above)
2310 if (gridMapHeight > INVALID_HEIGHT && G3D::fuzzyGe(z, gridMapHeight - GROUND_HEIGHT_TOLERANCE))
2311 data.floorZ = gridMapHeight;
2312
2313 if (vmapData.floorZ > VMAP_INVALID_HEIGHT && G3D::fuzzyGe(z, vmapData.floorZ - GROUND_HEIGHT_TOLERANCE) &&
2314 (G3D::fuzzyLt(z, gridMapHeight - GROUND_HEIGHT_TOLERANCE) || vmapData.floorZ > gridMapHeight))
2315 {
2316 data.floorZ = vmapData.floorZ;
2317 wmoData = &vmapData;
2318 }
2319
2320 // NOTE: Objects will not detect a case when a wmo providing area/liquid despawns from under them
2321 // but this is fine as these kind of objects are not meant to be spawned and despawned a lot
2322 // example: Lich King platform
2323 /*
2324 if (dynData.floorZ > VMAP_INVALID_HEIGHT && G3D::fuzzyGe(z, dynData.floorZ - GROUND_HEIGHT_TOLERANCE) &&
2325 (G3D::fuzzyLt(z, gridMapHeight - GROUND_HEIGHT_TOLERANCE) || dynData.floorZ > gridMapHeight) &&
2326 (G3D::fuzzyLt(z, vmapData.floorZ - GROUND_HEIGHT_TOLERANCE) || dynData.floorZ > vmapData.floorZ))
2327 {
2328 data.floorZ = dynData.floorZ;
2329 wmoData = &dynData;
2330 }
2331 */
2332
2333 if (wmoData)
2334 {
2335 if (wmoData->areaInfo)
2336 {
2337 // wmo found
2338 WMOAreaTableEntry const* wmoEntry = GetWMOAreaTableEntryByTripple(wmoData->areaInfo->rootId, wmoData->areaInfo->adtId, wmoData->areaInfo->groupId);
2339 data.outdoors = (wmoData->areaInfo->mogpFlags & 0x8) != 0;
2340 if (wmoEntry)
2341 {
2342 data.areaId = wmoEntry->areaId;
2343 if (wmoEntry->Flags & 4)
2344 data.outdoors = true;
2345 else if (wmoEntry->Flags & 2)
2346 data.outdoors = false;
2347 }
2348
2349 if (!data.areaId)
2350 data.areaId = gridAreaId;
2351
2352 useGridLiquid = !IsInWMOInterior(wmoData->areaInfo->mogpFlags);
2353 }
2354 }
2355 else
2356 {
2357 data.outdoors = true;
2358 data.areaId = gridAreaId;
2359 if (AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(data.areaId))
2360 data.outdoors = (areaEntry->flags & (AREA_FLAG_INSIDE | AREA_FLAG_OUTSIDE)) != AREA_FLAG_INSIDE;
2361 }
2362
2363 if (!data.areaId)
2365
2366 AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(data.areaId);
2367
2368 // liquid processing
2369 if (wmoData && wmoData->liquidInfo && wmoData->liquidInfo->level > wmoData->floorZ)
2370 {
2371 uint32 liquidType = wmoData->liquidInfo->type;
2372 if (GetId() == 530 && liquidType == 2) // gotta love blizzard hacks
2373 liquidType = 15;
2374
2375 uint32 liquidFlagType = 0;
2376 if (LiquidTypeEntry const* liquidData = sLiquidTypeStore.LookupEntry(liquidType))
2377 liquidFlagType = liquidData->Type;
2378
2379 if (liquidType && liquidType < 21 && areaEntry)
2380 {
2381 uint32 overrideLiquid = areaEntry->LiquidTypeOverride[liquidFlagType];
2382 if (!overrideLiquid && areaEntry->zone)
2383 {
2384 AreaTableEntry const* zoneEntry = sAreaTableStore.LookupEntry(areaEntry->zone);
2385 if (zoneEntry)
2386 overrideLiquid = zoneEntry->LiquidTypeOverride[liquidFlagType];
2387 }
2388
2389 if (LiquidTypeEntry const* overrideData = sLiquidTypeStore.LookupEntry(overrideLiquid))
2390 {
2391 liquidType = overrideLiquid;
2392 liquidFlagType = overrideData->Type;
2393 }
2394 }
2395
2396 data.liquidInfo.Level = wmoData->liquidInfo->level;
2397 data.liquidInfo.DepthLevel = wmoData->floorZ;
2398 data.liquidInfo.Entry = liquidType;
2399 data.liquidInfo.Flags = 1 << liquidFlagType;
2400
2401 // Get position delta
2402 float delta = wmoData->liquidInfo->level - z;
2403
2404 if (delta > collisionHeight)
2406 else if (delta > 0.0f)
2408 else if (delta > -0.1f)
2410 else
2412 }
2413
2414 // look up liquid data from grid map
2415 if (gmap && useGridLiquid)
2416 {
2417 LiquidData const& gridLiquidData = gmap->GetLiquidData(x, y, z, collisionHeight, reqLiquidType);
2418 if (gridLiquidData.Status != LIQUID_MAP_NO_WATER && (!wmoData || gridLiquidData.Level > wmoData->floorZ))
2419 {
2420 uint32 liquidEntry = gridLiquidData.Entry;
2421 if (GetId() == 530 && liquidEntry == 2)
2422 liquidEntry = 15;
2423
2424 data.liquidInfo = gridLiquidData;
2425 data.liquidInfo.Entry = liquidEntry;
2426 }
2427 }
2428}
#define VMAP_INVALID_HEIGHT
Definition: IVMapMgr.h:48
@ LIQUID_MAP_UNDER_WATER
Definition: Map.h:148
@ LIQUID_MAP_NO_WATER
Definition: Map.h:144
@ LIQUID_MAP_IN_WATER
Definition: Map.h:147
@ LIQUID_MAP_ABOVE_WATER
Definition: Map.h:145
@ LIQUID_MAP_WATER_WALK
Definition: Map.h:146
static bool IsInWMOInterior(uint32 mogpFlags)
Definition: Map.cpp:2093
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTableEntryfmt)
DBCStorage< LiquidTypeEntry > sLiquidTypeStore(LiquidTypefmt)
@ AREA_FLAG_OUTSIDE
Definition: DBCEnums.h:260
@ AREA_FLAG_INSIDE
Definition: DBCEnums.h:259
Definition: IVMapMgr.h:52
Optional< AreaInfo > areaInfo
Definition: IVMapMgr.h:72
Optional< LiquidInfo > liquidInfo
Definition: IVMapMgr.h:73
float floorZ
Definition: IVMapMgr.h:71
virtual void GetAreaAndLiquidData(uint32 mapId, float x, float y, float z, uint8 reqLiquidType, AreaAndLiquidData &data) const =0
Definition: Map.h:171
float Level
Definition: Map.h:176
uint32 Flags
Definition: Map.h:175
uint32 Entry
Definition: Map.h:174
LiquidStatus Status
Definition: Map.h:178
float DepthLevel
Definition: Map.h:177
float floorZ
Definition: Map.h:185
uint32 areaId
Definition: Map.h:184
LiquidData liquidInfo
Definition: Map.h:187
bool outdoors
Definition: Map.h:186
uint16 getArea(float x, float y) const
Definition: Map.cpp:1553
LiquidData const GetLiquidData(float x, float y, float z, float collisionHeight, uint8 ReqLiquidType) const
Definition: Map.cpp:1890
float getHeight(float x, float y) const
Definition: Map.h:260
Definition: DBCStructure.h:519
uint32 zone
Definition: DBCStructure.h:522
uint32 LiquidTypeOverride[4]
Definition: DBCStructure.h:530
Definition: DBCStructure.h:1283
uint32 Flags
Definition: DBCStructure.h:2141
uint32 areaId
Definition: DBCStructure.h:2142

References AREA_FLAG_INSIDE, AREA_FLAG_OUTSIDE, PositionFullTerrainStatus::areaId, WMOAreaTableEntry::areaId, VMAP::AreaAndLiquidData::areaInfo, VMAP::VMapFactory::createOrGetVMapMgr(), LiquidData::DepthLevel, LiquidData::Entry, LiquidData::Flags, WMOAreaTableEntry::Flags, VMAP::AreaAndLiquidData::floorZ, PositionFullTerrainStatus::floorZ, GridMap::getArea(), VMAP::IVMapMgr::GetAreaAndLiquidData(), GetGrid(), GridMap::getHeight(), GetId(), GridMap::GetLiquidData(), 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, 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)
3320{
3321 return _objectsStore.Find<GameObject>(guid);
3322}

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

Referenced by boss_sjonnir::boss_sjonnirAI::ActivatePipe(), Spell::CheckCast(), Player::CheckDuelDistance(), Spell::CheckEffectTarget(), instance_stratholme::instance_stratholme_InstanceMapScript::CheckZiggurats(), boss_hodir::boss_hodirAI::DoAction(), instance_obsidian_sanctum::instance_obsidian_sanctum_InstanceMapScript::DoAction(), Spell::DoAllEffectOnTarget(), npc_rocknot::npc_rocknotAI::DoGo(), WorldSession::DoLootRelease(), InstanceScript::DoRespawnGameObject(), InstanceScript::DoUseDoorOrButton(), instance_blackrock_spire::instance_blackrock_spireMapScript::Dragonspireroomcheck(), instance_blackrock_spire::instance_blackrock_spireMapScript::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::HandleMovementOpcodes(), boss_urok_doomhowl::boss_urok_doomhowlAI::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::boss_rend_blackhandAI::JustDied(), boss_shade_of_aran::JustDied(), npc_gunship::npc_gunshipAI::JustDied(), boss_sjonnir::boss_sjonnirAI::JustDied(), boss_kologarn::boss_kologarnAI::JustDied(), boss_faerlina::boss_faerlinaAI::JustDied(), boss_four_horsemen::boss_four_horsemenAI::JustDied(), boss_gothik::boss_gothikAI::JustDied(), boss_kelthuzad::boss_kelthuzadAI::JustDied(), boss_noth::boss_nothAI::JustDied(), boss_thaddius::boss_thaddiusAI::JustDied(), boss_shade_of_aran::JustEngagedWith(), boss_sjonnir::boss_sjonnirAI::JustEngagedWith(), boss_kologarn::boss_kologarnAI::JustEngagedWith(), boss_thaddius_summon::boss_thaddius_summonAI::JustEngagedWith(), boss_anubrekhan::boss_anubrekhanAI::JustEngagedWith(), boss_faerlina::boss_faerlinaAI::JustEngagedWith(), boss_four_horsemen::boss_four_horsemenAI::JustEngagedWith(), boss_gothik::boss_gothikAI::JustEngagedWith(), boss_heigan::boss_heiganAI::JustEngagedWith(), boss_kelthuzad::boss_kelthuzadAI::JustEngagedWith(), boss_loatheb::boss_loathebAI::JustEngagedWith(), boss_maexxna::boss_maexxnaAI::JustEngagedWith(), boss_noth::boss_nothAI::JustEngagedWith(), instance_temple_of_ahnqiraj::instance_temple_of_ahnqiraj_InstanceMapScript::OnCreatureCreate(), instance_sunwell_plateau::instance_sunwell_plateau_InstanceMapScript::OnPlayerEnter(), instance_ulduar::instance_ulduar_InstanceMapScript::OnPlayerEnter(), instance_eye_of_eternity::instance_eye_of_eternity_InstanceMapScript::OnPlayerEnter(), instance_temple_of_ahnqiraj::instance_temple_of_ahnqiraj_InstanceMapScript::OnUnitDeath(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::OpenDoors(), Player::PrepareQuestMenu(), instance_blackrock_spire::instance_blackrock_spireMapScript::ProcessEvent(), instance_eye_of_eternity::instance_eye_of_eternity_InstanceMapScript::ProcessEvent(), instance_stratholme::instance_stratholme_InstanceMapScript::ProcessSlaughterEvent(), instance_eye_of_eternity::instance_eye_of_eternity_InstanceMapScript::ReadSaveDataMore(), boss_sartharion_dragonAI::RemoveTwilightPortal(), boss_rend_blackhand::boss_rend_blackhandAI::Reset(), boss_shade_of_aran::Reset(), boss_anubrekhan::boss_anubrekhanAI::Reset(), boss_faerlina::boss_faerlinaAI::Reset(), boss_four_horsemen::boss_four_horsemenAI::Reset(), boss_gothik::boss_gothikAI::Reset(), boss_heigan::boss_heiganAI::Reset(), boss_kelthuzad::boss_kelthuzadAI::Reset(), boss_loatheb::boss_loathebAI::Reset(), boss_maexxna::boss_maexxnaAI::Reset(), boss_noth::boss_nothAI::Reset(), boss_thaddius::boss_thaddiusAI::Reset(), boss_sjonnir::boss_sjonnirAI::Reset(), boss_kologarn::boss_kologarnAI::Reset(), boss_palehoof::boss_palehoofAI::Reset(), ScriptsProcess(), Player::SendLoot(), Player::SendQuestGiverStatusMultiple(), Acore::VisibleNotifier::SendToSelf(), instance_molten_core::instance_molten_core_InstanceMapScript::SetBossState(), instance_naxxramas::instance_naxxramas_InstanceMapScript::SetBossState(), instance_magtheridons_lair::instance_magtheridons_lair_InstanceMapScript::SetBossState(), instance_blackwing_lair::instance_blackwing_lair_InstanceMapScript::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_ulduar::instance_ulduar_InstanceMapScript::setChestsLootable(), instance_blackrock_spire::instance_blackrock_spireMapScript::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_eye_of_eternity::instance_eye_of_eternity_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(), instance_halls_of_lightning::instance_halls_of_lightning_InstanceMapScript::SetData(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::SetData(), boss_rend_blackhand::boss_rend_blackhandAI::SummonWave(), brann_bronzebeard::brann_bronzebeardAI::SwitchHeadVisaul(), 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_gundrak::instance_gundrak_InstanceMapScript::Update(), instance_naxxramas::instance_naxxramas_InstanceMapScript::Update(), instance_violet_hold::instance_violet_hold_InstanceMapScript::Update(), boss_rend_blackhand::boss_rend_blackhandAI::UpdateAI(), npc_harrison_jones::npc_harrison_jonesAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_pos_leader_second::npc_pos_leader_secondAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_freya_nature_bomb::boss_freya_nature_bombAI::UpdateAI(), boss_hodir::boss_hodirAI::UpdateAI(), npc_pet_gen_plump_turkey::UpdateAI(), BattlegroundRV::UpdatePillars(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::UpdateRunes(), Player::UpdateTriggerVisibility(), 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
566 {
567 return _dynamicTree.getHeight(x, y, z, maxSearchDist, phasemask);
568 }
float getHeight(float x, float y, float z, float maxSearchDist, uint32 phasemask) const
Definition: DynamicTree.cpp:294

References _dynamicTree, and DynamicMapTree::getHeight().

◆ GetGORespawnTime()

time_t Map::GetGORespawnTime ( ObjectGuid::LowType  dbGuid) const
inline
583 {
584 std::unordered_map<ObjectGuid::LowType /*dbGUID*/, time_t>::const_iterator itr = _goRespawnTimes.find(dbGuid);
585 if (itr != _goRespawnTimes.end())
586 return itr->second;
587
588 return time_t(0);
589 }

References _goRespawnTimes.

Referenced by GetLinkedRespawnTime(), and GameObject::LoadGameObjectFromDB().

◆ GetGrid()

GridMap * Map::GetGrid ( float  x,
float  y 
)
1978{
1979 // half opt method
1980 int gx = (int)(32 - x / SIZE_OF_GRIDS); //grid x
1981 int gy = (int)(32 - y / SIZE_OF_GRIDS); //grid y
1982
1983 // ensure GridMap is loaded
1984 EnsureGridCreated(GridCoord(63 - gx, 63 - gy));
1985
1986 return GridMaps[gx][gy];
1987}
#define SIZE_OF_GRIDS
Definition: MapDefines.h:25

References EnsureGridCreated(), GridMaps, and SIZE_OF_GRIDS.

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

◆ GetGridHeight()

float Map::GetGridHeight ( float  x,
float  y 
) const
2078{
2079 if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y))
2080 return gmap->getHeight(x, y);
2081
2083}

References GetGrid(), and VMAP_INVALID_HEIGHT_VALUE.

Referenced by CheckCollisionAndGetValidCoords(), and GetHeight().

◆ GetGuidSequenceGenerator()

template<HighGuid high>
ObjectGuidGeneratorBase & Map::GetGuidSequenceGenerator ( )
inlineprivate
790 {
791 auto itr = _guidGenerators.find(high);
792 if (itr == _guidGenerators.end())
793 itr = _guidGenerators.insert(std::make_pair(high, std::unique_ptr<ObjectGuidGenerator<high>>(new ObjectGuidGenerator<high>()))).first;
794
795 return *itr->second;
796 }
Definition: ObjectGuid.h:297
std::map< HighGuid, std::unique_ptr< ObjectGuidGeneratorBase > > _guidGenerators
Definition: Map.h:798

References _guidGenerators.

◆ GetHeight() [1/2]

float Map::GetHeight ( float  x,
float  y,
float  z,
bool  checkVMap = true,
float  maxSearchDist = DEFAULT_HEIGHT_SEARCH 
) const
2041{
2042 // find raw .map surface under Z coordinates
2043 float mapHeight = VMAP_INVALID_HEIGHT_VALUE;
2044 float gridHeight = GetGridHeight(x, y);
2045 if (G3D::fuzzyGe(z, gridHeight - GROUND_HEIGHT_TOLERANCE))
2046 mapHeight = gridHeight;
2047
2048 float vmapHeight = VMAP_INVALID_HEIGHT_VALUE;
2049 if (checkVMap)
2050 {
2052 vmapHeight = vmgr->getHeight(GetId(), x, y, z, maxSearchDist); // look from a bit higher pos to find the floor
2053 }
2054
2055 // mapHeight set for any above raw ground Z or <= INVALID_HEIGHT
2056 // vmapheight set for any under Z value or <= INVALID_HEIGHT
2057 if (vmapHeight > INVALID_HEIGHT)
2058 {
2059 if (mapHeight > INVALID_HEIGHT)
2060 {
2061 // we have mapheight and vmapheight and must select more appropriate
2062
2063 // we are already under the surface or vmap height above map heigt
2064 // or if the distance of the vmap height is less the land height distance
2065 if (vmapHeight > mapHeight || std::fabs(mapHeight - z) > std::fabs(vmapHeight - z))
2066 return vmapHeight;
2067 else
2068 return mapHeight; // better use .map surface height
2069 }
2070 else
2071 return vmapHeight; // we have only vmapHeight (if have)
2072 }
2073
2074 return mapHeight; // explicitly use map data
2075}
virtual float getHeight(unsigned int pMapId, float x, float y, float z, float maxSearchDist)=0

References VMAP::VMapFactory::createOrGetVMapMgr(), GetGridHeight(), VMAP::IVMapMgr::getHeight(), GetId(), 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::SelectImplicitCasterDestTargets(), and npc_cork_gizelton::npc_cork_gizeltonAI::WaypointReached().

◆ GetHeight() [2/2]

float Map::GetHeight ( uint32  phasemask,
float  x,
float  y,
float  z,
bool  vmap = true,
float  maxSearchDist = DEFAULT_HEIGHT_SEARCH 
) const
2493{
2494 float h1, h2;
2495 h1 = GetHeight(x, y, z, vmap, maxSearchDist);
2496 h2 = _dynamicTree.getHeight(x, y, z, maxSearchDist, phasemask);
2497 return std::max<float>(h1, h2);
2498}
float GetHeight(float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
Definition: Map.cpp:2040

References _dynamicTree, GetHeight(), and DynamicMapTree::getHeight().

◆ GetId()

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

References i_mapEntry, and MapEntry::MapID.

Referenced by Group::_cancelHomebindIfInstance(), AddObjectToRemoveList(), AddObjectToSwitchList(), InstanceMap::AddPlayerToMap(), spell_gen_consumption::CalculateDamage(), MapUpdateRequest::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(), CreatureAI::DoZoneInCombat(), EnsureGridLoaded(), anonymous_namespace{AllMapScript.cpp}::ForeachMaps(), GetAreaInfo(), GetDebugInfo(), GetFullTerrainStatusForPosition(), GetHeight(), GetLiquidData(), GetMapDifficulty(), debug_commandscript::HandleDebugObjectCountMap(), gobject_commandscript::HandleGameObjectAddCommand(), go_commandscript::HandleGoZoneXYCommand(), WorldSession::HandleMoveWorldportAck(), npc_commandscript::HandleNpcAddCommand(), WorldSession::HandlePlayerLoginFromDB(), WorldSession::HandlePlayerLoginToCharInWorld(), WorldSession::HandleSetRaidDifficultyOpcode(), wp_commandscript::HandleWpModifyCommand(), wp_commandscript::HandleWpShowCommand(), InitVisibilityDistance(), InstanceMap::InitVisibilityDistance(), Player::inRandomLfgDungeon(), isInLineOfSight(), DisableMgr::IsPathfindingEnabled(), LoadCorpseData(), LoadMap(), LoadMMap(), ObjectGridLoader::LoadN(), LoadRespawnTimes(), LoadVMap(), LogEncounterFinished(), AchievementCriteriaData::Meets(), MotionMaster::MoveFall(), lfg::LFGPlayerScript::OnMapChanged(), InstanceMap::PermBindAllPlayers(), spell_valkyr_touch::spell_valkyr_touchAuraScript::PrepareAuraScript(), RemoveAllPlayers(), RemoveCreatureRespawnTime(), RemoveGORespawnTime(), InstanceMap::Reset(), Player::RewardReputation(), SaveCreatureRespawnTime(), SaveGORespawnTime(), InstanceMap::SendResetWarnings(), World::SetInitialWorldSettings(), WorldObject::SetMap(), Player::SetMover(), SummonCreatureGroup(), MotionTransport::TeleportTransport(), UnloadGrid(), Update(), UpdateEncounterState(), ObjectGridLoader::Visit(), and ~Map().

◆ GetInstanceId()

◆ GetInstanceResetPeriod()

time_t Map::GetInstanceResetPeriod ( ) const
inline

◆ GetLinkedRespawnTime()

time_t Map::GetLinkedRespawnTime ( ObjectGuid  guid) const
3582{
3583 ObjectGuid linkedGuid = sObjectMgr->GetLinkedRespawnGuid(guid);
3584 switch (linkedGuid.GetHigh())
3585 {
3586 case HighGuid::Unit:
3587 return GetCreatureRespawnTime(linkedGuid.GetCounter());
3588 case HighGuid::GameObject:
3589 return GetGORespawnTime(linkedGuid.GetCounter());
3590 default:
3591 break;
3592 }
3593
3594 return time_t(0);
3595}
#define sObjectMgr
Definition: ObjectMgr.h:1623
Definition: ObjectGuid.h:118
HighGuid GetHigh() const
Definition: ObjectGuid.h:143
time_t GetCreatureRespawnTime(ObjectGuid::LowType dbGuid) const
Definition: Map.h:573
time_t GetGORespawnTime(ObjectGuid::LowType dbGuid) const
Definition: Map.h:582

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

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

◆ GetLiquidData()

LiquidData const Map::GetLiquidData ( uint32  phaseMask,
float  x,
float  y,
float  z,
float  collisionHeight,
uint8  ReqLiquidType 
)
2202{
2203 LiquidData liquidData;
2204
2206 float liquid_level = INVALID_HEIGHT;
2207 float ground_level = INVALID_HEIGHT;
2208 uint32 liquid_type = 0;
2209 uint32 mogpFlags = 0;
2210 bool useGridLiquid = true;
2211 if (vmgr->GetLiquidLevel(GetId(), x, y, z, ReqLiquidType, liquid_level, ground_level, liquid_type, mogpFlags))
2212 {
2213 useGridLiquid = !IsInWMOInterior(mogpFlags);
2214 LOG_DEBUG("maps", "GetLiquidStatus(): vmap liquid level: {} ground: {} type: {}", liquid_level, ground_level, liquid_type);
2215 // Check water level and ground level
2216 if (liquid_level > ground_level && G3D::fuzzyGe(z, ground_level - GROUND_HEIGHT_TOLERANCE))
2217 {
2218 // hardcoded in client like this
2219 if (GetId() == 530 && liquid_type == 2)
2220 liquid_type = 15;
2221
2222 uint32 liquidFlagType = 0;
2223 if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(liquid_type))
2224 liquidFlagType = liq->Type;
2225
2226 if (liquid_type && liquid_type < 21)
2227 {
2228 if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(GetAreaId(phaseMask, x, y, z)))
2229 {
2230 uint32 overrideLiquid = area->LiquidTypeOverride[liquidFlagType];
2231 if (!overrideLiquid && area->zone)
2232 {
2233 area = sAreaTableStore.LookupEntry(area->zone);
2234 if (area)
2235 overrideLiquid = area->LiquidTypeOverride[liquidFlagType];
2236 }
2237
2238 if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(overrideLiquid))
2239 {
2240 liquid_type = overrideLiquid;
2241 liquidFlagType = liq->Type;
2242 }
2243 }
2244 }
2245
2246 liquidData.Level = liquid_level;
2247 liquidData.DepthLevel = ground_level;
2248 liquidData.Entry = liquid_type;
2249 liquidData.Flags = 1 << liquidFlagType;
2250 }
2251
2252 float delta = liquid_level - z;
2253
2254 // Get position delta
2255 if (delta > collisionHeight)
2256 liquidData.Status = LIQUID_MAP_UNDER_WATER;
2257 else if (delta > 0.0f)
2258 liquidData.Status = LIQUID_MAP_IN_WATER;
2259 else if (delta > -0.1f)
2260 liquidData.Status = LIQUID_MAP_WATER_WALK;
2261 else
2262 liquidData.Status = LIQUID_MAP_ABOVE_WATER;
2263 }
2264
2265 if (useGridLiquid)
2266 {
2267 if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y))
2268 {
2269 LiquidData const& map_data = gmap->GetLiquidData(x, y, z, collisionHeight, ReqLiquidType);
2270 // Not override LIQUID_MAP_ABOVE_WATER with LIQUID_MAP_NO_WATER:
2271 if (map_data.Status != LIQUID_MAP_NO_WATER && (map_data.Level > ground_level))
2272 {
2273 // hardcoded in client like this
2274 uint32 liquidEntry = map_data.Entry;
2275 if (GetId() == 530 && liquidEntry == 2)
2276 liquidEntry = 15;
2277
2278 liquidData = map_data;
2279 liquidData.Entry = liquidEntry;
2280 }
2281 }
2282 }
2283
2284 return liquidData;
2285}
virtual bool GetLiquidLevel(uint32 pMapId, float x, float y, float z, uint8 ReqLiquidType, float &level, float &floor, uint32 &type, uint32 &mogpFlags) const =0
uint32 GetAreaId(uint32 phaseMask, float x, float y, float z) const
Definition: Map.cpp:2147

References VMAP::VMapFactory::createOrGetVMapMgr(), LiquidData::DepthLevel, LiquidData::Entry, LiquidData::Flags, GetAreaId(), GetGrid(), GetId(), VMAP::IVMapMgr::GetLiquidLevel(), GROUND_HEIGHT_TOLERANCE, INVALID_HEIGHT, IsInWMOInterior(), LiquidData::Level, LIQUID_MAP_ABOVE_WATER, LIQUID_MAP_IN_WATER, LIQUID_MAP_NO_WATER, LIQUID_MAP_UNDER_WATER, LIQUID_MAP_WATER_WALK, LOG_DEBUG, sAreaTableStore, sLiquidTypeStore, and LiquidData::Status.

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

◆ GetMapDifficulty()

MapDifficulty const * Map::GetMapDifficulty ( ) const
3210{
3212}
MapDifficulty const * GetMapDifficultyData(uint32 mapId, Difficulty difficulty)
Definition: DBCStores.cpp:761

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

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

◆ GetMapName()

char const * Map::GetMapName ( ) const
2525{
2526 return i_mapEntry ? i_mapEntry->name[sWorld->GetDefaultDbcLocale()] : "UNNAMEDMAP\x0";
2527}
char const * name[16]
Definition: DBCStructure.h:1331

References i_mapEntry, MapEntry::name, and sWorld.

Referenced by InstanceMap::CannotEnter(), debug_commandscript::HandleDebugObjectCountMap(), go_commandscript::HandleGoZoneXYCommand(), LoadMMap(), LoadVMap(), LogCommandUsage(), and InstanceMap::PermBindAllPlayers().

◆ GetMinHeight()

float Map::GetMinHeight ( float  x,
float  y 
) const
2086{
2087 if (GridMap const* grid = const_cast<Map*>(this)->GetGrid(x, y))
2088 return grid->getMinHeight(x, y);
2089
2090 return -500.0f;
2091}

References GetGrid().

Referenced by WorldSession::HandleMovementOpcodes().

◆ GetMMapLock()

std::shared_mutex & Map::GetMMapLock ( ) const
inline
387{ return *(const_cast<std::shared_mutex*>(&MMapLock)); }
std::shared_mutex MMapLock
Definition: Map.h:706

References MMapLock.

◆ getNGrid()

NGridType * Map::getNGrid ( uint32  x,
uint32  y 
) const
inlineprivate
687 {
689 return i_grids[x][y];
690 }
NGridType * i_grids[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS]
Definition: Map.h:741

References ASSERT, i_grids, and MAX_NUMBER_OF_GRIDS.

Referenced by AddToGrid(), EnsureGridCreated(), EnsureGridCreated_i(), EnsureGridLoaded(), IsGridLoaded(), isGridObjectDataLoaded(), IsRemovalGrid(), setGridObjectDataLoaded(), SwitchGridContainers(), and Visit().

◆ GetObjectHitPos()

bool Map::GetObjectHitPos ( uint32  phasemask,
float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2,
float &  rx,
float &  ry,
float &  rz,
float  modifyDist 
)
2479{
2480 G3D::Vector3 startPos(x1, y1, z1);
2481 G3D::Vector3 dstPos(x2, y2, z2);
2482
2483 G3D::Vector3 resultPos;
2484 bool result = _dynamicTree.GetObjectHitPos(phasemask, startPos, dstPos, resultPos, modifyDist);
2485
2486 rx = resultPos.x;
2487 ry = resultPos.y;
2488 rz = resultPos.z;
2489 return result;
2490}
bool GetObjectHitPos(uint32 phasemask, const G3D::Vector3 &pPos1, const G3D::Vector3 &pPos2, G3D::Vector3 &pResultHitPos, float pModifyDist) const
Definition: DynamicTree.cpp:230

References _dynamicTree, and DynamicMapTree::GetObjectHitPos().

Referenced by CheckCollisionAndGetValidCoords(), and Spell::SelectImplicitCasterDestTargets().

◆ GetObjectsStore()

◆ GetParent()

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

References m_parentMap.

◆ GetPet()

Pet * Map::GetPet ( ObjectGuid const  guid)
3325{
3326 return _objectsStore.Find<Pet>(guid);
3327}
Definition: Pet.h:41

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

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

◆ GetPlayers()

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

References m_mapRefMgr.

Referenced by AddToMap(), boss_hadronox::boss_hadronoxAI::AnyPlayerValid(), MotionTransport::BuildUpdate(), StaticTransport::BuildUpdate(), InstanceMap::CannotEnter(), boss_professor_putricide::boss_professor_putricideAI::ChangePhase(), boss_gothik::boss_gothikAI::CheckGroupSplitted(), boss_volazj::CheckPhaseMinions(), boss_skadi_grauf::boss_skadi_graufAI::CheckPlayers(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::ChromieWhisper(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), npc_arthas::npc_arthasAI::DoAction(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::DoCheckDedicatedInsanity(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoCheckHeraldOfTheTitans(), DoForAllPlayers(), instance_violet_hold::instance_violet_hold_InstanceMapScript::DoNeedCleanup(), 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::boss_thorimAI::GetArenaPlayer(), instance_pit_of_saron::instance_pit_of_saron_InstanceScript::GetCreatureEntry(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::GetCreatureEntry(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::GetGameObjectEntry(), instance_sunwell_plateau::instance_sunwell_plateau_InstanceMapScript::GetPlayerInMap(), spell_teron_gorefiend_shadowy_construct::HandleEffectApply(), spell_yogg_saron_brain_link_aura::HandleOnEffectApply(), WorldSession::HandleSetRaidDifficultyOpcode(), boss_ichoron::boss_ichoronAI::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::boss_yoggsaronAI::JustDied(), boss_ahune::JustDied(), boss_four_horsemen::boss_four_horsemenAI::JustDied(), boss_devourer_of_souls::boss_devourer_of_soulsAI::JustEngagedWith(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustSummoned(), boss_gothik::boss_gothikAI::JustSummoned(), boss_felblood_kaelthas::LapseAction(), LogEncounterFinished(), WorldSession::LogoutPlayer(), npc_image_of_medivh::npc_image_of_medivhAI::NextStep(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::OnCreatureCreate(), instance_forge_of_souls::instance_forge_of_souls_InstanceScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_pit_of_saron::instance_pit_of_saron_InstanceScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), instance_nexus::instance_nexus_InstanceMapScript::OnCreatureCreate(), instance_shattered_halls::instance_shattered_halls_InstanceMapScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnGameObjectCreate(), PlayDirectSoundToMap(), spell_valkyr_touch::spell_valkyr_touchAuraScript::PrepareAuraScript(), SmartScript::ProcessAction(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::RemoveBackPack(), RemoveFromMap(), boss_krystallus::boss_krystallusAI::RemoveStonedEffect(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::ReplaceMoiraIfSaved(), boss_volazj::ResetPlayersPhaseMask(), boss_yoggsaron_constrictor_tentacle::boss_yoggsaron_constrictor_tentacleAI::SelectConstrictTarget(), boss_yoggsaron_corruptor_tentacle::boss_yoggsaron_corruptor_tentacleAI::SelectCorruptionTarget(), boss_gluth::boss_gluthAI::SelectPlayerInRoom(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::SelectT(), spell_gen_rallying_cry_of_the_dragonslayer::SelectTarget(), spell_gen_adals_song_of_battle::SelectTarget(), ScriptedAI::SelectTargetFromPlayerList(), CreatureTextMgr::SendChatPacket(), CreatureTextMgr::SendNonChatPacket(), SendPacketToPlayers(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::SendUpdateWorldState(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::SetData(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::SetData(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::SetData(), instance_ulduar::instance_ulduar_InstanceMapScript::SetData(), GameObject::SetLootRecipient(), Creature::SetLootRecipient(), SetZoneMusic(), SetZoneOverrideLight(), SetZoneWeather(), boss_hodir::boss_hodirAI::SpawnHelpers(), instance_zulaman::instance_zulaman_InstanceMapScript::SummonHostage(), 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::instance_halls_of_reflection_InstanceMapScript::Update(), instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::Update(), boss_chromaggus::boss_chromaggusAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_kiljaeden_controller::npc_kiljaeden_controllerAI::UpdateAI(), npc_singularity::npc_singularityAI::UpdateAI(), boss_janalai::boss_janalaiAI::UpdateAI(), npc_arthas::npc_arthasAI::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::npc_hor_lich_kingAI::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_heigan::boss_heiganAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_scion_of_eternity::npc_scion_of_eternityAI::UpdateAI(), boss_keristrasza::boss_keristraszaAI::UpdateAI(), boss_freya::boss_freyaAI::UpdateAI(), boss_vezax::boss_vezaxAI::UpdateAI(), boss_hodir::boss_hodirAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::UpdateAI(), npc_ulduar_flames_initial::npc_ulduar_flames_initialAI::UpdateAI(), npc_demonic_vapor::npc_demonic_vaporAI::UpdateAI(), UpdateEncounterState(), npc_grimstone::npc_grimstoneAI::UpdateEscortAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateWorldState(), and npc_thrall_bfu::npc_thrall_bfuAI::UpdateWorldState().

◆ GetPlayersCountExceptGMs()

◆ GetSpawnMode()

◆ GetTransport()

Transport * Map::GetTransport ( ObjectGuid const  guid)
3330{
3331 if (guid.GetHigh() != HighGuid::Mo_Transport && guid.GetHigh() != HighGuid::Transport)
3332 return nullptr;
3333
3334 GameObject* go = GetGameObject(guid);
3335 return go ? go->ToTransport() : nullptr;
3336}
Transport * ToTransport()
Definition: GameObject.h:322
GameObject * GetGameObject(ObjectGuid const guid)
Definition: Map.cpp:3319

References GetGameObject(), ObjectGuid::GetHigh(), and GameObject::ToTransport().

Referenced by ObjectAccessor::GetTransport(), WorldSession::HandleMovementOpcodes(), npc_gunship::npc_gunshipAI::JustDied(), npc_gunship_boarding_addAI::MovementInform(), ScriptsProcess(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), and npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI().

◆ GetTransportForPos()

Transport * Map::GetTransportForPos ( uint32  phase,
float  x,
float  y,
float  z,
WorldObject worldobject = nullptr 
)
2014{
2015 G3D::Vector3 v(x, y, z + 2.0f);
2016 G3D::Ray r(v, G3D::Vector3(0, 0, -1));
2017 for (TransportsContainer::const_iterator itr = _transports.begin(); itr != _transports.end(); ++itr)
2018 if ((*itr)->IsInWorld() && (*itr)->GetExactDistSq(x, y, z) < 75.0f * 75.0f && (*itr)->m_model)
2019 {
2020 float dist = 30.0f;
2021 bool hit = (*itr)->m_model->intersectRay(r, dist, false, phase, VMAP::ModelIgnoreFlags::Nothing);
2022 if (hit)
2023 return *itr;
2024 }
2025
2026 if (worldobject)
2027 if (GameObject* staticTrans = worldobject->FindNearestGameObjectOfType(GAMEOBJECT_TYPE_TRANSPORT, 75.0f))
2028 if (staticTrans->m_model)
2029 {
2030 float dist = 10.0f;
2031 bool hit = staticTrans->m_model->intersectRay(r, dist, false, phase, VMAP::ModelIgnoreFlags::Nothing);
2032 if (hit)
2033 if (GetHeight(phase, x, y, z, true, 30.0f) < (v.z - dist + 1.0f))
2034 return staticTrans->ToTransport();
2035 }
2036
2037 return nullptr;
2038}
phase
Definition: boss_skadi.cpp:103
@ GAMEOBJECT_TYPE_TRANSPORT
Definition: SharedDefines.h:1571
GameObject * FindNearestGameObjectOfType(GameobjectTypes type, float range) const
Definition: Object.cpp:2464

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

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

◆ GetVisibilityRange()

◆ GetWaterLevel()

float Map::GetWaterLevel ( float  x,
float  y 
) const
2431{
2432 if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y))
2433 return gmap->getLiquidLevel(x, y);
2434 else
2435 return 0;
2436}

References GetGrid().

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
1990{
1991 if (const_cast<Map*>(this)->GetGrid(x, y))
1992 {
1993 // we need ground level (including grid height version) for proper return water level in point
1994 float ground_z = GetHeight(phasemask, x, y, z + Z_OFFSET_FIND_HEIGHT, true, 50.0f);
1995 if (ground)
1996 *ground = ground_z;
1997
1998 LiquidData const& liquidData = const_cast<Map*>(this)->GetLiquidData(phasemask, x, y, ground_z, collisionHeight, MAP_ALL_LIQUIDS);
1999 switch (liquidData.Status)
2000 {
2002 return std::max<float>(liquidData.Level, ground_z);
2004 return ground_z;
2005 default:
2006 return liquidData.Level;
2007 }
2008 }
2009
2011}
#define MAP_ALL_LIQUIDS
Definition: Map.h:160
constexpr float Z_OFFSET_FIND_HEIGHT
Definition: SharedDefines.h:27
LiquidData const GetLiquidData(uint32 phaseMask, float x, float y, float z, float collisionHeight, uint8 ReqLiquidType)
Definition: Map.cpp:2201

References GetGrid(), GetHeight(), GetLiquidData(), LiquidData::Level, LIQUID_MAP_ABOVE_WATER, LIQUID_MAP_NO_WATER, MAP_ALL_LIQUIDS, 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
2194{
2195 areaid = zoneid = GetAreaId(phaseMask, x, y, z);
2196 if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaid))
2197 if (area->zone)
2198 zoneid = area->zone;
2199}

References GetAreaId(), and sAreaTableStore.

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

◆ GetZoneId()

uint32 Map::GetZoneId ( uint32  phaseMask,
float  x,
float  y,
float  z 
) const
2184{
2185 uint32 areaId = GetAreaId(phaseMask, x, y, z);
2186 if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaId))
2187 if (area->zone)
2188 return area->zone;
2189
2190 return areaId;
2191}

References GetAreaId(), and sAreaTableStore.

Referenced by MapMgr::GetZoneId().

◆ HandleDelayedVisibility()

void Map::HandleDelayedVisibility ( )
891{
893 return;
894 for (std::unordered_set<Unit*>::iterator itr = i_objectsForDelayedVisibility.begin(); itr != i_objectsForDelayedVisibility.end(); ++itr)
895 (*itr)->ExecuteDelayedUnitRelocationEvent();
897}
std::unordered_set< Unit * > i_objectsForDelayedVisibility
Definition: Map.h:389

References i_objectsForDelayedVisibility.

Referenced by Update().

◆ HasEnoughWater() [1/2]

bool Map::HasEnoughWater ( WorldObject const *  searcher,
float  x,
float  y,
float  z 
) const
2513{
2514 LiquidData const& liquidData = const_cast<Map*>(this)->GetLiquidData(searcher->GetPhaseMask(), x, y, z, searcher->GetCollisionHeight(), MAP_ALL_LIQUIDS);
2515 return (liquidData.Status & MAP_LIQUID_STATUS_SWIMMING) != 0 && HasEnoughWater(searcher, liquidData);
2516}
#define MAP_LIQUID_STATUS_SWIMMING
Definition: Map.h:151

References WorldObject::GetCollisionHeight(), GetLiquidData(), WorldObject::GetPhaseMask(), HasEnoughWater(), MAP_ALL_LIQUIDS, MAP_LIQUID_STATUS_SWIMMING, and LiquidData::Status.

Referenced by CanReachPositionAndGetValidCoords(), and HasEnoughWater().

◆ HasEnoughWater() [2/2]

bool Map::HasEnoughWater ( WorldObject const *  searcher,
LiquidData const &  liquidData 
) const
2519{
2520 float minHeightInWater = searcher->GetMinHeightInWater();
2521 return liquidData.Level > INVALID_HEIGHT && liquidData.Level > liquidData.DepthLevel && liquidData.Level - liquidData.DepthLevel >= minHeightInWater;
2522}

References LiquidData::DepthLevel, WorldObject::GetMinHeightInWater(), INVALID_HEIGHT, and LiquidData::Level.

◆ HavePlayers()

◆ InitializeObject() [1/3]

template<>
void Map::InitializeObject ( Creature )
544{
545 //obj->_moveState = MAP_OBJECT_CELL_MOVE_NONE;
546}

◆ InitializeObject() [2/3]

template<>
void Map::InitializeObject ( GameObject )
550{
551 //obj->_moveState = MAP_OBJECT_CELL_MOVE_NONE;
552}

◆ InitializeObject() [3/3]

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

Referenced by AddToMap().

◆ InitVisibilityDistance()

void Map::InitVisibilityDistance ( )
virtual

Reimplemented in InstanceMap, BattlegroundMap, and MapInstanced.

259{
260 //init visibility for continents
262
263 switch (GetId())
264 {
265 case 609: // Scarlet Enclave (DK starting zone)
266 m_VisibleDistance = 125.0f;
267 break;
268 case 25: // Scott Test (box map)
269 m_VisibleDistance = 200.0f;
270 break;
271 }
272}
static float GetMaxVisibleDistanceOnContinents()
Definition: World.h:316

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

Referenced by Map().

◆ InsertGameObjectModel()

void Map::InsertGameObjectModel ( const GameObjectModel model)
inline
561{ _dynamicTree.insert(model); }
void insert(const GameObjectModel &)
Definition: DynamicTree.cpp:117

References _dynamicTree, and DynamicMapTree::insert().

Referenced by GameObject::AddToWorld(), GameObject::UpdateModel(), and GameObject::UpdateModelPosition().

◆ Instanceable()

◆ Is25ManRaid()

bool Map::Is25ManRaid ( ) const
inline
453{ return IsRaid() && i_spawnMode & RAID_DIFFICULTY_MASK_25MAN; } // since 25man difficulties are 1 and 3, we can check them like that
#define RAID_DIFFICULTY_MASK_25MAN
Definition: DBCEnums.h:279
bool IsRaid() const
Definition: Map.h:450

References i_spawnMode, IsRaid(), and RAID_DIFFICULTY_MASK_25MAN.

Referenced by boss_thorim::boss_thorimAI::DamageTaken(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::DoAction(), spell_archavon_rock_shards::spell_archavon_rock_shards_SpellScript::HandleScript(), instance_ulduar::instance_ulduar_InstanceMapScript::instance_ulduar_InstanceMapScript(), spell_the_lich_king_vile_spirits_aura::Load(), AchievementCriteriaData::Meets(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnGameObjectCreate(), AreaTrigger_at_celestial_planetarium_enterance::OnTrigger(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::Reset(), npc_gunship::npc_gunshipAI::SetGUID(), instance_ulduar::instance_ulduar_InstanceMapScript::SpawnLeviathanEncounterVehicles(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::UpdateAI(), boss_grobbulus_poison_cloud::boss_grobbulus_poison_cloudAI::UpdateAI(), boss_freya::boss_freyaAI::UpdateAI(), boss_freya_lifebinder::boss_freya_lifebinderAI::UpdateAI(), boss_freya_nature_bomb::boss_freya_nature_bombAI::UpdateAI(), boss_vezax::boss_vezaxAI::UpdateAI(), boss_kologarn_eyebeam::boss_kologarn_eyebeamAI::UpdateAI(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::UpdateAI(), and UpdateEncounterState().

◆ IsBattleArena()

◆ IsBattleground()

bool Map::IsBattleground ( ) const
inline
454{ return i_mapEntry && i_mapEntry->IsBattleground(); }
bool IsBattleground() const
Definition: DBCStructure.h:1355

References i_mapEntry, and MapEntry::IsBattleground().

Referenced by SpellMgr::GetSpellIdForDifficulty(), and AuraEffect::HandleAuraDummy().

◆ IsBattlegroundOrArena()

◆ isCellMarked()

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

References marked_cells.

Referenced by VisitNearbyCellsOf().

◆ isCellMarkedLarge()

bool Map::isCellMarkedLarge ( uint32  pCellId)
inline
474{ return marked_cells_large.test(pCellId); }
std::bitset< TOTAL_NUMBER_OF_CELLS_PER_MAP *TOTAL_NUMBER_OF_CELLS_PER_MAP > marked_cells_large
Definition: Map.h:744

References marked_cells_large.

Referenced by VisitNearbyCellsOf(), and VisitNearbyCellsOfPlayer().

◆ IsDungeon()

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

References i_mapEntry, and MapEntry::IsDungeon().

Referenced by Group::_cancelHomebindIfInstance(), InstanceSaveMgr::_ResetOrWarnAll(), InstanceMap::AddPlayerToMap(), GameObject::AddToSkillupList(), Spell::CheckCast(), MapInstanced::CreateInstance(), TransportMgr::CreateTransport(), Spell::DoAllEffectOnTarget(), ScriptedAI::DoTeleportAll(), CreatureAI::DoZoneInCombat(), Spell::EffectTeleportUnits(), SmartScript::FillScript(), Acore::XP::Gain(), 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(), boss_akilzon::boss_akilzonAI::SetWeather(), lfg::LFGMgr::TeleportPlayer(), ToInstanceMap(), AchievementMgr::UpdateAchievementCriteria(), and boss_janalai::boss_janalaiAI::UpdateAI().

◆ IsGridLoaded() [1/2]

bool Map::IsGridLoaded ( const GridCoord p) const
private

◆ IsGridLoaded() [2/2]

bool Map::IsGridLoaded ( float  x,
float  y 
) const
inline
370 {
372 }
GridCoord ComputeGridCoord(float x, float y)
Definition: GridDefines.h:186
bool IsGridLoaded(float x, float y) const
Definition: Map.h:369

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

Referenced by ObjectMgr::AddGOData(), GameEventMgr::GameEventSpawn(), IsGridLoaded(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::SetData(), PoolGroup< T >::Spawn1Object(), SwitchGridContainers(), and Visit().

◆ isGridObjectDataLoaded()

bool Map::isGridObjectDataLoaded ( uint32  x,
uint32  y 
) const
inlineprivate

◆ 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_orb_carrier::npc_orb_carrierAI::DoAction(), npc_molten_golem::npc_molten_golemAI::DoAction(), BattleExperienceEvent::Execute(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::FillInitialWorldStates(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::GetData(), spell_freezing_circle::HandleDamage(), 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_loken::boss_lokenAI::JustEngagedWith(), boss_krystallus::boss_krystallusAI::JustEngagedWith(), npc_tirion_fordring_tft::npc_tirion_fordringAI::JustReachedHome(), npc_frost_tomb::npc_frost_tombAI::npc_frost_tombAI(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::OnPlayerEnter(), at_shattered_halls_execution::OnTrigger(), 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(), ScriptedAI::ScriptedAI(), instance_gundrak::instance_gundrak_InstanceMapScript::SetBossState(), 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(), boss_skadi_grauf::boss_skadi_graufAI::SpawnFlameTriggers(), boss_skadi_grauf::boss_skadi_graufAI::SpellHitTarget(), boss_ionar::boss_ionarAI::Split(), 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(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::Update(), npc_time_rift::UpdateAI(), npc_stormforged_lieutenant::npc_stormforged_lieutenantAI::UpdateAI(), boss_ionar::boss_ionarAI::UpdateAI(), boss_loken::boss_lokenAI::UpdateAI(), boss_volkhan::boss_volkhanAI::UpdateAI(), npc_molten_golem::npc_molten_golemAI::UpdateAI(), npc_hol_monument::npc_hol_monumentAI::UpdateAI(), UpdateEncounterState(), 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
2439{
2440 if (!sWorld->getBoolConfig(CONFIG_VMAP_BLIZZLIKE_PVP_LOS))
2441 {
2443 {
2444 ignoreFlags = VMAP::ModelIgnoreFlags::Nothing;
2445 }
2446 }
2447
2448 if (!sWorld->getBoolConfig(CONFIG_VMAP_BLIZZLIKE_LOS_OPEN_WORLD))
2449 {
2450 if (IsWorldMap())
2451 {
2452 ignoreFlags = VMAP::ModelIgnoreFlags::Nothing;
2453 }
2454 }
2455
2456 if ((checks & LINEOFSIGHT_CHECK_VMAP) && !VMAP::VMapFactory::createOrGetVMapMgr()->isInLineOfSight(GetId(), x1, y1, z1, x2, y2, z2, ignoreFlags))
2457 {
2458 return false;
2459 }
2460
2461 if (sWorld->getBoolConfig(CONFIG_CHECK_GOBJECT_LOS) && (checks & LINEOFSIGHT_CHECK_GOBJECT_ALL))
2462 {
2463 ignoreFlags = VMAP::ModelIgnoreFlags::Nothing;
2464 if (!(checks & LINEOFSIGHT_CHECK_GOBJECT_M2))
2465 {
2466 ignoreFlags = VMAP::ModelIgnoreFlags::M2;
2467 }
2468
2469 if (!_dynamicTree.isInLineOfSight(x1, y1, z1, x2, y2, z2, phasemask, ignoreFlags))
2470 {
2471 return false;
2472 }
2473 }
2474
2475 return true;
2476}
@ LINEOFSIGHT_CHECK_GOBJECT_M2
Definition: Map.h:194
@ LINEOFSIGHT_CHECK_VMAP
Definition: Map.h:192
@ LINEOFSIGHT_CHECK_GOBJECT_ALL
Definition: Map.h:196
@ CONFIG_CHECK_GOBJECT_LOS
Definition: IWorld.h:160
@ CONFIG_VMAP_BLIZZLIKE_LOS_OPEN_WORLD
Definition: IWorld.h:182
@ CONFIG_VMAP_BLIZZLIKE_PVP_LOS
Definition: IWorld.h:181
bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask, VMAP::ModelIgnoreFlags ignoreFlags) const
Definition: DynamicTree.cpp:276
bool IsWorldMap() const
Definition: Map.h:457
bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask, LineOfSightChecks checks, VMAP::ModelIgnoreFlags ignoreFlags) const
Definition: Map.cpp:2438

References _dynamicTree, CONFIG_CHECK_GOBJECT_LOS, CONFIG_VMAP_BLIZZLIKE_LOS_OPEN_WORLD, CONFIG_VMAP_BLIZZLIKE_PVP_LOS, VMAP::VMapFactory::createOrGetVMapMgr(), GetId(), IsBattlegroundOrArena(), isInLineOfSight(), DynamicMapTree::isInLineOfSight(), IsWorldMap(), LINEOFSIGHT_CHECK_GOBJECT_ALL, LINEOFSIGHT_CHECK_GOBJECT_M2, LINEOFSIGHT_CHECK_VMAP, VMAP::M2, VMAP::Nothing, and sWorld.

Referenced by RandomMovementGenerator< T >::_setRandomLocation(), isInLineOfSight(), 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

◆ IsNonRaidDungeon()

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

References i_mapEntry, and MapEntry::IsNonRaidDungeon().

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

◆ 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
444{ return GetDifficulty() == REGULAR_DIFFICULTY; }
@ REGULAR_DIFFICULTY
Definition: DBCEnums.h:267

References GetDifficulty(), and REGULAR_DIFFICULTY.

◆ IsRemovalGrid()

bool Map::IsRemovalGrid ( float  x,
float  y 
) const
inline

◆ IsUnderWater()

bool Map::IsUnderWater ( uint32  phaseMask,
float  x,
float  y,
float  z,
float  collisionHeight 
) const
2507{
2508 LiquidData const& liquidData = const_cast<Map*>(this)->GetLiquidData(phaseMask, x, y, z, collisionHeight, MAP_LIQUID_TYPE_WATER | MAP_LIQUID_TYPE_OCEAN);
2509 return liquidData.Status == LIQUID_MAP_UNDER_WATER;
2510}
#define MAP_LIQUID_TYPE_WATER
Definition: Map.h:155
#define MAP_LIQUID_TYPE_OCEAN
Definition: Map.h:156

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

Referenced by WorldSession::HandleMovementOpcodes().

◆ IsWorldMap()

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

References i_mapEntry, and MapEntry::IsWorldMap().

Referenced by isInLineOfSight().

◆ LoadAllCells()

void Map::LoadAllCells ( )
498{
499 for (uint32 cellX = 0; cellX < TOTAL_NUMBER_OF_CELLS_PER_MAP; cellX++)
500 for (uint32 cellY = 0; cellY < TOTAL_NUMBER_OF_CELLS_PER_MAP; cellY++)
502}
#define TOTAL_NUMBER_OF_CELLS_PER_MAP
Definition: GridDefines.h:49
#define CENTER_GRID_CELL_ID
Definition: GridDefines.h:46
#define SIZE_OF_GRID_CELL
Definition: GridDefines.h:44
void LoadGrid(float x, float y)
Definition: Map.cpp:492

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

Referenced by World::SetInitialWorldSettings().

◆ LoadCorpseData()

void Map::LoadCorpseData ( )
4015{
4017 stmt->SetData(0, GetId());
4018 stmt->SetData(1, GetInstanceId());
4019
4020 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
4021 // SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, guildId, flags, dynFlags, time, corpseType, instanceId, phaseMask, guid FROM corpse WHERE mapId = ? AND instanceId = ?
4022 PreparedQueryResult result = CharacterDatabase.Query(stmt);
4023 if (!result)
4024 return;
4025
4026 do
4027 {
4028 Field* fields = result->Fetch();
4029 CorpseType type = CorpseType(fields[13].Get<uint8>());
4030 uint32 guid = fields[16].Get<uint32>();
4031 if (type >= MAX_CORPSE_TYPE || type == CORPSE_BONES)
4032 {
4033 LOG_ERROR("maps", "Corpse (guid: {}) have wrong corpse type ({}), not loading.", guid, type);
4034 continue;
4035 }
4036
4037 Corpse* corpse = new Corpse(type);
4038
4039 if (!corpse->LoadCorpseFromDB(GenerateLowGuid<HighGuid::Corpse>(), fields))
4040 {
4041 delete corpse;
4042 continue;
4043 }
4044
4045 AddCorpse(corpse);
4046
4047 corpse->UpdatePositionData();
4048 } while (result->NextRow());
4049}
CorpseType
Definition: Corpse.h:27
#define MAX_CORPSE_TYPE
Definition: Corpse.h:32
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: DatabaseEnvFwd.h:46
@ CHAR_SEL_CORPSES
Definition: CharacterDatabase.h:244
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
bool LoadCorpseFromDB(ObjectGuid::LowType guid, Field *fields)
Definition: Corpse.cpp:131

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(), and MapInstanced::CreateInstance().

◆ LoadGrid()

void Map::LoadGrid ( float  x,
float  y 
)
493{
494 EnsureGridLoaded(Cell(x, y));
495}

References EnsureGridLoaded().

Referenced by at_zulgurub_entrance_speech::_OnTrigger(), at_zulgurub_bridge_speech::_OnTrigger(), at_zulgurub_temple_speech::_OnTrigger(), at_zulgurub_bloodfire_pit_speech::_OnTrigger(), at_zulgurub_edge_of_madness_speech::_OnTrigger(), CinematicMgr::BeginCinematic(), instance_stratholme::instance_stratholme_InstanceMapScript::CheckZiggurats(), instance_the_black_morass::instance_the_black_morass_InstanceMapScript::CleanupInstance(), MotionTransport::DelayedTeleportTransport(), boss_nightbane::DoAction(), npc_thrall_warchief::npc_thrall_warchiefAI::DoAction(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::EnsureGridLoaded(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::EnsureGridLoaded(), WorldSession::HandleMoveWorldportAck(), boss_kelidan_the_breaker::JustDied(), boss_kurinnaxx::JustDied(), LoadAllCells(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_ulduar::instance_ulduar_InstanceMapScript::OnGameObjectCreate(), instance_ruby_sanctum::instance_ruby_sanctum_InstanceMapScript::OnPlayerEnter(), instance_pit_of_saron::instance_pit_of_saron_InstanceScript::OnPlayerEnter(), instance_stratholme::instance_stratholme_InstanceMapScript::OnPlayerEnter(), instance_sunwell_plateau::instance_sunwell_plateau_InstanceMapScript::OnPlayerEnter(), instance_ruins_of_ahnqiraj::instance_ruins_of_ahnqiraj_InstanceMapScript::OnPlayerEnter(), instance_ulduar::instance_ulduar_InstanceMapScript::OnPlayerEnter(), at_sindragosa_lair::OnTrigger(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnUnitDeath(), FlightPathMovementGenerator::PreloadEndGrid(), instance_naxxramas::instance_naxxramas_InstanceMapScript::SetBossState(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SetBossState(), instance_stratholme::instance_stratholme_InstanceMapScript::SetData(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::SetData(), instance_dire_maul::instance_dire_maul_InstanceMapScript::SetData(), instance_wailing_caverns::instance_wailing_caverns_InstanceMapScript::SetData(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::SetData(), instance_ulduar::instance_ulduar_InstanceMapScript::SetData(), instance_shattered_halls::instance_shattered_halls_InstanceMapScript::SetData(), Vehicle::TeleportVehicle(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::Update(), instance_naxxramas::instance_naxxramas_InstanceMapScript::Update(), MotionTransport::UpdatePosition(), and StaticTransport::UpdatePosition().

◆ LoadMap()

void Map::LoadMap ( int  gx,
int  gy,
bool  reload = false 
)
private
182{
183 if (i_InstanceId != 0)
184 {
185 if (GridMaps[gx][gy])
186 return;
187
188 // load grid map for base map
189 m_parentMap->EnsureGridCreated(GridCoord(63 - gx, 63 - gy));
190
191 GridMaps[gx][gy] = m_parentMap->GridMaps[gx][gy];
192 return;
193 }
194
195 if (GridMaps[gx][gy] && !reload)
196 return;
197
198 //map already load, delete it before reloading (Is it necessary? Do we really need the ability the reload maps during runtime?)
199 if (GridMaps[gx][gy])
200 {
201 LOG_DEBUG("maps", "Unloading previously loaded map {} before reloading.", GetId());
202 sScriptMgr->OnUnloadGridMap(this, GridMaps[gx][gy], gx, gy);
203
204 delete (GridMaps[gx][gy]);
205 GridMaps[gx][gy] = nullptr;
206 }
207
208 // map file name
209 char* tmp = nullptr;
210 int len = sWorld->GetDataPath().length() + strlen("maps/%03u%02u%02u.map") + 1;
211 tmp = new char[len];
212 snprintf(tmp, len, (char*)(sWorld->GetDataPath() + "maps/%03u%02u%02u.map").c_str(), GetId(), gx, gy);
213 LOG_DEBUG("maps", "Loading map {}", tmp);
214 // loading data
215 GridMaps[gx][gy] = new GridMap();
216 if (!GridMaps[gx][gy]->loadData(tmp))
217 {
218 LOG_ERROR("maps", "Error loading map file: \n {}\n", tmp);
219 }
220 delete [] tmp;
221
222 sScriptMgr->OnLoadGridMap(this, GridMaps[gx][gy], gx, gy);
223}

References EnsureGridCreated(), GetId(), GridMaps, i_InstanceId, LOG_DEBUG, LOG_ERROR, m_parentMap, sScriptMgr, and sWorld.

Referenced by LoadMapAndVMap().

◆ LoadMapAndVMap()

void Map::LoadMapAndVMap ( int  gx,
int  gy 
)
private
226{
227 LoadMap(gx, gy);
228 if (i_InstanceId == 0)
229 {
230 LoadVMap(gx, gy); // Only load the data for the base map
231 LoadMMap(gx, gy);
232 }
233}
void LoadMMap(int gx, int gy)
Definition: Map.cpp:143
void LoadMap(int gx, int gy, bool reload=false)
Definition: Map.cpp:181
void LoadVMap(int gx, int gy)
Definition: Map.cpp:163

References i_InstanceId, LoadMap(), LoadMMap(), and LoadVMap().

Referenced by EnsureGridCreated_i().

◆ LoadMMap()

void Map::LoadMMap ( int  gx,
int  gy 
)
private
144{
145 if (!DisableMgr::IsPathfindingEnabled(this)) // pussywizard
146 return;
147
148 int mmapLoadResult = MMAP::MMapFactory::createOrGetMMapMgr()->loadMap(GetId(), gx, gy);
149 switch (mmapLoadResult)
150 {
152 LOG_DEBUG("maps", "MMAP loaded name:{}, id:{}, x:{}, y:{} (vmap rep.: x:{}, y:{})", GetMapName(), GetId(), gx, gy, gx, gy);
153 break;
155 LOG_DEBUG("maps", "Could not load MMAP name:{}, id:{}, x:{}, y:{} (vmap rep.: x:{}, y:{})", GetMapName(), GetId(), gx, gy, gx, gy);
156 break;
158 LOG_DEBUG("maps", "Ignored MMAP name:{}, id:{}, x:{}, y:{} (vmap rep.: x:{}, y:{})", GetMapName(), GetId(), gx, gy, gx, gy);
159 break;
160 }
161}
@ MMAP_LOAD_RESULT_ERROR
Definition: IMMAPMgr.h:26
@ MMAP_LOAD_RESULT_IGNORED
Definition: IMMAPMgr.h:28
@ MMAP_LOAD_RESULT_OK
Definition: IMMAPMgr.h:27
bool IsPathfindingEnabled(const Map *map)
Definition: DisableMgr.cpp:411
bool loadMap(uint32 mapId, int32 x, int32 y)
Definition: MMapMgr.cpp:128
const char * GetMapName() const
Definition: Map.cpp:2524

References MMAP::MMapFactory::createOrGetMMapMgr(), GetId(), GetMapName(), DisableMgr::IsPathfindingEnabled(), MMAP::MMapMgr::loadMap(), LOG_DEBUG, MMAP::MMAP_LOAD_RESULT_ERROR, MMAP::MMAP_LOAD_RESULT_IGNORED, and MMAP::MMAP_LOAD_RESULT_OK.

Referenced by LoadMapAndVMap().

◆ LoadRespawnTimes()

void Map::LoadRespawnTimes ( )
3418{
3420 stmt->SetData(0, GetId());
3421 stmt->SetData(1, GetInstanceId());
3422 if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
3423 {
3424 do
3425 {
3426 Field* fields = result->Fetch();
3427 ObjectGuid::LowType lowguid = fields[0].Get<uint32>();
3428 uint32 respawnTime = fields[1].Get<uint32>();
3429
3430 _creatureRespawnTimes[lowguid] = time_t(respawnTime);
3431 } while (result->NextRow());
3432 }
3433
3434 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GO_RESPAWNS);
3435 stmt->SetData(0, GetId());
3436 stmt->SetData(1, GetInstanceId());
3437 if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
3438 {
3439 do
3440 {
3441 Field* fields = result->Fetch();
3442 ObjectGuid::LowType lowguid = fields[0].Get<uint32>();
3443 uint32 respawnTime = fields[1].Get<uint32>();
3444
3445 _goRespawnTimes[lowguid] = time_t(respawnTime);
3446 } while (result->NextRow());
3447 }
3448}
@ CHAR_SEL_CREATURE_RESPAWNS
Definition: CharacterDatabase.h:250
@ CHAR_SEL_GO_RESPAWNS
Definition: CharacterDatabase.h:255

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

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

◆ LoadVMap()

void Map::LoadVMap ( int  gx,
int  gy 
)
private
164{
165 // x and y are swapped !!
166 int vmapLoadResult = VMAP::VMapFactory::createOrGetVMapMgr()->loadMap((sWorld->GetDataPath() + "vmaps").c_str(), GetId(), gx, gy);
167 switch (vmapLoadResult)
168 {
170 LOG_DEBUG("maps", "VMAP loaded name:{}, id:{}, x:{}, y:{} (vmap rep.: x:{}, y:{})", GetMapName(), GetId(), gx, gy, gx, gy);
171 break;
173 LOG_DEBUG("maps", "Could not load VMAP name:{}, id:{}, x:{}, y:{} (vmap rep.: x:{}, y:{})", GetMapName(), GetId(), gx, gy, gx, gy);
174 break;
176 LOG_DEBUG("maps", "Ignored VMAP name:{}, id:{}, x:{}, y:{} (vmap rep.: x:{}, y:{})", GetMapName(), GetId(), gx, gy, gx, gy);
177 break;
178 }
179}
@ VMAP_LOAD_RESULT_ERROR
Definition: IVMapMgr.h:36
@ VMAP_LOAD_RESULT_OK
Definition: IVMapMgr.h:37
@ VMAP_LOAD_RESULT_IGNORED
Definition: IVMapMgr.h:38
int loadMap(const char *pBasePath, unsigned int mapId, int x, int y) override
Definition: VMapMgr2.cpp:98

References VMAP::VMapFactory::createOrGetVMapMgr(), GetId(), GetMapName(), VMAP::VMapMgr2::loadMap(), LOG_DEBUG, sWorld, VMAP::VMAP_LOAD_RESULT_ERROR, VMAP::VMAP_LOAD_RESULT_IGNORED, and VMAP::VMAP_LOAD_RESULT_OK.

Referenced by LoadMapAndVMap().

◆ LogEncounterFinished()

void Map::LogEncounterFinished ( EncounterCreditType  type,
uint32  creditEntry 
)
3537{
3538 if (!IsRaid() || !GetEntry() || GetEntry()->Expansion() < 2) // only for wotlk raids, because logs take up tons of mysql memory
3539 return;
3540 InstanceMap* map = ToInstanceMap();
3541 if (!map)
3542 return;
3543 std::string playersInfo;
3544 char buffer[16384], buffer2[255];
3545 Map::PlayerList const& pl = map->GetPlayers();
3546 for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
3547 if (Player* p = itr->GetSource())
3548 {
3549 std::string auraStr;
3550 const Unit::AuraApplicationMap& a = p->GetAppliedAuras();
3551 for (auto iterator = a.begin(); iterator != a.end(); ++iterator)
3552 {
3553 snprintf(buffer2, 255, "%u(%u) ", iterator->first, iterator->second->GetEffectMask());
3554 auraStr += buffer2;
3555 }
3556
3557 snprintf(buffer, 16384, "%s (%s, acc: %u, ip: %s, guild: %u), xyz: (%.1f, %.1f, %.1f), auras: %s\n",
3558 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());
3559 playersInfo += buffer;
3560 }
3561 CleanStringForMysqlQuery(playersInfo);
3562 CharacterDatabase.Execute("INSERT INTO log_encounter VALUES(NOW(), {}, {}, {}, {}, '{}')", GetId(), (uint32)GetDifficulty(), type, creditEntry, playersInfo);
3563}
void CleanStringForMysqlQuery(std::string &str)
Definition: Common.cpp:44
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition: Unit.h:639
LinkedListHead::Iterator< GridReference< NGridType > > iterator
Definition: GridRefMgr.h:30
MapEntry const * GetEntry() const
Definition: Map.h:319
InstanceMap * ToInstanceMap()
Definition: Map.h:546
Definition: Map.h:819
Definition: MapRefMgr.h:26

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

Referenced by UpdateEncounterState().

◆ markCell()

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

References marked_cells.

Referenced by VisitNearbyCellsOf().

◆ markCellLarge()

void Map::markCellLarge ( uint32  pCellId)
inline
475{ marked_cells_large.set(pCellId); }

References marked_cells_large.

Referenced by VisitNearbyCellsOf(), and VisitNearbyCellsOfPlayer().

◆ MoveAllCreaturesInMoveList()

void Map::MoveAllCreaturesInMoveList ( )
1125{
1126 for (std::vector<Creature*>::iterator itr = _creaturesToMove.begin(); itr != _creaturesToMove.end(); ++itr)
1127 {
1128 Creature* c = *itr;
1129 if (c->FindMap() != this)
1130 continue;
1131
1133 {
1135 continue;
1136 }
1137
1139 if (!c->IsInWorld())
1140 continue;
1141
1142 Cell const& old_cell = c->GetCurrentCell();
1143 Cell new_cell(c->GetPositionX(), c->GetPositionY());
1144
1145 c->RemoveFromGrid();
1146 if (old_cell.DiffGrid(new_cell))
1147 EnsureGridLoaded(new_cell);
1148 AddToGrid(c, new_cell);
1149 }
1150 _creaturesToMove.clear();
1151}
void RemoveFromGrid()
Definition: Object.h:351
Map * FindMap() const
Definition: Object.h:532

References _creaturesToMove, 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().

◆ MoveAllDynamicObjectsInMoveList()

void Map::MoveAllDynamicObjectsInMoveList ( )
1183{
1184 for (std::vector<DynamicObject*>::iterator itr = _dynamicObjectsToMove.begin(); itr != _dynamicObjectsToMove.end(); ++itr)
1185 {
1186 DynamicObject* dynObj = *itr;
1187 if (dynObj->FindMap() != this)
1188 continue;
1189
1191 {
1193 continue;
1194 }
1195
1197 if (!dynObj->IsInWorld())
1198 continue;
1199
1200 Cell const& old_cell = dynObj->GetCurrentCell();
1201 Cell new_cell(dynObj->GetPositionX(), dynObj->GetPositionY());
1202
1203 dynObj->RemoveFromGrid();
1204 if (old_cell.DiffGrid(new_cell))
1205 EnsureGridLoaded(new_cell);
1206 AddToGrid(dynObj, new_cell);
1207 }
1208 _dynamicObjectsToMove.clear();
1209}

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 ( )
1154{
1155 for (std::vector<GameObject*>::iterator itr = _gameObjectsToMove.begin(); itr != _gameObjectsToMove.end(); ++itr)
1156 {
1157 GameObject* go = *itr;
1158 if (go->FindMap() != this)
1159 continue;
1160
1162 {
1164 continue;
1165 }
1166
1168 if (!go->IsInWorld())
1169 continue;
1170
1171 Cell const& old_cell = go->GetCurrentCell();
1172 Cell new_cell(go->GetPositionX(), go->GetPositionY());
1173
1174 go->RemoveFromGrid();
1175 if (old_cell.DiffGrid(new_cell))
1176 EnsureGridLoaded(new_cell);
1177 AddToGrid(go, new_cell);
1178 }
1179 _gameObjectsToMove.clear();
1180}

References _gameObjectsToMove, 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().

◆ PlayDirectSoundToMap()

void Map::PlayDirectSoundToMap ( uint32  soundId,
uint32  zoneId = 0 
)
3745{
3746 Map::PlayerList const& players = GetPlayers();
3747 if (!players.IsEmpty())
3748 {
3750 data << uint32(soundId);
3751
3752 for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
3753 if (Player* player = itr->GetSource())
3754 if (!zoneId || player->GetZoneId() == zoneId)
3755 player->SendDirectMessage(&data);
3756 }
3757}
@ SMSG_PLAY_SOUND
Definition: Opcodes.h:752

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

Referenced by instance_naxxramas::instance_naxxramas_InstanceMapScript::Update().

◆ PlayerRelocation()

void Map::PlayerRelocation ( Player player,
float  x,
float  y,
float  z,
float  o 
)
1001{
1002 Cell old_cell(player->GetPositionX(), player->GetPositionY());
1003 Cell new_cell(x, y);
1004
1005 if (old_cell.DiffGrid(new_cell) || old_cell.DiffCell(new_cell))
1006 {
1007 player->RemoveFromGrid();
1008
1009 if (old_cell.DiffGrid(new_cell))
1010 EnsureGridLoaded(new_cell);
1011
1012 AddToGrid(player, new_cell);
1013 }
1014
1015 player->Relocate(x, y, z, o);
1016 if (player->IsVehicle())
1017 player->GetVehicleKit()->RelocatePassengers();
1018 player->UpdatePositionData();
1019 player->UpdateObjectVisibility(false);
1020}

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

◆ RemoveAllObjectsInRemoveList()

void Map::RemoveAllObjectsInRemoveList ( )
2679{
2680 while (!i_objectsToSwitch.empty())
2681 {
2682 std::map<WorldObject*, bool>::iterator itr = i_objectsToSwitch.begin();
2683 WorldObject* obj = itr->first;
2684 bool on = itr->second;
2685 i_objectsToSwitch.erase(itr);
2686
2687 if (!obj->IsPermanentWorldObject())
2688 {
2689 switch (obj->GetTypeId())
2690 {
2691 case TYPEID_UNIT:
2692 SwitchGridContainers<Creature>(obj->ToCreature(), on);
2693 break;
2694 case TYPEID_GAMEOBJECT:
2695 SwitchGridContainers<GameObject>(obj->ToGameObject(), on);
2696 break;
2697 default:
2698 break;
2699 }
2700 }
2701 }
2702
2703 //LOG_DEBUG("maps", "Object remover 1 check.");
2704 while (!i_objectsToRemove.empty())
2705 {
2706 std::unordered_set<WorldObject*>::iterator itr = i_objectsToRemove.begin();
2707 WorldObject* obj = *itr;
2708 i_objectsToRemove.erase(itr);
2709
2710 switch (obj->GetTypeId())
2711 {
2712 case TYPEID_CORPSE:
2713 {
2714 Corpse* corpse = ObjectAccessor::GetCorpse(*obj, obj->GetGUID());
2715 if (!corpse)
2716 LOG_ERROR("maps", "Tried to delete corpse/bones {} that is not in map.", obj->GetGUID().ToString());
2717 else
2718 RemoveFromMap(corpse, true);
2719 break;
2720 }
2722 RemoveFromMap((DynamicObject*)obj, true);
2723 break;
2724 case TYPEID_GAMEOBJECT:
2725 if (MotionTransport* transport = obj->ToGameObject()->ToMotionTransport())
2726 RemoveFromMap(transport, true);
2727 else
2728 RemoveFromMap(obj->ToGameObject(), true);
2729 break;
2730 case TYPEID_UNIT:
2731 // in case triggered sequence some spell can continue casting after prev CleanupsBeforeDelete call
2732 // make sure that like sources auras/etc removed before destructor start
2734 RemoveFromMap(obj->ToCreature(), true);
2735 break;
2736 default:
2737 LOG_ERROR("maps", "Non-grid object (TypeId: {}) is in grid object remove list, ignored.", obj->GetTypeId());
2738 break;
2739 }
2740 }
2741
2742 //LOG_DEBUG("maps", "Object remover 2 check.");
2743}
@ TYPEID_DYNAMICOBJECT
Definition: ObjectGuid.h:38
@ TYPEID_GAMEOBJECT
Definition: ObjectGuid.h:37
@ TYPEID_UNIT
Definition: ObjectGuid.h:35
@ TYPEID_CORPSE
Definition: ObjectGuid.h:39
Corpse * GetCorpse(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:182
MotionTransport * ToMotionTransport()
Definition: GameObject.h:328
bool IsPermanentWorldObject() const
Definition: Object.h:580
void CleanupsBeforeDelete(bool finalCleanup=true) override
Definition: Unit.cpp:15727
void RemoveFromMap(T *, bool)
Definition: Map.cpp:939

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

Referenced by DelayedUpdate(), and UnloadGrid().

◆ RemoveAllPlayers()

void Map::RemoveAllPlayers ( )
virtual

Reimplemented in BattlegroundMap.

1259{
1260 if (HavePlayers())
1261 {
1262 for (MapRefMgr::iterator itr = m_mapRefMgr.begin(); itr != m_mapRefMgr.end(); ++itr)
1263 {
1264 Player* player = itr->GetSource();
1265 if (!player->IsBeingTeleportedFar())
1266 {
1267 // this is happening for bg
1268 LOG_ERROR("maps", "Map::UnloadAll: player {} is still in map {} during unload, this should not happen!", player->GetName(), GetId());
1269 player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->GetOrientation());
1270 }
1271 }
1272 }
1273}
std::string const & GetName() const
Definition: Object.h:458
float m_homebindZ
Definition: Player.h:2353
bool IsBeingTeleportedFar() const
Definition: Player.h:2072
uint32 m_homebindMapId
Definition: Player.h:2349
float m_homebindY
Definition: Player.h:2352
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0, Unit *target=nullptr, bool newInstance=false)
Definition: Player.cpp:1330
float m_homebindX
Definition: Player.h:2351

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)
3609{
3610 ASSERT(corpse);
3611
3612 corpse->DestroyForNearbyPlayers();
3613 if (corpse->IsInGrid())
3614 RemoveFromMap(corpse, false);
3615 else
3616 {
3617 corpse->RemoveFromWorld();
3618 corpse->ResetMap();
3619 }
3620
3621 _corpsesByCell[corpse->GetCellCoord().GetId()].erase(corpse);
3622 if (corpse->GetType() != CORPSE_BONES)
3623 _corpsesByPlayer.erase(corpse->GetOwnerGUID());
3624 else
3625 _corpseBones.erase(corpse);
3626}
void RemoveFromWorld() override
Definition: Corpse.cpp:52
bool IsInGrid() const
Definition: Object.h:349
void DestroyForNearbyPlayers()
Definition: Object.cpp:2942

References _corpseBones, _corpsesByCell, _corpsesByPlayer, ASSERT, CORPSE_BONES, WorldObject::DestroyForNearbyPlayers(), Corpse::GetCellCoord(), CoordPair< LIMIT >::GetId(), Corpse::GetOwnerGUID(), 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)
3373{
3374 _creatureRespawnTimes.erase(spawnId);
3375
3377 stmt->SetData(0, spawnId);
3378 stmt->SetData(1, GetId());
3379 stmt->SetData(2, GetInstanceId());
3380 CharacterDatabase.Execute(stmt);
3381}
@ CHAR_DEL_CREATURE_RESPAWN
Definition: CharacterDatabase.h:252

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

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

◆ RemoveDynamicObjectFromMoveList()

void Map::RemoveDynamicObjectFromMoveList ( DynamicObject go)
private
1119{
1120 if (dynObj->_moveState == MAP_OBJECT_CELL_MOVE_ACTIVE)
1121 dynObj->_moveState = MAP_OBJECT_CELL_MOVE_INACTIVE;
1122}

References MovableMapObject::_moveState, MAP_OBJECT_CELL_MOVE_ACTIVE, and MAP_OBJECT_CELL_MOVE_INACTIVE.

Referenced by DynamicObjectRelocation().

◆ RemoveFromActive() [1/4]

template<>
void Map::RemoveFromActive ( Creature c)
2792{
2794}
void RemoveFromActiveHelper(WorldObject *obj)
Definition: Map.h:766

References RemoveFromActiveHelper().

◆ RemoveFromActive() [2/4]

template<>
void Map::RemoveFromActive ( DynamicObject obj)
2798{
2800}

References RemoveFromActiveHelper().

◆ RemoveFromActive() [3/4]

template<>
void Map::RemoveFromActive ( GameObject obj)
2804{
2806}

References RemoveFromActiveHelper().

◆ RemoveFromActive() [4/4]

template<class T >
void Map::RemoveFromActive ( T *  obj)
2786{
2788}

References RemoveFromActiveHelper().

Referenced by RemoveFromMap(), and WorldObject::setActive().

◆ RemoveFromActiveHelper()

void Map::RemoveFromActiveHelper ( WorldObject obj)
inlineprivate
767 {
768 // Map::Update for active object in proccess
770 {
771 ActiveNonPlayers::iterator itr = m_activeNonPlayers.find(obj);
772 if (itr == m_activeNonPlayers.end())
773 return;
774 if (itr == m_activeNonPlayersIter)
776 m_activeNonPlayers.erase(itr);
777 }
778 else
779 m_activeNonPlayers.erase(obj);
780 }

References m_activeNonPlayers, and m_activeNonPlayersIter.

Referenced by RemoveFromActive().

◆ RemoveFromMap() [1/2]

template<>
void Map::RemoveFromMap ( MotionTransport obj,
bool  remove 
)
960{
961 obj->RemoveFromWorld();
962 if (obj->isActiveObject())
963 RemoveFromActive(obj);
964
965 Map::PlayerList const& players = GetPlayers();
966 if (!players.IsEmpty())
967 {
968 UpdateData data;
969 obj->BuildOutOfRangeUpdateBlock(&data);
970 WorldPacket packet;
971 data.BuildPacket(packet);
972 for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
973 if (itr->GetSource()->GetTransport() != obj)
974 itr->GetSource()->SendDirectMessage(&packet);
975 }
976
978 {
979 TransportsContainer::iterator itr = _transports.find(obj);
980 if (itr == _transports.end())
981 return;
982 if (itr == _transportsUpdateIter)
984 _transports.erase(itr);
985 }
986 else
987 _transports.erase(obj);
988
989 obj->ResetMap();
990
991 if (remove)
992 {
993 // if option set then object already saved at this moment
994 if (!sWorld->getBoolConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY))
995 obj->SaveRespawnTime();
996 DeleteFromWorld(obj);
997 }
998}
@ CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY
Definition: IWorld.h:98
void RemoveFromWorld() override
Definition: GameObject.cpp:168
void SaveRespawnTime() override
Definition: GameObject.h:245
void BuildOutOfRangeUpdateBlock(UpdateData *data) const
Definition: Object.cpp:269
void RemoveFromActive(T *obj)
Definition: Map.cpp:2785
void DeleteFromWorld(T *)
Definition: Map.cpp:417

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

◆ RemoveFromMap() [2/2]

template<class T >
void Map::RemoveFromMap ( T *  obj,
bool  remove 
)
940{
941 bool inWorld = obj->IsInWorld() && obj->GetTypeId() >= TYPEID_UNIT && obj->GetTypeId() <= TYPEID_GAMEOBJECT;
942 obj->RemoveFromWorld();
943
944 if (obj->isActiveObject())
945 RemoveFromActive(obj);
946
947 if (!inWorld) // pussywizard: if was in world, RemoveFromWorld() called DestroyForNearbyPlayers()
948 obj->DestroyForNearbyPlayers(); // pussywizard: previous player->UpdateObjectVisibility()
949
950 obj->RemoveFromGrid();
951
952 obj->ResetMap();
953
954 if (remove)
955 DeleteFromWorld(obj);
956}

References DeleteFromWorld(), RemoveFromActive(), TYPEID_GAMEOBJECT, and TYPEID_UNIT.

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

◆ RemoveGameObjectFromMoveList()

void Map::RemoveGameObjectFromMoveList ( GameObject go)
private

◆ RemoveGameObjectModel()

void Map::RemoveGameObjectModel ( const GameObjectModel model)
inline
560{ _dynamicTree.remove(model); }
void remove(const GameObjectModel &)
Definition: DynamicTree.cpp:122

References _dynamicTree, and DynamicMapTree::remove().

Referenced by GameObject::RemoveFromWorld(), GameObject::UpdateModel(), and GameObject::UpdateModelPosition().

◆ RemoveGORespawnTime()

void Map::RemoveGORespawnTime ( ObjectGuid::LowType  dbGuid)
3407{
3408 _goRespawnTimes.erase(spawnId);
3409
3411 stmt->SetData(0, spawnId);
3412 stmt->SetData(1, GetId());
3413 stmt->SetData(2, GetInstanceId());
3414 CharacterDatabase.Execute(stmt);
3415}
@ CHAR_DEL_GO_RESPAWN
Definition: CharacterDatabase.h:257

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

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

◆ RemoveOldCorpses()

void Map::RemoveOldCorpses ( )
3682{
3683 time_t now = GameTime::GetGameTime().count();
3684
3685 std::vector<ObjectGuid> corpses;
3686 corpses.reserve(_corpsesByPlayer.size());
3687
3688 for (auto const& p : _corpsesByPlayer)
3689 if (p.second->IsExpired(now))
3690 corpses.push_back(p.first);
3691
3692 for (ObjectGuid const& ownerGuid : corpses)
3693 ConvertCorpseToBones(ownerGuid);
3694
3695 std::vector<Corpse*> expiredBones;
3696 for (Corpse* bones : _corpseBones)
3697 if (bones->IsExpired(now))
3698 expiredBones.push_back(bones);
3699
3700 for (Corpse* bones : expiredBones)
3701 {
3702 RemoveCorpse(bones);
3703 delete bones;
3704 }
3705}
Seconds GetGameTime()
Definition: GameTime.cpp:38

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

Referenced by World::Update().

◆ RemovePlayerFromMap()

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