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

#include <Map.h>

Public Member Functions

 BattlegroundMap (uint32 id, time_t, uint32 InstanceId, Map *_parent, uint8 spawnMode)
 
 ~BattlegroundMap ()
 
bool AddPlayerToMap (Player *player, bool initPlayer=true) override
 
void RemovePlayerFromMap (Player *, bool) override
 
EnterState CannotEnter (Player *player) override
 
void SetUnload ()
 
void RemoveAllPlayers () override
 
virtual void InitVisibilityDistance () override
 
BattlegroundGetBG ()
 
void SetBG (Battleground *bg)
 
- Public Member Functions inherited from Map
 Map (uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode, Map *_parent=NULL)
 
virtual ~Map ()
 
MapEntry constGetEntry () const
 
bool CanUnload (uint32 diff)
 
template<class T >
bool AddToMap (T *)
 
template<class T >
void RemoveFromMap (T *, bool)
 
void VisitNearbyCellsOf (WorldObject *obj, TypeContainerVisitor< Trinity::ObjectUpdater, GridTypeMapContainer > &gridVisitor, TypeContainerVisitor< Trinity::ObjectUpdater, WorldTypeMapContainer > &worldVisitor)
 
virtual void Update (const uint32)
 
float GetVisibilityRange () const
 
void PlayerRelocation (Player *, float x, float y, float z, float orientation)
 
void CreatureRelocation (Creature *creature, float x, float y, float z, float ang, bool respawnRelocationOnFail=true)
 
void GameObjectRelocation (GameObject *go, float x, float y, float z, float orientation, bool respawnRelocationOnFail=true)
 
void DynamicObjectRelocation (DynamicObject *go, float x, float y, float z, float orientation)
 
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
 
bool GetUnloadLock (const GridCoord &p) const
 
void SetUnloadLock (const GridCoord &p, bool on)
 
void LoadGrid (float x, float y)
 
bool UnloadGrid (NGridType &ngrid, bool pForce)
 
virtual void UnloadAll ()
 
void ResetGridExpiry (NGridType &grid, float factor=1) const
 
time_t GetGridExpiry (void) const
 
uint32 GetId (void) const
 
Map constGetParent () const
 
float GetHeight (float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
 
float GetMinHeight (float x, float y) const
 
ZLiquidStatus getLiquidStatus (float x, float y, float z, uint8 ReqLiquidType, LiquidData *data=nullptr) const
 
uint32 GetAreaId (float x, float y, float z, bool *isOutdoors) const
 
bool GetAreaInfo (float x, float y, float z, uint32 &mogpflags, int32 &adtId, int32 &rootId, int32 &groupId) const
 
uint32 GetAreaId (float x, float y, float z) const
 
uint32 GetZoneId (float x, float y, float z) const
 
void GetZoneAndAreaId (uint32 &zoneid, uint32 &areaid, float x, float y, float z) const
 
bool IsOutdoors (float x, float y, float z) const
 
uint8 GetTerrainType (float x, float y) const
 
float GetWaterLevel (float x, float y) const
 
bool IsInWater (float x, float y, float z, LiquidData *data=nullptr) const
 
bool IsUnderWater (float x, float y, float z) const
 
void MoveAllCreaturesInMoveList ()
 
void MoveAllGameObjectsInMoveList ()
 
void MoveAllDynamicObjectsInMoveList ()
 
void RemoveAllObjectsInRemoveList ()
 
bool CreatureRespawnRelocation (Creature *c, bool diffGridOnly)
 
bool GameObjectRespawnRelocation (GameObject *go, bool diffGridOnly)
 
bool CheckGridIntegrity (Creature *c, bool moved) const
 
uint32 GetInstanceId () const
 
uint8 GetSpawnMode () const
 
const char * GetMapName () const
 
Difficulty GetDifficultyID () const
 
MapDifficultyEntry constGetMapDifficulty () const
 
uint32 GetDifficultyLootBonusTreeMod () 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 IsGarrison () 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 UpdateObjectVisibility (WorldObject *obj, Cell cell, CellCoord cellpair)
 
void UpdateObjectsVisibilityFor (Player *player, Cell cell, CellCoord cellpair)
 
void resetMarkedCells ()
 
bool isCellMarked (uint32 pCellId)
 
void markCell (uint32 pCellId)
 
bool HavePlayers () const
 
uint32 GetPlayersCountExceptGMs () const
 
bool ActiveObjectsNearGrid (NGridType const &ngrid) const
 
void AddWorldObject (WorldObject *obj)
 
void RemoveWorldObject (WorldObject *obj)
 
void SendToPlayers (WorldPacket const *data) const
 
PlayerList constGetPlayers () 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)
 
