Add stricter regulations for instances (login-checks and support for sending unbound player to parent-instance / homebind if not matching criterias)

Patch by Elron103 - closes issue #1323.

--HG--
branch : trunk
This commit is contained in:
click
2010-05-04 18:25:30 +02:00
parent 51d0c07c90
commit 029e480454
9 changed files with 132 additions and 16 deletions

View File

@@ -157,7 +157,7 @@ Map* MapManager::FindMap(uint32 mapid, uint32 instanceId) const
return ((MapInstanced*)map)->FindMap(instanceId);
}
bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck)
{
const MapEntry *entry = sMapStore.LookupEntry(mapid);
if (!entry)
@@ -263,7 +263,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
int8 maxPlayers = mapDiff ? mapDiff->maxPlayers : 0;
if (maxPlayers != -1) //-1: unlimited access
{
if (boundedMap->GetPlayersCountExceptGMs() >= maxPlayers)
if (loginCheck ? boundedMap->GetPlayersCountExceptGMs() > maxPlayers : boundedMap->GetPlayersCountExceptGMs() >= maxPlayers)
{
sLog.outDebug("MAP: Player '%s' can't enter instance '%s' because it's full.", player->GetName(), mapName);
player->SendTransferAborted(mapid, TRANSFER_ABORT_MAX_PLAYERS);