Block access to instances if encounter is in progress only for raids (not for
5 player dungeons). Don't count GMs for instance full block --HG-- branch : trunk
This commit is contained in:
+9
-4
@@ -2508,18 +2508,23 @@ bool InstanceMap::CanEnter(Player *player)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// allow GM's to enter
|
||||||
|
if (player->isGameMaster())
|
||||||
|
return Map::CanEnter(player);
|
||||||
|
|
||||||
// cannot enter if the instance is full (player cap), GMs don't count
|
// cannot enter if the instance is full (player cap), GMs don't count
|
||||||
uint32 maxPlayers = GetMaxPlayers();
|
uint32 maxPlayers = GetMaxPlayers();
|
||||||
if (!player->isGameMaster() && GetPlayersCountExceptGMs() >= maxPlayers)
|
if (GetPlayersCountExceptGMs() >= maxPlayers)
|
||||||
{
|
{
|
||||||
sLog.outDetail("MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), maxPlayers, player->GetName());
|
sLog.outDetail("MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), maxPlayers, player->GetName());
|
||||||
player->SendTransferAborted(GetId(), TRANSFER_ABORT_MAX_PLAYERS);
|
player->SendTransferAborted(GetId(), TRANSFER_ABORT_MAX_PLAYERS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// cannot enter while players in the instance are in combat
|
// cannot enter while an encounter is in progress on raids
|
||||||
Group *pGroup = player->GetGroup();
|
/*Group *pGroup = player->GetGroup();
|
||||||
if(!player->isGameMaster() && pGroup && pGroup->InCombatToInstance(GetInstanceId()) && player->GetMapId() != GetId())
|
if(!player->isGameMaster() && pGroup && pGroup->InCombatToInstance(GetInstanceId()) && player->GetMapId() != GetId())*/
|
||||||
|
if (IsRaid() && GetInstanceData()->IsEncounterInProgress())
|
||||||
{
|
{
|
||||||
player->SendTransferAborted(GetId(), TRANSFER_ABORT_ZONE_IN_COMBAT);
|
player->SendTransferAborted(GetId(), TRANSFER_ABORT_ZONE_IN_COMBAT);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Encounters in progress
|
//Encounters in progress
|
||||||
if (((InstanceMap*)boundedMap)->GetInstanceData() && ((InstanceMap*)boundedMap)->GetInstanceData()->IsEncounterInProgress())
|
if (entry->map_type == MAP_RAID && ((InstanceMap*)boundedMap)->GetInstanceData() && ((InstanceMap*)boundedMap)->GetInstanceData()->IsEncounterInProgress())
|
||||||
{
|
{
|
||||||
sLog.outDebug("MAP: Player '%s' can't enter instance '%s' while an encounter is in progress.", player->GetName(), mapName);
|
sLog.outDebug("MAP: Player '%s' can't enter instance '%s' while an encounter is in progress.", player->GetName(), mapName);
|
||||||
player->SendTransferAborted(mapid, TRANSFER_ABORT_ZONE_IN_COMBAT);
|
player->SendTransferAborted(mapid, TRANSFER_ABORT_ZONE_IN_COMBAT);
|
||||||
@@ -263,7 +263,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
|
|||||||
int8 maxPlayers = (player->GetDifficulty() == DIFFICULTY_HEROIC) ? instance->maxPlayersHeroic : instance->maxPlayers;
|
int8 maxPlayers = (player->GetDifficulty() == DIFFICULTY_HEROIC) ? instance->maxPlayersHeroic : instance->maxPlayers;
|
||||||
if (maxPlayers != -1) //-1: unlimited access
|
if (maxPlayers != -1) //-1: unlimited access
|
||||||
{
|
{
|
||||||
if (boundedMap->GetPlayers().getSize() >= maxPlayers)
|
if (boundedMap->GetPlayersCountExceptGMs() >= maxPlayers)
|
||||||
{
|
{
|
||||||
sLog.outDebug("MAP: Player '%s' can't enter instance '%s' because it's full.", player->GetName(), mapName);
|
sLog.outDebug("MAP: Player '%s' can't enter instance '%s' because it's full.", player->GetName(), mapName);
|
||||||
player->SendTransferAborted(mapid, TRANSFER_ABORT_MAX_PLAYERS);
|
player->SendTransferAborted(mapid, TRANSFER_ABORT_MAX_PLAYERS);
|
||||||
|
|||||||
Reference in New Issue
Block a user