template<class NOTIFIER >
void VisitAll (const float &x, const float &y, float radius, NOTIFIER &notifier)
 
template<class NOTIFIER >
void VisitFirstFound (const float &x, const float &y, float radius, NOTIFIER &notifier)
 
template<class NOTIFIER >
void VisitWorld (const float &x, const float &y, float radius, NOTIFIER &notifier)
 
template<class NOTIFIER >
void VisitGrid (const float &x, const float &y, float radius, NOTIFIER &notifier)
 
void UpdateIteratorBack (Player *player)
 
TempSummonSummonCreature (uint32 entry, Position const &pos, SummonPropertiesEntry const *properties=NULL, uint32 duration=0, Unit *summoner=NULL, uint32 spellId=0, uint32 vehId=0)
 
void SummonCreatureGroup (uint8 group, std::list< TempSummon * > *list=NULL)
 
AreaTriggerGetAreaTrigger (ObjectGuid const &guid)
 
CorpseGetCorpse (ObjectGuid const &guid)
 
CreatureGetCreature (ObjectGuid const &guid)
 
DynamicObjectGetDynamicObject (ObjectGuid const &guid)
 
GameObjectGetGameObject (ObjectGuid const &guid)
 
PetGetPet (ObjectGuid const &guid)
 
TransportGetTransport (ObjectGuid const &guid)
 
MapStoredObjectTypesContainerGetObjectsStore ()
 
CreatureBySpawnIdContainerGetCreatureBySpawnIdStore ()
 
GameObjectBySpawnIdContainerGetGameObjectBySpawnIdStore ()
 
std::unordered_set< Corpse * >
const
GetCorpsesInCell (uint32 cellId) const
 
CorpseGetCorpseByPlayer (ObjectGuid const &ownerGuid) const
 
MapInstancedToMapInstanced ()
 
MapInstanced constToMapInstanced () const
 
InstanceMapToInstanceMap ()
 
InstanceMap constToInstanceMap () const
 
BattlegroundMapToBattlegroundMap ()
 
BattlegroundMap constToBattlegroundMap () const
 
float GetWaterOrGroundLevel (float x, float y, float z, float *ground=NULL, bool swim=false) 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) const
 
void Balance ()
 
void RemoveGameObjectModel (const GameObjectModel &model)
 
void InsertGameObjectModel (const GameObjectModel &model)
 
bool ContainsGameObjectModel (const GameObjectModel &model) 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)
 
virtual ObjectGuid::LowType GetOwnerGuildId (uint32=TEAM_OTHER) 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 ()
 
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 SendUpdateTransportVisibility (Player *player, std::set< uint32 > const &previousPhases)
 
void SendZoneDynamicInfo (Player *player)
 
void SetZoneMusic (uint32 zoneId, uint32 musicId)
 
void SetZoneWeather (uint32 zoneId, WeatherState weatherId, float weatherGrade)
 
void SetZoneOverrideLight (uint32 zoneId, uint32 lightId, uint32 fadeInTime)
 
void UpdateAreaDependentAuras ()
 
template<HighGuid high>
ObjectGuid::LowType GenerateLowGuid ()
 
void AddUpdateObject (Object *obj)
 
void RemoveUpdateObject (Object *obj)
 
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 DeleteFromWorld (Transport *transport)
 
template<>
void InitializeObject (Creature *obj)
 
template<>
void InitializeObject (GameObject *obj)
 
template<>
bool AddToMap (Transport *obj)
 
template<>
void RemoveFromMap (Transport *obj, bool remove)
 
template<>
void AddToActive (Creature *c)
 
template<>
void AddToActive (DynamicObject *d)
 
template<>
void RemoveFromActive (Creature *c)
 
template<>
void RemoveFromActive (DynamicObject *obj)
 
- Public Member Functions inherited from GridRefManager< NGridType >
GridReference< NGridType > * getFirst ()
 
GridReference< NGridType > * getLast ()
 
iterator begin ()
 
iterator end ()
 
iterator rbegin ()
 
iterator rend ()
 
- Public Member Functions inherited from RefManager< GridRefManager< NGridType >, NGridType >
 RefManager ()
 
