1422 | | if(!player->isGameMaster() && i_data && i_data->IsEncounterInProgress()) |
| 1422 | if(std::find(i_Players.begin(),i_Players.end(),player)!=i_Players.end()) |
| 1423 | { |
| 1424 | sLog.outError("InstanceMap::CanEnter - player %s(%u) already in map %d,%d,%d!", player->GetName(), player->GetGUIDLow(), GetId(), GetInstanceId(), GetSpawnMode()); |
| 1425 | assert(false); |
| 1426 | return false; |
| 1427 | } |
| 1428 | |
| 1429 | // cannot enter if the instance is full (player cap), GMs don't count |
| 1430 | InstanceTemplate const* iTemplate = objmgr.GetInstanceTemplate(GetId()); |
| 1431 | if (!player->isGameMaster() && GetPlayersCountExceptGMs() >= iTemplate->maxPlayers) |
| 1432 | { |
| 1433 | sLog.outDetail("MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), iTemplate->maxPlayers, player->GetName()); |
| 1434 | player->SendTransferAborted(GetId(), TRANSFER_ABORT_MAX_PLAYERS); |
| 1435 | return false; |
| 1436 | } |
| 1437 | |
| 1438 | // cannot enter while players in the instance are in combat |
| 1439 | Group *pGroup = player->GetGroup(); |
| 1440 | if(!player->isGameMaster() && pGroup && pGroup->InCombatToInstance(GetInstanceId()) && player->isAlive() && player->GetMapId() != GetId()) |
| 1441 | { |
| 1442 | player->SendTransferAborted(GetId(), TRANSFER_ABORT_ZONE_IN_COMBAT); |
| 1443 | return false; |
| 1444 | } |
| 1445 | |
| 1446 | /*if(!player->isGameMaster() && i_data && i_data->IsEncounterInProgress()) |
1427 | | } |
1428 | | |
1429 | | if(std::find(i_Players.begin(),i_Players.end(),player)!=i_Players.end()) |
1430 | | { |
1431 | | sLog.outError("InstanceMap::CanEnter - player %s(%u) already in map %d,%d,%d!", player->GetName(), player->GetGUIDLow(), GetId(), GetInstanceId(), GetSpawnMode()); |
1432 | | assert(false); |
1433 | | return false; |
1434 | | } |
1435 | | |
1436 | | // cannot enter if the instance is full (player cap), GMs don't count |
1437 | | InstanceTemplate const* iTemplate = objmgr.GetInstanceTemplate(GetId()); |
1438 | | if (!player->isGameMaster() && GetPlayersCountExceptGMs() >= iTemplate->maxPlayers) |
1439 | | { |
1440 | | sLog.outDetail("MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), iTemplate->maxPlayers, player->GetName()); |
1441 | | player->SendTransferAborted(GetId(), TRANSFER_ABORT_MAX_PLAYERS); |
1442 | | return false; |
1443 | | } |
1444 | | |
1445 | | // cannot enter while players in the instance are in combat |
1446 | | Group *pGroup = player->GetGroup(); |
1447 | | if(pGroup && pGroup->InCombatToInstance(GetInstanceId()) && player->isAlive() && player->GetMapId() != GetId()) |
1448 | | { |
1449 | | player->SendTransferAborted(GetId(), TRANSFER_ABORT_ZONE_IN_COMBAT); |
1450 | | return false; |
1451 | | } |
| 1451 | }*/ |