52 if (num_threads > 0 &&
m_updater.activate(num_threads) == -1)
58 for (MapMapType::iterator iter =
i_maps.begin(); iter !=
i_maps.end(); ++iter)
59 (*iter).second->InitVisibilityDistance();
70 SF_LOG_ERROR(
"maps",
"MapManager::checkGridStates(), GridState: si_GridStates is currupt !!!");
103 std::lock_guard<std::mutex> guard(
Lock);
157 m = ((
MapInstanced*)m)->CreateInstanceForPlayer(
id, player);
169 return instanceId == 0 ? map : NULL;
171 return ((
MapInstanced*)map)->FindInstanceMap(instanceId);
207 char const* mapName = entry->
name;
218 SF_LOG_DEBUG(
"maps",
"MAP: Player '%s' must be in a raid group to enter instance '%s'", player->
GetName().c_str(), mapName);
228 uint32 corpseMap = corpse->GetMapId();
231 if (corpseMap == mapid)
235 corpseMap = corpseInstance ? corpseInstance->
Parent : 0;
242 SF_LOG_DEBUG(
"maps",
"MAP: Player '%s' does not have a corpse in instance '%s' and cannot enter.", player->
GetName().c_str(), mapName);
245 SF_LOG_DEBUG(
"maps",
"MAP: Player '%s' has corpse in instance '%s' and can enter.", player->
GetName().c_str(), mapName);
250 SF_LOG_DEBUG(
"maps",
"Map::CanPlayerEnter - player '%s' is dead but does not have a corpse!", player->
GetName().c_str());
257 if (boundInstance && boundInstance->
save)
259 if (!loginCheck && !boundMap->CanEnter(player))
276 uint32 instaceIdToCheck = 0;
278 instaceIdToCheck = save->GetInstanceId();
289 return player->
Satisfy(
sObjectMgr->GetAccessRequirement(mapid, targetDifficulty), mapid,
true);
300 MapMapType::iterator iter =
i_maps.begin();
301 for (; iter !=
i_maps.end(); ++iter)
311 for (iter =
i_maps.begin(); iter !=
i_maps.end(); ++iter)
336 return mEntry ? true :
false;
345 for (MapMapType::iterator iter =
i_maps.begin(); iter !=
i_maps.end();)
347 iter->second->UnloadAll();
360 std::lock_guard<std::mutex> guard(
Lock);
363 for (MapMapType::iterator itr =
i_maps.begin(); itr !=
i_maps.end(); ++itr)
365 Map* map = itr->second;
369 for (MapInstanced::InstancedMaps::iterator mitr = maps.begin(); mitr != maps.end(); ++mitr)
370 if (mitr->second->IsInstance()) ret++;
377 std::lock_guard<std::mutex> guard(
Lock);
380 for (MapMapType::iterator itr =
i_maps.begin(); itr !=
i_maps.end(); ++itr)
382 Map* map = itr->second;
386 for (MapInstanced::InstancedMaps::iterator mitr = maps.begin(); mitr != maps.end(); ++mitr)
387 if (mitr->second->IsInstance())
388 ret += ((
InstanceMap*)mitr->second)->GetPlayers().getSize();
400 uint32 maxId = (*result)[0].GetUInt32();
403 _instanceIds.resize((maxId / 32) * 32 + (maxId % 32 > 0 ? 32 : 0));
429 SF_LOG_ERROR(
"maps",
"Instance ID overflow!! Can't continue, shutting down server. ");
442 _instanceIds.resize((newInstanceId / 32) * 32 + (newInstanceId % 32 > 0 ? 32 : 0));
447 return newInstanceId;
MapDifficulty const * GetMapDifficultyData(uint32 mapId, DifficultyID difficulty)
MapDifficulty const * GetDownscaledMapDifficultyData(uint32 mapId, DifficultyID &difficulty)
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
CoordPair< MAX_NUMBER_OF_GRIDS > GridCoord
@ LANG_INSTANCE_RAID_GROUP_ONLY
#define SF_LOG_DEBUG(filterType__,...)
#define SF_LOG_ERROR(filterType__,...)
GridState * si_GridStates[MAX_GRID_STATE]
@ TRANSFER_ABORT_DIFFICULTY
@ TRANSFER_ABORT_TOO_MANY_INSTANCES
Skyfire::AutoPtr< ResultSet, Skyfire::Mutex > QueryResult
InstanceGroupBind * GetBoundInstance(Player *player)
uint32 GetInstanceId() const
static void DeleteStateMachine()
bool Instanceable() const
static void InitStateMachine()
static bool ExistVMap(uint32 mapid, int gx, int gy)
static bool ExistMap(uint32 mapid, int gx, int gy)
UNORDERED_MAP< uint32, Map * > InstancedMaps
void RegisterInstanceId(uint32 instanceId)
Map * FindBaseNonInstanceMap(uint32 mapId) const
void SetNextInstanceId(uint32 nextInstanceId)
uint32 GetNumPlayersInInstances()
static bool ExistMapAndVMap(uint32 mapid, float x, float y)
void checkAndCorrectGridStatesArray()
GridState * i_GridStates[MAX_GRID_STATE]
Map * FindBaseMap(uint32 mapId) const
uint32 i_gridCleanUpDelay
void DoDelayedMovesAndRemoves()
Map * FindMap(uint32 mapId, uint32 instanceId) const
void InitializeVisibilityDistanceInfo()
Map * CreateMap(uint32 mapId, Player *player)
int i_GridStateErrorCount
bool CanPlayerEnter(uint32 mapid, Player *player, bool loginCheck=false)
Map * CreateBaseMap(uint32 mapId)
static bool IsValidMAP(uint32 mapid, bool startUp)
uint32 GenerateInstanceId()
void FreeInstanceId(uint32 instanceId)
InstanceSave * GetInstanceSave(uint32 mapid)
bool CheckInstanceCount(uint32 instanceId) const
DifficultyID GetDifficulty(MapEntry const *mapEntry) const
WorldSession * GetSession() const
Corpse * GetCorpse() const
bool Satisfy(AccessRequirement const *ar, uint32 target_map, bool report=false)
bool IsGameMaster() const
void SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 arg=0)
DifficultyID GetDungeonDifficulty() const
void ResurrectPlayer(float restore_percent, bool applySickness=false)
void RecordMapUpdatePass(uint32 mapCount)
static void StopNow(uint8 exitcode)
std::string const & GetName() const
void SendNotification(const char *format,...) ATTR_PRINTF(2
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
@ SMSG_CORPSE_NOT_IN_INSTANCE
@ CONFIG_INTERVAL_MAPUPDATE
@ CONFIG_INTERVAL_GRIDCLEAN
@ CONFIG_INSTANCE_IGNORE_RAID
RuntimeMetrics & GetRuntimeMetrics()
GridCoord ComputeGridCoord(float x, float y)
bool IsNonRaidInstance() const
bool Instanceable() const