virtual ~RefManager ()
 
Reference< GridRefManager
< NGridType >, NGridType > * 
getFirst ()
 
Reference< GridRefManager
< NGridType >, NGridType >
const
getFirst () const
 
Reference< GridRefManager
< NGridType >, NGridType > * 
getLast ()
 
Reference< GridRefManager
< NGridType >, NGridType >
const
getLast () const
 
iterator begin ()
 
iterator end ()
 
iterator rbegin ()
 
iterator rend ()
 
void clearReferences ()
 
- Public Member Functions inherited from LinkedListHead
 LinkedListHead ()
 
virtual ~LinkedListHead ()
 
bool isEmpty () const
 
LinkedListElementgetFirst ()
 
LinkedListElement constgetFirst () const
 
LinkedListElementgetLast ()
 
LinkedListElement constgetLast () const
 
void insertFirst (LinkedListElement *pElem)
 
void insertLast (LinkedListElement *pElem)
 
uint32 getSize () const
 
void incSize ()
 
void decSize ()
 

Private Attributes

Battlegroundm_bg
 

Additional Inherited Members

- Public Types inherited from Map
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 MapRefManager PlayerList
 
typedef
std::unordered_multimap
< ObjectGuid::LowType,
Creature * > 
CreatureBySpawnIdContainer
 
typedef
std::unordered_multimap
< ObjectGuid::LowType,
GameObject * > 
GameObjectBySpawnIdContainer
 
- Public Types inherited from GridRefManager< NGridType >
typedef
LinkedListHead::Iterator
< GridReference< NGridType > > 
iterator
 
- Public Types inherited from RefManager< GridRefManager< NGridType >, NGridType >
typedef
LinkedListHead::Iterator
< Reference< GridRefManager
< NGridType >, NGridType > > 
iterator
 
- Public Types inherited from LinkedListHead
typedef Iterator
< LinkedListElement
iterator
 
- Static Public Member Functions inherited from Map
static bool ExistMap (uint32 mapid, int gx, int gy)
 
static bool ExistVMap (uint32 mapid, int gx, int gy)
 
static void InitStateMachine ()
 
static void DeleteStateMachine ()
 
static void DeleteRespawnTimesInDB (uint16 mapId, uint32 instanceId)
 
- Public Attributes inherited from Map
CreatureGroupHolderType CreatureGroupHolder
 
- Protected Types inherited from Map
typedef std::set< WorldObject * > ActiveNonPlayers
 
typedef std::set< Transport * > TransportsContainer
 
- Protected Member Functions inherited from Map
void SetUnloadReferenceLock (const GridCoord &p, bool on)
 
virtual void LoadGridObjects (NGridType *grid, Cell const &cell)
 
- Protected Attributes inherited from Map
std::mutex _mapLock
 
std::mutex _gridLock
 
MapEntry consti_mapEntry
 
uint8 i_spawnMode
 
uint32 i_InstanceId
 
uint32 m_unloadTimer
 
float m_VisibleDistance
 
DynamicMapTree _dynamicTree
 
MapRefManager m_mapRefManager
 
MapRefManager::iterator m_mapRefIter
 
int32 m_VisibilityNotifyPeriod
 
ActiveNonPlayers m_activeNonPlayers
 
ActiveNonPlayers::iterator m_activeNonPlayersIter
 
TransportsContainer _transports
 
TransportsContainer::iterator _transportsUpdateIter
 

Constructor & Destructor Documentation

BattlegroundMap::BattlegroundMap ( uint32  id,
time_t  expiry,
uint32  InstanceId,
Map _parent,
uint8  spawnMode 
)
3452  : Map(id, expiry, InstanceId, spawnMode, _parent), m_bg(NULL)
3453 {
3454  //lets initialize visibility distance for BG/Arenas
3456 }
arena_t NULL
Definition: jemalloc_internal.h:624
Battleground * m_bg
Definition: Map.h:807
Map(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode, Map *_parent=NULL)
Definition: Map.cpp:227
virtual void InitVisibilityDistance() override
Definition: Map.cpp:3468

+ Here is the call graph for this function:

BattlegroundMap::~BattlegroundMap ( )
3459 {
3460  if (m_bg)
3461  {
3462  //unlink to prevent crash, always unlink all pointer reference before destruction
3463  m_bg->SetBgMap(NULL);
3464  m_bg = NULL;
3465  }
3466 }
arena_t NULL
Definition: jemalloc_internal.h:624
Battleground * m_bg
Definition: Map.h:807
void SetBgMap(BattlegroundMap *map)
Definition: Battleground.h:355

