31 (*i).second->InitVisibilityDistance();
45 if (i->second->CanUnload(t))
55 if (
sMapMgr->GetMapUpdater()->activated())
56 sMapMgr->GetMapUpdater()->schedule_update(*i->second, t);
67 i->second->DelayedUpdate(diff);
84 i->second->UnloadAll();
103 if (
GetId() != mapId || !player)
117 map =
sMapMgr->FindMap(mapId, newInstanceId);
136 if (!pBind || !pBind->
perm)
148 pSave = groupBind->
save;
165 newInstanceId =
sMapMgr->GenerateInstanceId();
182 std::lock_guard<std::mutex> guard(
Lock);
194 SF_LOG_ERROR(
"maps",
"CreateInstance: no instance template for map %d",
GetId());
201 SF_LOG_DEBUG(
"maps",
"MapInstanced::CreateInstance: %s map instance %d for %d created with difficulty %s", save ?
"" :
"new ", InstanceId,
GetId(), difficulty ?
"heroic" :
"normal");
208 bool load_data = save != NULL;
219 std::lock_guard<std::mutex> guard(
Lock);
221 SF_LOG_DEBUG(
"maps",
"MapInstanced::CreateBattleground: map bg %d for %d created.", InstanceId,
GetId());
246 if (itr->second->HavePlayers())
252 itr->second->UnloadAll();
264 if (itr->second->IsBattlegroundOrArena())
265 sMapMgr->FreeInstanceId(itr->second->GetInstanceId());
PvPDifficultyEntry const * GetBattlegroundBracketByLevel(uint32 mapid, uint32 level)
MapDifficulty const * GetDownscaledMapDifficultyData(uint32 mapId, DifficultyID &difficulty)
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
#define MAX_NUMBER_OF_GRIDS
#define SF_LOG_DEBUG(filterType__,...)
#define SF_LOG_ERROR(filterType__,...)
uint32 GetMinLevel() const
void SetBgMap(BattlegroundMap *map)
void SetBG(Battleground *bg)
void RemoveAllPlayers() OVERRIDE
DifficultyID GetDifficulty(MapEntry const *mapEntry) const
InstanceGroupBind * GetBoundInstance(Player *player)
void CreateInstanceData(bool load)
DifficultyID GetDifficulty() const
uint32 GetInstanceId() const
static MMapManager * createOrGetMMapManager()
bool unloadMap(uint32 mapId, int32 x, int32 y)
bool IsBattlegroundOrArena() const
Map(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode, Map *_parent=NULL)
virtual void Update(const uint32)
virtual void DelayedUpdate(const uint32 diff)
MapEntry const * GetEntry() const
time_t GetGridExpiry(void) const
InstanceMap * CreateInstance(uint32 InstanceId, InstanceSave *save, DifficultyID difficulty)
InstancedMaps m_InstancedMaps
void DelayedUpdate(const uint32 diff) OVERRIDE
void Update(const uint32) OVERRIDE
Map * FindInstanceMap(uint32 instanceId) const
uint16 GridMapReference[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS]
bool CanEnter(Player *player) OVERRIDE
MapInstanced(uint32 id, time_t expiry)
Map * CreateInstanceForPlayer(const uint32 mapId, Player *player)
bool DestroyInstance(InstancedMaps::iterator &itr)
void UnloadAll() OVERRIDE
BattlegroundMap * CreateBattleground(uint32 InstanceId, Battleground *bg)
virtual void InitVisibilityDistance() OVERRIDE
void UnbindInstance(uint32 mapid, DifficultyID difficulty, bool unload=false)
InstancePlayerBind * GetBoundInstance(uint32 mapid, DifficultyID difficulty)
DifficultyID GetDifficulty(MapEntry const *mapEntry) const
bool TeleportToBGEntryPoint()
Battleground * GetBattleground() const
uint32 GetBattlegroundId() const
virtual void unloadMap(unsigned int pMapId, int x, int y)=0
static IVMapManager * createOrGetVMapManager()