diff options
author | tartalo <none@none> | 2009-10-22 19:42:45 +0200 |
---|---|---|
committer | tartalo <none@none> | 2009-10-22 19:42:45 +0200 |
commit | d8c60cce4f78083aa8157016fe1bf51b8e801509 (patch) | |
tree | 821cf13b01ff5cba1057c9ac8fda6b5769d51977 /src | |
parent | 3df36bf9faa80e99153ad55c8bc85dc27d14411e (diff) |
MapManager.cpp: Deny access to an instance if player is permanently bounded to a different instance than group
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/MapManager.cpp | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/game/MapManager.cpp b/src/game/MapManager.cpp index 476426b8106..5b1dc609d56 100644 --- a/src/game/MapManager.cpp +++ b/src/game/MapManager.cpp @@ -240,18 +240,26 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player) InstanceGroupBind* boundedInstance = player->GetGroup()->GetBoundInstance(mapid, player->GetDifficulty()); if (boundedInstance && boundedInstance->save) { - Map *boundedMap = MapManager::Instance().FindMap(mapid,boundedInstance->save->GetInstanceId()); - //Encounters in progress - if (boundedMap && ((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); - player->SendTransferAborted(mapid, TRANSFER_ABORT_ZONE_IN_COMBAT); - return(false); - } - - //Instance is full - if (boundedMap) + if (Map *boundedMap = MapManager::Instance().FindMap(mapid,boundedInstance->save->GetInstanceId())) { + //Player permanently bounded to different instance than groups one + InstancePlayerBind* playerBoundedInstance = player->GetBoundInstance(mapid, player->GetDifficulty()); + if (playerBoundedInstance && playerBoundedInstance->perm && playerBoundedInstance->save && + boundedInstance->save->GetInstanceId() != playerBoundedInstance->save->GetInstanceId()) + { + //TODO: send some kind of error message to the player + return false; + } + + //Encounters in progress + if (((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); + player->SendTransferAborted(mapid, TRANSFER_ABORT_ZONE_IN_COMBAT); + return(false); + } + + //Instance is full int8 maxPlayers = (player->GetDifficulty() == DIFFICULTY_HEROIC) ? instance->maxPlayersHeroic : instance->maxPlayers; if (maxPlayers != -1) //-1: unlimited access { |