+ Here is the call graph for this function:

Member Function Documentation

bool BattlegroundMap::AddPlayerToMap ( Player player,
bool  initPlayer = true 
)
overridevirtual

Reimplemented from Map.

3493 {
3494  {
3495  std::lock_guard<std::mutex> lock(_mapLock);
3496  //Check moved to void WorldSession::HandleMoveWorldportAckOpcode()
3497  //if (!CanEnter(player))
3498  //return false;
3499  // reset instance validity, battleground maps do not homebind
3500  player->m_InstanceValid = true;
3501  }
3502  return Map::AddPlayerToMap(player, initPlayer);
3503 }
std::mutex _mapLock
Definition: Map.h:637
virtual bool AddPlayerToMap(Player *player, bool initPlayer=true)
Definition: Map.cpp:513

+ Here is the call graph for this function:

Map::EnterState BattlegroundMap::CannotEnter ( Player player)
overridevirtual

Reimplemented from Map.

3476 {
3477  if (player->GetMapRef().getTarget() == this)
3478  {
3479  TC_LOG_ERROR("maps", "BGMap::CannotEnter - player %s is already in map!", player->GetGUID().ToString().c_str());
3480  ABORT();
3482  }
3483 
3484  if (player->GetBattlegroundId() != GetInstanceId())
3486 
3487  // player number limit is checked in bgmgr, no need to do it here
3488 
3489  return Map::CannotEnter(player);
3490 }
#define ABORT
Definition: Errors.h:56
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
virtual EnterState CannotEnter(Player *)
Definition: Map.h:386
uint32 GetInstanceId() const
Definition: Map.h:368

+ Here is the call graph for this function:

Battleground* BattlegroundMap::GetBG ( )
inline
804 { return m_bg; }
Battleground * m_bg
Definition: Map.h:807

+ Here is the caller graph for this function:

void BattlegroundMap::InitVisibilityDistance ( )
overridevirtual

Reimplemented from Map.

3469 {
3470  //init visibility distance for BG/Arenas
3473 }
float m_VisibleDistance
Definition: Map.h:644
static float GetMaxVisibleDistanceInBGArenas()
Definition: World.h:731
static int32 GetVisibilityNotifyPeriodInBGArenas()
Definition: World.h:735
int32 m_VisibilityNotifyPeriod
Definition: Map.h:650

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void BattlegroundMap::RemoveAllPlayers ( )
overridevirtual

Reimplemented from Map.

3517 {
3518  if (HavePlayers())
3519  for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
3520  if (Player* player = itr->GetSource())
3521  if (!player->IsBeingTeleportedFar())
3522  player->TeleportTo(player->GetBattlegroundEntryPoint());
3523 }
iterator begin()
Definition: MapRefManager.h:37
bool HavePlayers() const
Definition: Map.h:423
MapRefManager m_mapRefManager
Definition: Map.h:647
iterator end()
Definition: MapRefManager.h:38

+ Here is the call graph for this function:

void BattlegroundMap::RemovePlayerFromMap ( Player player,
bool  remove 
)
overridevirtual

Reimplemented from Map.

3506 {
3507  TC_LOG_DEBUG("maps", "MAP: Removing player '%s' from bg '%u' of map '%s' before relocating to another map", player->GetName().c_str(), GetInstanceId(), GetMapName());
3508  Map::RemovePlayerFromMap(player, remove);
3509 }
virtual void RemovePlayerFromMap(Player *, bool)
Definition: Map.cpp:872
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
const char * GetMapName() const
Definition: Map.cpp:2644
uint32 GetInstanceId() const
Definition: Map.h:368

+ Here is the call graph for this function:

void BattlegroundMap::SetBG ( Battleground bg)
inline
805 { m_bg = bg; }
Battleground * m_bg
Definition: Map.h:807

+ Here is the caller graph for this function:

void BattlegroundMap::SetUnload ( )
3512 {
3514 }
uint32 m_unloadTimer
Definition: Map.h:643
#define MIN_UNLOAD_DELAY
Definition: Map.h:251

+ Here is the caller graph for this function:

Member Data Documentation

Battleground* BattlegroundMap::m_bg
private

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